diff --git a/api/src/main/java/com/seibel/lod/api/enums/EDhApiDetailLevel.java b/api/src/main/java/com/seibel/lod/api/enums/EDhApiDetailLevel.java new file mode 100644 index 000000000..b6e0ce518 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/enums/EDhApiDetailLevel.java @@ -0,0 +1,52 @@ +package com.seibel.lod.api.enums; + +/** + * BLOCK - Detail Level: 0, width 1 block,
+ * CHUNK - Detail Level: 4, width 16 block,
+ * REGION - Detail Level: 9, width 512 block

+ * + * Detail levels in Distant Horizons represent how large a section (of either LODs or MC chunks) + * is, with the smallest being 0 (1 block wide).
+ * The width of a detail level can be calculated by putting the detail level to the power of 2.
+ * Example for the chunk detail level (4): 2^4 = 16 blocks wide

+ * + * This enum doesn't contain all valid detail levels, only those most likely to be needed. + * Detail levels 1,2,3, ... 255 are all technically valid detail levels + * (although anything beyond {@link EDhApiDetailLevel#REGION} may be difficult deal with). + * + * @author James Seibel + * @version 2022-12-5 + */ +public enum EDhApiDetailLevel +{ + // Reminder: + // when adding items up the API minor version + // when removing items up the API major version + + /** + * detail level: 0
+ * width in Blocks: 1 + */ + BLOCK(0, 1), + /** + * detail level: 4
+ * width in Blocks: 16 + */ + CHUNK(4, 16), + /** + * detail level: 9
+ * width in Blocks: 512 + */ + REGION(9, 512); + + + public final int detailLevel; + public final int widthInBlocks; + + EDhApiDetailLevel(int detailLevel, int widthInBlocks) + { + this.detailLevel = detailLevel; + this.widthInBlocks = widthInBlocks; + } + +} diff --git a/core/src/main/java/com/seibel/lod/core/util/LodUtil.java b/core/src/main/java/com/seibel/lod/core/util/LodUtil.java index 198dfaaf0..adab90b8f 100644 --- a/core/src/main/java/com/seibel/lod/core/util/LodUtil.java +++ b/core/src/main/java/com/seibel/lod/core/util/LodUtil.java @@ -96,33 +96,25 @@ public class LodUtil ColorUtil.rgbToInt(255, 255, 255)}; - public static final byte DETAIL_OPTIONS = 10; - /** 512 blocks wide */ - public static final byte REGION_DETAIL_LEVEL = DETAIL_OPTIONS - 1; + public static final byte REGION_DETAIL_LEVEL = 9; /** 16 blocks wide */ public static final byte CHUNK_DETAIL_LEVEL = 4; /** 1 block wide */ public static final byte BLOCK_DETAIL_LEVEL = 0; - //public static final short MAX_VERTICAL_DATA = 4; - /** * measured in Blocks
- * detail level max - 1 - * 256 blocks + * detail level 9 + * 512 x 512 blocks */ - public static final short REGION_WIDTH = 1 << REGION_DETAIL_LEVEL; + public static final short REGION_WIDTH = 512; /** * measured in Blocks
* detail level 4 + * 16 x 16 blocks */ public static final short CHUNK_WIDTH = 16; - /** - * measured in Blocks
- * detail level 0 - */ - public static final short BLOCK_WIDTH = 1; /** number of chunks wide */