From 455281a32d467fb05a2849ca55386fc81bbdcb17 Mon Sep 17 00:00:00 2001 From: cola98765 Date: Tue, 14 Dec 2021 21:36:51 +0100 Subject: [PATCH] no longer using getMinimumWorldHeight() form version constants, added replacement in WorldWrapper. --- .../lod/core/builders/lodBuilding/LodBuilder.java | 6 ++---- .../lod/core/objects/lod/VerticalLevelContainer.java | 10 ++++------ .../core/wrapperInterfaces/world/IWorldWrapper.java | 2 ++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java index 7038f55c2..0fb3917b6 100644 --- a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java @@ -35,7 +35,6 @@ import com.seibel.lod.core.util.LodThreadFactory; import com.seibel.lod.core.util.LodUtil; import com.seibel.lod.core.util.SingletonHandler; import com.seibel.lod.core.util.ThreadMapUtil; -import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorSingletonWrapper; import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper; import com.seibel.lod.core.wrapperInterfaces.block.IBlockShapeWrapper; @@ -58,11 +57,10 @@ import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper; public class LodBuilder { private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class); - private static final IBlockColorSingletonWrapper BLOCK_COLOR = SingletonHandler.get(IBlockColorSingletonWrapper.class); - private static final IVersionConstants VERSION_CONSTANTS = SingletonHandler.get(IVersionConstants.class); + private static final IBlockColorSingletonWrapper BLOCK_COLOR = SingletonHandler.get(IBlockColorSingletonWrapper.class); - public static final short MIN_WORLD_HEIGHT = (short)VERSION_CONSTANTS.getMinimumWorldHeight(); + public static final short MIN_WORLD_HEIGHT = MC.getWrappedClientWorld().getMinHeight(); /** Minecraft's max light value */ public static final short DEFAULT_MAX_LIGHT = 15; diff --git a/src/main/java/com/seibel/lod/core/objects/lod/VerticalLevelContainer.java b/src/main/java/com/seibel/lod/core/objects/lod/VerticalLevelContainer.java index 69be35485..1151b350a 100644 --- a/src/main/java/com/seibel/lod/core/objects/lod/VerticalLevelContainer.java +++ b/src/main/java/com/seibel/lod/core/objects/lod/VerticalLevelContainer.java @@ -22,7 +22,7 @@ package com.seibel.lod.core.objects.lod; import com.seibel.lod.core.dataFormat.*; import com.seibel.lod.core.enums.config.DistanceGenerationMode; import com.seibel.lod.core.util.*; -import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; /** * @@ -31,7 +31,7 @@ import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; */ public class VerticalLevelContainer implements LevelContainer { - + private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class); public final byte detailLevel; public final int size; public final int verticalSize; @@ -177,8 +177,7 @@ public class VerticalLevelContainer implements LevelContainer size = 1 << (LodUtil.REGION_DETAIL_LEVEL - detailLevel); int x = size * size * tempMaxVerticalData; long[] tempDataContainer = new long[x]; - final IVersionConstants VERSION_CONSTANTS = SingletonHandler.get(IVersionConstants.class); - short minHeight = (short) VERSION_CONSTANTS.getMinimumWorldHeight(); + short minHeight = MC.getWrappedClientWorld().getMinHeight(); if (version == 6) { @@ -1070,8 +1069,7 @@ public class VerticalLevelContainer implements LevelContainer long current; boolean allGenerated = true; byte[] tempData = ThreadMapUtil.getSaveContainer(detailLevel); - final IVersionConstants VERSION_CONSTANTS = SingletonHandler.get(IVersionConstants.class); - short minHeight = (short) VERSION_CONSTANTS.getMinimumWorldHeight(); + short minHeight = MC.getWrappedClientWorld().getMinHeight(); tempData[index] = detailLevel; index++; diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/world/IWorldWrapper.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/world/IWorldWrapper.java index d3b63ebe2..2e3510bb1 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/world/IWorldWrapper.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/world/IWorldWrapper.java @@ -52,6 +52,8 @@ public interface IWorldWrapper int getSeaLevel(); + short getMinHeight(); + /** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */ File getSaveFolder() throws UnsupportedOperationException;