diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/FullDataPointUtil.java b/core/src/main/java/com/seibel/distanthorizons/core/util/FullDataPointUtil.java index c02f567af..606af3eb6 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/FullDataPointUtil.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/FullDataPointUtil.java @@ -44,10 +44,10 @@ import org.jetbrains.annotations.Contract; * YY YY YY YY YY YY YY YY
* YY YY YY YY DP DP DP DP
* DP DP DP DP DP DP DP DP
- * ID ID ID ID ID ID IO ID
- * ID ID ID ID ID ID IO ID
- * ID ID ID ID ID ID IO ID
- * ID ID ID ID ID ID IO ID <-- Bottom bits
+ * ID ID ID ID ID ID ID ID
+ * ID ID ID ID ID ID ID ID
+ * ID ID ID ID ID ID ID ID
+ * ID ID ID ID ID ID ID ID <-- Bottom bits
* * * @see RenderDataPointUtil @@ -106,6 +106,20 @@ public class FullDataPointUtil /** Remaps the biome/blockState ID of the given datapoint */ @Contract(pure = true) - public static long remap(int[] newIdMapping, long data) { return (data & INVERSE_ID_MASK) | newIdMapping[(int) data]; } + public static long remap(int[] newIdMapping, long data) throws IndexOutOfBoundsException + { + int currentId = getId(data); + try + { + int newId = newIdMapping[currentId]; + return (data & INVERSE_ID_MASK) | newId; + } + catch (IndexOutOfBoundsException e) + { + // this try-catch is present to fix an issue where the stack trace is missing + // and to allow for easily attaching a debugger + throw new RuntimeException(e); + } + } }