diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index a24289202..828d1e5a0 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -54,7 +54,6 @@ import java.util.List; * Otherwise, you will have issues where only some of the config entries will exist when your listener is created. * * @author coolGi - * @version 2023-7-16 */ public class Config @@ -179,6 +178,7 @@ public class Config + "Lowest Quality: " + EDhApiVerticalQuality.HEIGHT_MAP + "\n" + "Highest Quality: " + EDhApiVerticalQuality.EXTREME) .setPerformance(EConfigEntryPerformance.VERY_HIGH) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry horizontalQuality = new ConfigEntry.Builder() @@ -200,6 +200,7 @@ public class Config + EDhApiTransparency.DISABLED + ": LODs will be opaque. \n" + "") .setPerformance(EConfigEntryPerformance.MEDIUM) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry blocksToIgnore = new ConfigEntry.Builder() @@ -211,6 +212,7 @@ public class Config + EDhApiBlocksToAvoid.NON_COLLIDING + ": Only represent solid blocks in the LODs (tall grass, torches, etc. won't count for a LOD's height) \n" + "") .setPerformance(EConfigEntryPerformance.NONE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry tintWithAvoidedBlocks = new ConfigEntry.Builder() @@ -222,6 +224,7 @@ public class Config + "False: skipped blocks will not change color of surface below them. " + "") .setPerformance(EConfigEntryPerformance.NONE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); // TODO fixme @@ -587,6 +590,7 @@ public class Config + "0 = black \n" + "1 = normal \n" + "2 = near white") + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry saturationMultiplier = new ConfigEntry.Builder() // TODO: Make this a float (the ClassicConfigGUI doesnt support floats) @@ -597,6 +601,7 @@ public class Config + "0 = black and white \n" + "1 = normal \n" + "2 = very saturated") + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry enableCaveCulling = new ConfigEntry.Builder() @@ -611,14 +616,15 @@ public class Config + "Additional Info: Currently this cull all faces \n" + " with skylight value of 0 in dimensions that \n" + " does not have a ceiling.") + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); - @Deprecated public static ConfigEntry caveCullingHeight = new ConfigEntry.Builder() - .setMinDefaultMax(-4096, 40, 4096) - .setAppearance(EConfigEntryAppearance.ONLY_IN_API) + .setMinDefaultMax(-4096, 60, 4096) .comment("" - + "At what Y value should cave culling start?") + + "At what Y value should cave culling start? \n" + + "Lower this value if you get walls for areas with 0 light.") + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry earthCurveRatio = new ConfigEntry.Builder() @@ -656,6 +662,7 @@ public class Config + EDhApiLodShading.DISABLED + ": All LOD sides will be rendered with the same brightness. \n" + "") .setPerformance(EConfigEntryPerformance.NONE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry disableFrustumCulling = new ConfigEntry.Builder() @@ -690,6 +697,7 @@ public class Config + EDhApiGrassSideRendering.AS_DIRT + ": sides render entirely as dirt. \n" + "") .setPerformance(EConfigEntryPerformance.NONE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); } @@ -1303,38 +1311,38 @@ public class Config public static ConfigEntry columnBuilderDebugEnable = new ConfigEntry.Builder() .set(false) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugDetailLevel = new ConfigEntry.Builder() .set((int) DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugXPos = new ConfigEntry.Builder() .set(0) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugZPos = new ConfigEntry.Builder() .set(0) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugXRow = new ConfigEntry.Builder() .set(-1) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugZRow = new ConfigEntry.Builder() .set(-1) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); public static ConfigEntry columnBuilderDebugColumnIndex = new ConfigEntry.Builder() .set(-1) .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .addListener(DebugColumnConfigEventHandler.INSTANCE) + .addListener(ReloadLodsConfigEventHandler.INSTANCE) .build(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/DebugColumnConfigEventHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/ReloadLodsConfigEventHandler.java similarity index 88% rename from core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/DebugColumnConfigEventHandler.java rename to core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/ReloadLodsConfigEventHandler.java index 93f55820d..9248280e5 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/DebugColumnConfigEventHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/ReloadLodsConfigEventHandler.java @@ -23,9 +23,9 @@ import com.seibel.distanthorizons.api.DhApi; import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderProxy; import com.seibel.distanthorizons.core.config.listeners.IConfigListener; -public class DebugColumnConfigEventHandler implements IConfigListener +public class ReloadLodsConfigEventHandler implements IConfigListener { - public static DebugColumnConfigEventHandler INSTANCE = new DebugColumnConfigEventHandler(); + public static ReloadLodsConfigEventHandler INSTANCE = new ReloadLodsConfigEventHandler(); @Override public void onConfigValueSet() diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java index 2ac1d4a0b..3cf9194e5 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java @@ -178,6 +178,7 @@ public class FullDataToRenderDataTransformer HashSet blockStatesToIgnore = WRAPPER_FACTORY.getRendererIgnoredBlocks(level.getLevelWrapper()); HashSet caveBlockStatesToIgnore = WRAPPER_FACTORY.getRendererIgnoredCaveBlocks(level.getLevelWrapper()); + int caveCullingMaxY = Config.Client.Advanced.Graphics.AdvancedGraphics.caveCullingHeight.get() - level.getMinY(); boolean caveCullingEnabled = Config.Client.Advanced.Graphics.AdvancedGraphics.enableCaveCulling.get() && ( @@ -211,6 +212,7 @@ public class FullDataToRenderDataTransformer int bottomY = FullDataPointUtil.getBottomY(fullData); int blockHeight = FullDataPointUtil.getHeight(fullData); + int topY = bottomY + blockHeight; int id = FullDataPointUtil.getId(fullData); int blockLight = FullDataPointUtil.getBlockLight(fullData); int skyLight = FullDataPointUtil.getSkyLight(fullData); @@ -252,7 +254,9 @@ public class FullDataToRenderDataTransformer { if (caveCullingEnabled // assume this data point is underground if it has no sky-light - && skyLight == LodUtil.MIN_MC_LIGHT + && skyLight == LodUtil.MIN_MC_LIGHT + // ignore caves above a certain height to prevent floating islands from having walls underneath them + && topY < caveCullingMaxY // cave culling shouldn't happen when at the top of the world && columnOffset != 0 // cave culling can't happen when at the bottom of the world