From 7f658bd310da11bcf5a80909ac33609f9a6aac6f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 19 Aug 2023 11:02:00 -0500 Subject: [PATCH 1/2] Fix lighting and LOD generation for snow layers --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a30bfdf39..4bf12c7fc 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a30bfdf397b2a6cf286cbee8d41d1e7c2902ff78 +Subproject commit 4bf12c7fc4aaca78c8d40fac12871db3818a7caf From 81adca92c02a8dfb29e4d899cf992a3e981a067b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 19 Aug 2023 11:18:49 -0500 Subject: [PATCH 2/2] Add a flag to enable/disable ChunkWrapper Index validation --- .../common/wrappers/chunk/ChunkWrapper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 95ac44e5d..3e10d4272 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java @@ -19,11 +19,9 @@ package com.seibel.distanthorizons.common.wrappers.chunk; -import com.seibel.distanthorizons.api.enums.config.ELightGenerationMode; import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper; import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.DhLitWorldGenRegion; -import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.pos.DhBlockPos; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.util.LodUtil; @@ -59,6 +57,10 @@ import net.minecraft.core.SectionPos; public class ChunkWrapper implements IChunkWrapper { + /** useful for debugging, but can slow down chunk operations quite a bit due to being called every time. */ + private static final boolean RUN_RELATIVE_POS_INDEX_VALIDATION = false; + + private final ChunkAccess chunk; private final DhChunkPos chunkPos; private final LevelReader lightSource; @@ -439,6 +441,9 @@ public class ChunkWrapper implements IChunkWrapper /** used to prevent accidentally attempting to get/set values outside this chunk's boundaries */ private void throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(int x, int y, int z) throws IndexOutOfBoundsException { + if (RUN_RELATIVE_POS_INDEX_VALIDATION) + return; + // FIXME +1 is to handle the fact that LodDataBuilder adds +1 to all block lighting calculations, also done in the constructor int minHeight = this.getMinBuildHeight(); int maxHeight = this.getMaxBuildHeight() + 1;