From 515c45b4c86e8742d562e033e9f22be5a86d8a73 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 12 Sep 2023 20:16:45 -0500 Subject: [PATCH 1/7] Add unused data source automatic freeing --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 13b7a20ff..03f50b168 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 13b7a20ff6ce15630ff963fb84a855e9694f79a2 +Subproject commit 03f50b168def9f16da5678e62bda3a2a80d437ab From 84028f78b867211f3b4d2fdc8320ffb2cf570883 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 13 Sep 2023 18:30:22 -0500 Subject: [PATCH 2/7] Hopefully fix Structure load locking up the world gen threads (again) --- .../wrappers/worldGeneration/step/StepStructureStart.java | 4 ++-- coreSubProjects | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/coreSubProjects b/coreSubProjects index 03f50b168..a5178cece 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 03f50b168def9f16da5678e62bda3a2a80d437ab +Subproject commit a5178ceceac5c9ee426558721a6cc023f5e9b604 From b38a8d5e62a66069c8160f61f794b2dcb5ec77c9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 13 Sep 2023 18:53:23 -0500 Subject: [PATCH 3/7] Add the ability to set Minecraft's memory JVM argument in gradle.properties --- fabric/build.gradle | 2 +- forge/build.gradle | 2 +- gradle.properties | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index 6ee8aa419..c2895fc2a 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -127,7 +127,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" From 06bb4a9cb3ab5d14e436db22045dfe9621aaa2a8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 14 Sep 2023 22:05:05 -0500 Subject: [PATCH 4/7] Refactor and Optimize DhSectionPos --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a5178cece..2cee80564 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a5178ceceac5c9ee426558721a6cc023f5e9b604 +Subproject commit 2cee805645bb8c5a01471f650445f4c4627974ec From e958790f76f3e2fd193df2af2aeb1141f883e809 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 15 Sep 2023 07:05:15 -0500 Subject: [PATCH 5/7] Fix compiling for MC 1.16 - 1.19 --- .../common/wrappers/chunk/ChunkWrapper.java | 67 +++++++++++++------ 1 file changed, 48 insertions(+), 19 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 755877581..72b3c55c7 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 From cbd0521a0ca1898b6ca5682d6dd4c68c8777386e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 15 Sep 2023 07:34:42 -0500 Subject: [PATCH 6/7] Add a mutable DhSectionPos --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 2cee80564..1ae1f1f36 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2cee805645bb8c5a01471f650445f4c4627974ec +Subproject commit 1ae1f1f36fdce79fdfe6b092b537ac1c9f10ff46 From 54fa033e07c298ae833c3a229cc80ad59be9d6d8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Sep 2023 08:03:48 -0500 Subject: [PATCH 7/7] Add GL Context creation debug configs --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 1ae1f1f36..8a0e3a710 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1ae1f1f36fdce79fdfe6b092b537ac1c9f10ff46 +Subproject commit 8a0e3a710cf5da8b2aa0c0b9de020dce3c53a7c4