From f3f3c3d54dbcbf54dd23c9bb214c61c1dc964e18 Mon Sep 17 00:00:00 2001 From: cola98765 Date: Sun, 20 Feb 2022 10:54:17 +0100 Subject: [PATCH] gen mode + 1 of what was before --- .../core/enums/config/DistanceGenerationMode.java | 12 ++++++------ .../com/seibel/lod/core/util/DataPointUtil.java | 13 +++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/enums/config/DistanceGenerationMode.java b/src/main/java/com/seibel/lod/core/enums/config/DistanceGenerationMode.java index 38d5b3dec..d2984b259 100644 --- a/src/main/java/com/seibel/lod/core/enums/config/DistanceGenerationMode.java +++ b/src/main/java/com/seibel/lod/core/enums/config/DistanceGenerationMode.java @@ -38,7 +38,7 @@ public enum DistanceGenerationMode /** * Don't generate anything except just load in already existing chunks */ - NONE((byte) 0), + NONE((byte) 1), /** * Only generate the biomes and use biome @@ -47,7 +47,7 @@ public enum DistanceGenerationMode * Doesn't generate height, everything is shown at sea level. * Multithreaded - Fastest (2-5 ms) */ - BIOME_ONLY((byte) 1), + BIOME_ONLY((byte) 2), /** * Same as BIOME_ONLY, except instead @@ -55,7 +55,7 @@ public enum DistanceGenerationMode * different biome types (mountain, ocean, forest, etc.) * use predetermined heights to simulate having height data. */ - BIOME_ONLY_SIMULATE_HEIGHT((byte) 2), + BIOME_ONLY_SIMULATE_HEIGHT((byte) 3), /** * Generate the world surface, @@ -63,7 +63,7 @@ public enum DistanceGenerationMode * or structures. * Multithreaded - Faster (10-20 ms) */ - SURFACE((byte) 3), + SURFACE((byte) 4), /** * Generate everything except structures. @@ -71,7 +71,7 @@ public enum DistanceGenerationMode * since some features cause concurrentModification exceptions. * Multithreaded - Fast (15-20 ms) */ - FEATURES((byte) 4), + FEATURES((byte) 5), /** * Ask the server to generate/load each chunk. @@ -80,7 +80,7 @@ public enum DistanceGenerationMode * are adding the mod on a pre-existing world. * Singlethreaded - Slow (15-50 ms, with spikes up to 200 ms) */ - FULL((byte) 5); + FULL((byte) 6); public static DistanceGenerationMode RENDERABLE = DistanceGenerationMode.BIOME_ONLY; diff --git a/src/main/java/com/seibel/lod/core/util/DataPointUtil.java b/src/main/java/com/seibel/lod/core/util/DataPointUtil.java index feb913838..b0ac71fac 100644 --- a/src/main/java/com/seibel/lod/core/util/DataPointUtil.java +++ b/src/main/java/com/seibel/lod/core/util/DataPointUtil.java @@ -89,10 +89,7 @@ public class DataPointUtil public static long createVoidDataPoint(int generationMode) { - long dataPoint = 0; - dataPoint |= (generationMode & GEN_TYPE_MASK) << GEN_TYPE_SHIFT; - dataPoint |= VOID_SETTER; - return dataPoint; + return (generationMode & GEN_TYPE_MASK) << GEN_TYPE_SHIFT; } public static long createDataPoint(int height, int depth, int color, int lightSky, int lightBlock, int generationMode) @@ -140,8 +137,8 @@ public class DataPointUtil long height = (dataPoint >>> 26) & 0x3FF; long depth = (dataPoint >>> 16) & 0x3FF; - if (height == depth || (dataPoint & 0b10)==1) { - return createVoidDataPoint((int) ((dataPoint >>> 2) & 0xFF)); + if (height == depth || (dataPoint & 0b10)==0b10) { + return createVoidDataPoint((int) ((dataPoint >>> 2) & 0b111) + 1); } return ((dataPoint >>> 60) & 0xF) << ALPHA_SHIFT | ((dataPoint >>> 52) & 0xFF) << RED_SHIFT @@ -150,7 +147,7 @@ public class DataPointUtil | ((dataPoint >>> 26) & 0x3FF) << HEIGHT_SHIFT | ((dataPoint >>> 16) & 0x3FF) << DEPTH_SHIFT | ((dataPoint >>> 8) & 0xFF) << SKY_LIGHT_SHIFT - | ((dataPoint >>> 2) & 0xFF) << GEN_TYPE_SHIFT; + | (((dataPoint >>> 2) & 0xFF) + 1) << GEN_TYPE_SHIFT; } public static short getHeight(long dataPoint) @@ -202,7 +199,7 @@ public class DataPointUtil public static boolean isVoid(long dataPoint) { - return getHeight(dataPoint) == getDepth(dataPoint); + return (((dataPoint >>> DEPTH_SHIFT) & HEIGHT_DEPTH_MASK) == 0); } public static boolean doesItExist(long dataPoint)