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 eadd1f31f..4f2d1b8a6 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 @@ -50,6 +50,22 @@ import java.util.concurrent.ConcurrentLinkedQueue; import net.minecraft.core.QuartPos; #endif +#if MC_1_16_5 +import net.minecraft.world.level.chunk.LevelChunkSection; +#endif + +#if MC_1_17_1 +import net.minecraft.world.level.chunk.LevelChunkSection; +#endif + +#if MC_1_18_2 +import net.minecraft.world.level.chunk.LevelChunkSection; +#endif + +#if MC_1_19_2 || MC_1_19_4 +import net.minecraft.world.level.chunk.LevelChunkSection; +#endif + #if POST_MC_1_20_1 import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.lighting.LevelLightEngine; @@ -153,11 +169,25 @@ public class ChunkWrapper implements IChunkWrapper LevelChunkSection[] sections = this.chunk.getSections(); for (int index = 0; index < sections.length; index++) { + #if MC_1_16_5 + if (!sections[index].isEmpty()) + { + // convert from an index to a block coordinate + return this.chunk.getSections()[index].bottomBlockY() * 16; + } + #elif MC_1_17_1 + if (!sections[index].isEmpty()) + { + // convert from an index to a block coordinate + return this.chunk.getSections()[index].bottomBlockY() * 16; + } + #else if (!sections[index].hasOnlyAir()) { // convert from an index to a block coordinate return this.chunk.getSectionYFromSectionIndex(index) * 16; } + #endif } return Integer.MAX_VALUE; } @@ -409,25 +439,6 @@ public class ChunkWrapper implements IChunkWrapper @Override public boolean isStillValid() { return this.wrappedLevel.tryGetChunk(this.chunkPos) == this; } - #if POST_MC_1_20_1 - private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine) - { - LevelChunkSection[] sections = chunk.getSections(); - int minY = chunk.getMinSection(); - int maxY = chunk.getMaxSection(); - for (int y = minY; y < maxY; ++y) - { - LevelChunkSection section = sections[chunk.getSectionIndexFromSectionY(y)]; - if (section.hasOnlyAir()) continue; - if (!engine.lightOnInSection(SectionPos.of(chunk.getPos(), y))) - { - return false; - } - } - return true; - } - #endif - public static void syncedUpdateClientLightStatus() { @@ -462,6 +473,24 @@ public class ChunkWrapper implements IChunkWrapper #endif } } + #if POST_MC_1_20_1 + private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine) + { + LevelChunkSection[] sections = chunk.getSections(); + int minY = chunk.getMinSection(); + int maxY = chunk.getMaxSection(); + for (int y = minY; y < maxY; ++y) + { + LevelChunkSection section = sections[chunk.getSectionIndexFromSectionY(y)]; + if (section.hasOnlyAir()) continue; + if (!engine.lightOnInSection(SectionPos.of(chunk.getPos(), y))) + { + return false; + } + } + return true; + } + #endif diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java index 0cf652f66..2ec69d840 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java @@ -110,8 +110,6 @@ public final class StepStructureStart tParams.structFeat, chunk, environment.params.structures); #endif - structurePlacementLock.unlock(); - #if POST_MC_1_18_2 try { @@ -139,6 +137,8 @@ public final class StepStructureStart //throw new StepStructureStart.StructStartCorruptedException(secondEx); } } + + structurePlacementLock.unlock(); #endif } } diff --git a/fabric/build.gradle b/fabric/build.gradle index 70d8bf627..f23b806a7 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -128,7 +128,7 @@ processResources { runClient { dependsOn(copyCoreResources) dependsOn(copyCommonLoaderResources) - jvmArgs "-XX:-OmitStackTraceInFastThrow" + jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) finalizedBy(deleteResources) } diff --git a/forge/build.gradle b/forge/build.gradle index 4bd1293e4..bc3dc25c3 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -36,7 +36,7 @@ loom { setConfigName("Forge Client") ideConfigGenerated(true) runDir("run") - vmArg("-XX:-OmitStackTraceInFastThrow") + vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) } server { server() diff --git a/gradle.properties b/gradle.properties index 1eb3e376a..134d9a1d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,3 +44,6 @@ versionStr= # This defines what MC version Intellij will use for the preprocessor # and what version is used automatically by build and run commands mcVer=1.20.1 + +# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment +minecraftMemoryJavaArg="-Xmx4G"