From 3c76ed71d887d7e557a4d8ba9262271bae325ff8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 11:35:16 -0500 Subject: [PATCH 01/22] Fix some lib shading issues --- build.gradle | 27 ++++++++++++++++++++------- coreSubProjects | 2 +- gradle.properties | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index ea46a49c7..c6b03379c 100644 --- a/build.gradle +++ b/build.gradle @@ -181,6 +181,8 @@ subprojects { p -> // Log4j // TODO: Change to shadowMe later to work in the standalone jar + // Note: this cannot be relocated if another log4j library is loaded in the JVM due to class casting issues + // We might need to look into creating our own logging interface // We cannot do this now as it would break Quilt implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") @@ -209,7 +211,6 @@ subprojects { p -> forgeShadowMe("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd forgeShadowMe("org.tukaani:xz:${rootProject.xz_version}") // LZMA - // Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it @@ -274,17 +275,29 @@ subprojects { p -> } def librariesLocation = "distanthorizons.libraries" - // SVG (not needed atm) -// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg" + // LWJGL + // Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client + relocate "org.lwjgl.system.jawt", "${librariesLocation}.lwjgl.system.jawt" - // Compression (LZ4) - relocate "net.jpountz", "${librariesLocation}.jpountz" - relocate "com.github.luben", "${librariesLocation}.github.luben" - relocate "org.tukaani", "${librariesLocation}.tukaani" + // Compression + relocate "net.jpountz", "${librariesLocation}.jpountz" // LZ4 + relocate "com.github.luben", "${librariesLocation}.github.luben" // ZStd + relocate "org.tukaani", "${librariesLocation}.tukaani" // XZ / LZMA // night config relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" + // JOML + if (project.hasProperty("embed_joml") && embed_joml == "true") + relocate "org.joml", "${librariesLocation}.joml" + + // FastUtil + relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil" + + // Log4j + // can't be relocated due to reflection done on Log4j's side + //relocate "org.apache.logging", "${librariesLocation}.apache.logging" + mergeServiceFiles() } // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass diff --git a/coreSubProjects b/coreSubProjects index 2298ef0e0..23e857a20 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2298ef0e0d1d48237fd4a4b9eee95056c2f34e4b +Subproject commit 23e857a20df78a816eeae88abc8db4058361e309 diff --git a/gradle.properties b/gradle.properties index de309504e..bdf89dafb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,7 +28,7 @@ fastutil_version=8.5.13 #svgSalamander_version=1.1.3 # Minecraft related libaries (included in MC's jar) -log4j_version=2.20.0 +log4j_version=2.23.1 netty_version=4.1.94.Final lwjgl_version=3.3.1 joml_version=1.10.2 From b7f6f3b900b9db084055ef69ca4c5703ece30463 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 11:55:27 -0500 Subject: [PATCH 02/22] Remove (hopefully) unused MixinThreadingDetector --- .../server/unsafe/MixinThreadingDetector.java | 60 ------------------- .../DistantHorizons.fabric.mixins.json | 1 - .../server/unsafe/MixinThreadingDetector.java | 59 ------------------ .../DistantHorizons.forge.mixins.json | 1 - .../server/unsafe/MixinThreadingDetector.java | 59 ------------------ .../DistantHorizons.neoforge.mixins.json | 1 - 6 files changed, 181 deletions(-) delete mode 100644 fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java delete mode 100644 forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java delete mode 100644 neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java deleted file mode 100644 index 24641322f..000000000 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.fabric.mixins.server.unsafe; - -import org.spongepowered.asm.mixin.Mixin; - -//FIXME: Is this still needed? -#if MC_VER >= MC_1_18_2 - -import net.minecraft.util.ThreadingDetector; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.concurrent.Semaphore; - -/** - * Why does this exist? But okay! (Will be probably removed when the experimental generator is done) - * FIXME: Recheck this - */ -@Mixin(ThreadingDetector.class) -public class MixinThreadingDetector -{ - @Mutable - @Shadow - private Semaphore lock; - - @Inject(method = "", at = @At("RETURN")) - private void setSemaphore(CallbackInfo ci) - { - this.lock = new Semaphore(2); - } - -} -#else - -import net.minecraft.server.level.ServerLevel; - -@Mixin(ServerLevel.class) -public class MixinThreadingDetector { } //FIXME: Is there some way to make this file just not be added? -#endif diff --git a/fabric/src/main/resources/DistantHorizons.fabric.mixins.json b/fabric/src/main/resources/DistantHorizons.fabric.mixins.json index ffde1f7c4..90f0add34 100644 --- a/fabric/src/main/resources/DistantHorizons.fabric.mixins.json +++ b/fabric/src/main/resources/DistantHorizons.fabric.mixins.json @@ -3,7 +3,6 @@ "minVersion": "0.8", "package": "com.seibel.distanthorizons.fabric.mixins", "mixins": [ - "server.unsafe.MixinThreadingDetector", "server.MixinChunkGenerator", "server.MixinChunkMap", "server.MixinUtilBackgroundThread" diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java deleted file mode 100644 index 2cb73c02c..000000000 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.forge.mixins.server.unsafe; - -import org.spongepowered.asm.mixin.Mixin; -#if MC_VER >= MC_1_18_2 - -import net.minecraft.util.ThreadingDetector; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.concurrent.Semaphore; - -/** - * Why does this exist? But okay! (Will be probably removed when the experimental generator is done) - * FIXME: Recheck this // STILL check this - */ -@Mixin(ThreadingDetector.class) -public class MixinThreadingDetector -{ - @Mutable - @Shadow - private Semaphore lock; - - @Inject(method = "", at = @At("RETURN")) - private void setSemaphore(CallbackInfo ci) - { - this.lock = new Semaphore(2); - } - -} - -#else - -import net.minecraft.world.level.chunk.ChunkGenerator; - -@Mixin(ChunkGenerator.class) -public class MixinThreadingDetector { } -#endif \ No newline at end of file diff --git a/forge/src/main/resources/DistantHorizons.forge.mixins.json b/forge/src/main/resources/DistantHorizons.forge.mixins.json index c7326a9e4..e0f4d1feb 100644 --- a/forge/src/main/resources/DistantHorizons.forge.mixins.json +++ b/forge/src/main/resources/DistantHorizons.forge.mixins.json @@ -3,7 +3,6 @@ "minVersion": "0.8", "package": "com.seibel.distanthorizons.forge.mixins", "mixins": [ - "server.unsafe.MixinThreadingDetector", "server.MixinUtilBackgroundThread", "server.MixinChunkGenerator", "server.MixinTFChunkGenerator" diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java deleted file mode 100644 index d65854393..000000000 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.neoforge.mixins.server.unsafe; - -import org.spongepowered.asm.mixin.Mixin; -#if MC_VER >= MC_1_18_2 - -import net.minecraft.util.ThreadingDetector; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.concurrent.Semaphore; - -/** - * Why does this exist? But okay! (Will be probably removed when the experimental generator is done) - * FIXME: Recheck this // STILL check this - */ -@Mixin(ThreadingDetector.class) -public class MixinThreadingDetector -{ - @Mutable - @Shadow - private Semaphore lock; - - @Inject(method = "", at = @At("RETURN")) - private void setSemaphore(CallbackInfo ci) - { - this.lock = new Semaphore(2); - } - -} - -#else - -import net.minecraft.world.level.chunk.ChunkGenerator; - -@Mixin(ChunkGenerator.class) -public class MixinThreadingDetector { } -#endif \ No newline at end of file diff --git a/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json index cb6ae0a35..296dc1e4d 100644 --- a/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json +++ b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json @@ -3,7 +3,6 @@ "minVersion": "0.8", "package": "com.seibel.distanthorizons.neoforge.mixins", "mixins": [ - "server.unsafe.MixinThreadingDetector", "server.MixinUtilBackgroundThread", "server.MixinChunkGenerator", "server.MixinTFChunkGenerator" From fe014b4985e776a2ae13cd30e491cb25ca7d25ff Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 12:56:20 -0500 Subject: [PATCH 03/22] revert b1c6a5c1 --- build.gradle | 53 +++++++++++++++++++++++++++++-------------------- coreSubProjects | 2 +- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index c6b03379c..e61e184e4 100644 --- a/build.gradle +++ b/build.gradle @@ -181,8 +181,6 @@ subprojects { p -> // Log4j // TODO: Change to shadowMe later to work in the standalone jar - // Note: this cannot be relocated if another log4j library is loaded in the JVM due to class casting issues - // We might need to look into creating our own logging interface // We cannot do this now as it would break Quilt implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") @@ -198,19 +196,28 @@ subprojects { p -> implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") - - - // NightConfig (includes Toml & Json) - // needs to be here and in core to prevent runtime/compiler errors - forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") - forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}") - // Compression - // needs to be here and in core to prevent runtime/compiler errors forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 forgeShadowMe("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd forgeShadowMe("org.tukaani:xz:${rootProject.xz_version}") // LZMA + + // Sqlite Database + forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") + // NightConfig (includes Toml & Json) + forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") + forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}") + + // Fastutil + forgeShadowMe("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") + + // SVG (not needed atm) +// forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") + + // Netty + // Breaks 1.16.5 + //forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}") + // Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it @@ -279,13 +286,12 @@ subprojects { p -> // Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client relocate "org.lwjgl.system.jawt", "${librariesLocation}.lwjgl.system.jawt" - // Compression - relocate "net.jpountz", "${librariesLocation}.jpountz" // LZ4 - relocate "com.github.luben", "${librariesLocation}.github.luben" // ZStd - relocate "org.tukaani", "${librariesLocation}.tukaani" // XZ / LZMA - - // night config - relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" + // Compression (LZ4) + relocate "net.jpountz", "${librariesLocation}.jpountz" + + // Sqlite Database + //At the moment, there is a bug in this library which doesnt allow it to be relocated +// relocate "org.sqlite", "${librariesLocation}.sqlite" // JOML if (project.hasProperty("embed_joml") && embed_joml == "true") @@ -293,11 +299,16 @@ subprojects { p -> // FastUtil relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil" + + // NightConfig (includes Toml & Json) + relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" + + // SVG (not needed atm) +// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg" - // Log4j - // can't be relocated due to reflection done on Log4j's side - //relocate "org.apache.logging", "${librariesLocation}.apache.logging" - + // Netty + relocate "io.netty", "${librariesLocation}.netty" + mergeServiceFiles() } // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass diff --git a/coreSubProjects b/coreSubProjects index 23e857a20..7f874b4dc 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 23e857a20df78a816eeae88abc8db4058361e309 +Subproject commit 7f874b4dc53c05cdcc109096454ba81089c94391 From 348ac2b73411d2484b086cbbf1c5dc6103c5a857 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 13:20:18 -0500 Subject: [PATCH 04/22] Closes #638 (optifine not rendering on 1.16 + 1.17) --- .../com/seibel/distanthorizons/forge/ForgeClientProxy.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java index 231368363..e97d9b9f5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -328,9 +328,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy #elif MC_VER >= MC_1_18_2 if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS) #else - // FIXME: Is this the correct location for 1.16 & 1.17??? - // I couldnt find anything for rendering after the level, so is rendering after overlays ok? - if (event.type.equals(TickEvent.RenderTickEvent.Type.WORLD)) + if (event.type.equals(TickEvent.RenderTickEvent.Type.RENDER)) #endif { try From 08d3da47f4c46c164c997ddeb2648a167bae5722 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 16:46:22 -0500 Subject: [PATCH 05/22] Fix fastutil relocation issues with world gen --- build.gradle | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build.gradle b/build.gradle index e61e184e4..9c7ff04ba 100644 --- a/build.gradle +++ b/build.gradle @@ -208,9 +208,6 @@ subprojects { p -> forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}") - // Fastutil - forgeShadowMe("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") - // SVG (not needed atm) // forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") @@ -297,9 +294,6 @@ subprojects { p -> if (project.hasProperty("embed_joml") && embed_joml == "true") relocate "org.joml", "${librariesLocation}.joml" - // FastUtil - relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil" - // NightConfig (includes Toml & Json) relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" From 019ac6dec30bd425a2e5bd69c274159c04f89a24 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 28 Apr 2024 15:52:11 -0500 Subject: [PATCH 06/22] Add corrupt data read handling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 7f874b4dc..3b600ce80 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7f874b4dc53c05cdcc109096454ba81089c94391 +Subproject commit 3b600ce800de5eb2a26cad98bb8ba5c9cd62871b From ffa1c54ff3ef4f5f223d25348dd094a719e1a92b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 28 Apr 2024 16:08:08 -0500 Subject: [PATCH 07/22] Fix warning about BiomeWrapper null level on startup --- .../common/wrappers/block/BiomeWrapper.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index 366087528..b403e834c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java @@ -32,8 +32,6 @@ import org.apache.logging.log4j.Logger; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; -import net.minecraft.client.Minecraft; - #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 import net.minecraft.core.Registry; #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 @@ -66,7 +64,7 @@ public class BiomeWrapper implements IBiomeWrapper public static final ConcurrentMap, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #endif - public static final String EMPTY_STRING = "EMPTY"; + public static final String EMPTY_BIOME_STRING = "EMPTY"; public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); /** keep track of broken biomes so we don't log every time */ @@ -131,7 +129,7 @@ public class BiomeWrapper implements IBiomeWrapper private BiomeWrapper() { this.biome = null; - this.serialString = EMPTY_STRING; + this.serialString = EMPTY_BIOME_STRING; this.hashCode = Objects.hash(this.serialString); } @@ -146,7 +144,7 @@ public class BiomeWrapper implements IBiomeWrapper { if (this == EMPTY_WRAPPER) { - return EMPTY_STRING; + return EMPTY_BIOME_STRING; } #if MC_VER < MC_1_18_2 @@ -193,22 +191,23 @@ public class BiomeWrapper implements IBiomeWrapper public String serialize(ILevelWrapper levelWrapper) { - if (this.serialString != null) + if (this.biome == null) { - return this.serialString; + return EMPTY_BIOME_STRING; } + // we can't generate a serial string if the level is null if (levelWrapper == null) { if (!emptyLevelSerializeFailLogged) { emptyLevelSerializeFailLogged = true; - LOGGER.warn("Unable to serialize biome: ["+this.biome+"] because the passed in level wrapper is null. Future errors won't be logged."); + LOGGER.warn("Unable to serialize biome: [" + this.biome + "] because the passed in level wrapper is null. Future errors of this type won't be logged."); } - return EMPTY_STRING; + return EMPTY_BIOME_STRING; } @@ -250,12 +249,12 @@ public class BiomeWrapper implements IBiomeWrapper public static IBiomeWrapper deserialize(String resourceLocationString, ILevelWrapper levelWrapper) throws IOException { - if (resourceLocationString.equals(EMPTY_STRING)) + if (resourceLocationString.equals(EMPTY_BIOME_STRING)) { if (!emptyStringWarningLogged) { emptyStringWarningLogged = true; - LOGGER.warn("[" + EMPTY_STRING + "] biome string deserialized. This may mean the level was null when a save was attempted, a file saving error, or a biome saving error. Future errors will not be logged."); + LOGGER.warn("[" + EMPTY_BIOME_STRING + "] biome string deserialized. This may mean the level was null when a save was attempted, a file saving error, or a biome saving error. Future errors will not be logged."); } return EMPTY_WRAPPER; } From d433fdea623ff407dcd7ec1f0be0936c1f4d93f3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 28 Apr 2024 17:35:10 -0500 Subject: [PATCH 08/22] Fix white grass/water if the biome is null --- .../common/wrappers/block/BiomeWrapper.java | 2 + .../block/TintWithoutLevelOverrider.java | 72 +++++++++++++++---- .../block/cache/ClientBlockStateCache.java | 14 ++-- .../wrappers/world/ClientLevelWrapper.java | 21 ++++++ coreSubProjects | 2 +- 5 files changed, 93 insertions(+), 18 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index b403e834c..9b8f889f6 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java @@ -67,6 +67,8 @@ public class BiomeWrapper implements IBiomeWrapper public static final String EMPTY_BIOME_STRING = "EMPTY"; public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); + public static final String PLAINS_RESOURCE_LOCATION_STRING = "minecraft:plains"; + /** keep track of broken biomes so we don't log every time */ private static final HashSet brokenResourceLocationStrings = new HashSet<>(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java index 6f425019e..4c27070fc 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java @@ -19,14 +19,20 @@ package com.seibel.distanthorizons.common.wrappers.block; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.util.ColorUtil; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.*; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; #if MC_VER >= MC_1_18_2 @@ -35,18 +41,54 @@ import net.minecraft.core.Holder; public class TintWithoutLevelOverrider implements BlockAndTintGetter { - final BiomeWrapper biome; + /** + * This will only ever be null if there was an issue with {@link IClientLevelWrapper#getPlainsBiomeWrapper()} + * but {@link Nullable} is there just in case. + */ + @Nullable + private final Biome biome; - public TintWithoutLevelOverrider(BiomeWrapper biome) + + + public TintWithoutLevelOverrider(BiomeWrapper biomeWrapper, IClientLevelWrapper clientLevelWrapper) { - this.biome = biome; + // try to get the wrapped biome + Biome unwrappedBiome = null; + if (biomeWrapper.biome != null) + { + unwrappedBiome = unwrap(biomeWrapper.biome); + } + + if(unwrappedBiome == null) + { + // we are looking at the empty biome wrapper, try using plains as a backup + BiomeWrapper plainsBiomeWrapper = ((BiomeWrapper) clientLevelWrapper.getPlainsBiomeWrapper()); + if (plainsBiomeWrapper != null) + { + unwrappedBiome = unwrap(plainsBiomeWrapper.biome); + } + } + + this.biome = unwrappedBiome; } + + + @Override - public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) - { - return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); + public int getBlockTint(@NotNull BlockPos blockPos, @NotNull ColorResolver colorResolver) + { + if (this.biome != null) + { + return colorResolver.getColor(this.biome, blockPos.getX(), blockPos.getZ()); + } + else + { + // hopefully unneeded debug color + return ColorUtil.CYAN; + } } - private Biome _unwrap(#if MC_VER >= MC_1_18_2 Holder #else Biome #endif biome) + + private static Biome unwrap(#if MC_VER >= MC_1_18_2 Holder #else Biome #endif biome) { #if MC_VER >= MC_1_18_2 return biome.value(); @@ -55,30 +97,36 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter #endif } + + + //================// + // unused methods // + //================// + @Override - public float getShade(Direction direction, boolean shade) + public float getShade(@NotNull Direction direction, boolean shade) { throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only."); } @Override - public LevelLightEngine getLightEngine() + public @NotNull LevelLightEngine getLightEngine() { throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only."); } @Nullable @Override - public BlockEntity getBlockEntity(BlockPos pos) + public BlockEntity getBlockEntity(@NotNull BlockPos pos) { throw new UnsupportedOperationException("ERROR: getBlockEntity() called on TintWithoutLevelOverrider. Object is for tinting only."); } @Override - public BlockState getBlockState(BlockPos pos) + public @NotNull BlockState getBlockState(@NotNull BlockPos pos) { throw new UnsupportedOperationException("ERROR: getBlockState() called on TintWithoutLevelOverrider. Object is for tinting only."); } @Override - public FluidState getFluidState(BlockPos pos) + public @NotNull FluidState getFluidState(@NotNull BlockPos pos) { throw new UnsupportedOperationException("ERROR: getFluidState() called on TintWithoutLevelOverrider. Object is for tinting only."); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java index 01b89f04f..52b81458c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java @@ -54,7 +54,6 @@ import java.util.List; */ public class ClientBlockStateCache { - private static final Logger LOGGER = DhLoggerBuilder.getLogger(); private static final HashSet BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); @@ -66,15 +65,20 @@ public class ClientBlockStateCache public static final RandomSource random = RandomSource.create(); #endif + public final IClientLevelWrapper levelWrapper; public final BlockState blockState; public final LevelReader level; public final BlockPos pos; + + + public ClientBlockStateCache(BlockState blockState, IClientLevelWrapper samplingLevel, DhBlockPos samplingPos) { this.blockState = blockState; - level = (LevelReader) samplingLevel.getWrappedMcObject(); - pos = McObjectConverter.Convert(samplingPos); - resolveColors(); + this.levelWrapper = samplingLevel; + this.level = (LevelReader) samplingLevel.getWrappedMcObject(); + this.pos = McObjectConverter.Convert(samplingPos); + this.resolveColors(); //LOGGER.info("ClientBlocKCache created for {}", blockState); } @@ -363,7 +367,7 @@ public class ClientBlockStateCache try { tintColor = Minecraft.getInstance().getBlockColors() - .getColor(this.blockState, new TintWithoutLevelOverrider(biome), McObjectConverter.Convert(pos), this.tintIndex); + .getColor(this.blockState, new TintWithoutLevelOverrider(biome, this.levelWrapper), McObjectConverter.Convert(pos), this.tintIndex); } catch (UnsupportedOperationException e) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java index b51737876..3bfe90a38 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java @@ -43,6 +43,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this); private BlockStateWrapper dirtBlockWrapper; + private BiomeWrapper plainsBiomeWrapper; @@ -139,6 +140,26 @@ public class ClientLevelWrapper implements IClientLevelWrapper return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO); } + @Override + public IBiomeWrapper getPlainsBiomeWrapper() + { + if (this.plainsBiomeWrapper == null) + { + try + { + this.plainsBiomeWrapper = (BiomeWrapper) BiomeWrapper.deserialize(BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING, this); + } + catch (IOException e) + { + // shouldn't happen, but just in case + LOGGER.warn("Unable to get planes biome with resource location ["+BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING+"] with level ["+this+"].", e); + return null; + } + } + + return this.plainsBiomeWrapper; + } + @Override public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); } diff --git a/coreSubProjects b/coreSubProjects index 3b600ce80..c83140a2d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 3b600ce800de5eb2a26cad98bb8ba5c9cd62871b +Subproject commit c83140a2d002022f938e5521a495764c0e435b56 From 54d254be73871178404966d60cf12ab452832110 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 19:44:23 -0500 Subject: [PATCH 09/22] Fix optifine 1.16 support --- .../minecraft/MinecraftRenderWrapper.java | 10 +-- coreSubProjects | 2 +- .../mixins/client/MixinDynamicTexture.java | 69 ----------------- .../mixins/client/MixinLightTexture.java | 26 +++++-- .../DistantHorizons.fabric.mixins.json | 1 - .../mixins/client/MixinDynamicTexture.java | 74 ------------------ .../mixins/client/MixinLightTexture.java | 28 +++++-- .../DistantHorizons.forge.mixins.json | 1 - .../mixins/client/MixinDynamicTexture.java | 75 ------------------- .../mixins/client/MixinLightTexture.java | 27 +++++-- .../DistantHorizons.neoforge.mixins.json | 1 - 11 files changed, 64 insertions(+), 250 deletions(-) delete mode 100644 fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinDynamicTexture.java delete mode 100644 forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java delete mode 100644 neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java index b1a2a0604..a4651ae75 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -25,6 +25,7 @@ import java.nio.FloatBuffer; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import com.mojang.blaze3d.pipeline.RenderTarget; @@ -105,7 +106,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper * In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps.
* Requiring the use of multiple {@link LightMapWrapper}. */ - public HashMap lightmapByDimensionType = new HashMap<>(); + public ConcurrentHashMap lightmapByDimensionType = new ConcurrentHashMap<>(); /** * Holds the render buffer that should be used when displaying levels to the screen. @@ -405,11 +406,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper // so this will have to do for now IDimensionTypeWrapper dimensionType = level.getDimensionType(); - if (!this.lightmapByDimensionType.containsKey(dimensionType)) - { - this.lightmapByDimensionType.put(dimensionType, new LightMapWrapper()); - } - this.lightmapByDimensionType.get(dimensionType).uploadLightmap(lightPixels); + LightMapWrapper wrapper = this.lightmapByDimensionType.compute(dimensionType, (dimType, oldWrapper) -> new LightMapWrapper()); + wrapper.uploadLightmap(lightPixels); } } diff --git a/coreSubProjects b/coreSubProjects index c83140a2d..8ecd5dd9c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c83140a2d002022f938e5521a495764c0e435b56 +Subproject commit 8ecd5dd9cbf57f0e8ba7cbaa75289d5270176027 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinDynamicTexture.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinDynamicTexture.java deleted file mode 100644 index 881da29c2..000000000 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinDynamicTexture.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.fabric.mixins.client; - - -import com.mojang.blaze3d.platform.NativeImage; -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; -import net.minecraft.client.renderer.texture.DynamicTexture; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(DynamicTexture.class) -public class MixinDynamicTexture implements ILightTextureMarker -{ - /** Used to prevent accidentally using other dynamic textures as a lightmap */ - @Unique - private boolean isLightTexture = false; - - @Shadow - @Final - private NativeImage pixels; - - @Inject(method = "upload()V", at = @At("HEAD")) - public void updateLightTexture(CallbackInfo ci) - { - // since the light map is always updated on the client render thread we should be able to access the client level at the same time - IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); - if (!this.isLightTexture - || mc == null - || mc.getWrappedClientLevel() == null - ) - { - return; - } - - //ApiShared.LOGGER.info("Lightmap update"); - IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); - MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel); - } - - public void markLightTexture() { this.isLightTexture = true; } - -} diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLightTexture.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLightTexture.java index db9c56535..f09edc1f5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLightTexture.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLightTexture.java @@ -20,9 +20,14 @@ package com.seibel.distanthorizons.fabric.mixins.client; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; +import com.mojang.blaze3d.platform.NativeImage; + +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.texture.DynamicTexture; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -35,13 +40,20 @@ public class MixinLightTexture { @Shadow @Final - private DynamicTexture lightTexture; + private NativeImage lightPixels; - @Inject(method = "", at = @At("RETURN")) - public void markLightTexture(CallbackInfo ci) + + @Inject(method = "updateLightTexture(F)V", at = @At("RETURN")) + public void updateLightTexture(float partialTicks, CallbackInfo ci) { - // - ((ILightTextureMarker) this.lightTexture).markLightTexture(); + IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + if (mc == null || mc.getWrappedClientLevel() == null) + { + return; + } + + IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); + MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel); } } diff --git a/fabric/src/main/resources/DistantHorizons.fabric.mixins.json b/fabric/src/main/resources/DistantHorizons.fabric.mixins.json index 90f0add34..38fab22fe 100644 --- a/fabric/src/main/resources/DistantHorizons.fabric.mixins.json +++ b/fabric/src/main/resources/DistantHorizons.fabric.mixins.json @@ -14,7 +14,6 @@ "client.MixinFogRenderer", "client.MixinGameRenderer", "client.MixinLevelRenderer", - "client.MixinDynamicTexture", "client.MixinLightTexture", "client.MixinOptionsScreen", "client.MixinMinecraft", diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java deleted file mode 100644 index 36bf97035..000000000 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.forge.mixins.client; - - -import com.mojang.blaze3d.platform.NativeImage; - -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; - -import net.minecraft.client.renderer.texture.DynamicTexture; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import org.jetbrains.annotations.Nullable; - -@Mixin(DynamicTexture.class) -public abstract class MixinDynamicTexture implements ILightTextureMarker -{ - /** Used to prevent accidentally using other dynamic textures as a lightmap */ - @Unique - private boolean isLightTexture = false; - - @Shadow - @Final - private NativeImage pixels; - - @Inject(method = "upload()V", at = @At("HEAD")) - public void updateLightTexture(CallbackInfo ci) - { - // since the light map is always updated on the client render thread we should be able to access the client level at the same time - IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); - if (!this.isLightTexture - || mc == null - || mc.getWrappedClientLevel() == null - ) - { - return; - } - - //ApiShared.LOGGER.info("Lightmap update"); - IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); - MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel); - } - - public void markLightTexture() { this.isLightTexture = true; } - -} diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java index f350a1754..215f7f7d3 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java @@ -20,10 +20,13 @@ package com.seibel.distanthorizons.forge.mixins.client; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; +import com.mojang.blaze3d.platform.NativeImage; +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.texture.DynamicTexture; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -35,11 +38,22 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LightTexture.class) public class MixinLightTexture { - @Shadow - @Final - private DynamicTexture lightTexture; + @Shadow + @Final + private NativeImage lightPixels; - @Inject(method = "", at = @At("RETURN")) - public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); } + + @Inject(method = "updateLightTexture(F)V", at = @At("RETURN")) + public void updateLightTexture(float partialTicks, CallbackInfo ci) + { + IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + if (mc == null || mc.getWrappedClientLevel() == null) + { + return; + } + + IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); + MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel); + } } diff --git a/forge/src/main/resources/DistantHorizons.forge.mixins.json b/forge/src/main/resources/DistantHorizons.forge.mixins.json index e0f4d1feb..c7b69cbaf 100644 --- a/forge/src/main/resources/DistantHorizons.forge.mixins.json +++ b/forge/src/main/resources/DistantHorizons.forge.mixins.json @@ -13,7 +13,6 @@ "client.MixinFogRenderer", "client.MixinGameRenderer", "client.MixinLevelRenderer", - "client.MixinDynamicTexture", "client.MixinLightTexture", "client.MixinOptionsScreen", "client.MixinTextureUtil" diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java deleted file mode 100644 index 7151fe912..000000000 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2023 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.neoforge.mixins.client; - - -import com.mojang.blaze3d.platform.NativeImage; - -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; - -import net.minecraft.client.renderer.texture.DynamicTexture; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(DynamicTexture.class) -public abstract class MixinDynamicTexture implements ILightTextureMarker -{ - /** Used to prevent accidentally using other dynamic textures as a lightmap */ - @Unique - private boolean isLightTexture = false; - - @Shadow - #if MC_VER >= MC_1_20_4 - (remap = false) - #endif - @Final - private NativeImage pixels; - - @Inject(method = "upload()V", at = @At("HEAD")) - public void updateLightTexture(CallbackInfo ci) - { - // since the light map is always updated on the client render thread we should be able to access the client level at the same time - IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); - if (!this.isLightTexture - || mc == null - || mc.getWrappedClientLevel() == null - ) - { - return; - } - - //ApiShared.LOGGER.info("Lightmap update"); - IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); - MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel); - } - - public void markLightTexture() { this.isLightTexture = true; } - -} diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java index 0d59818d2..5ae06aec8 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java @@ -20,10 +20,13 @@ package com.seibel.distanthorizons.neoforge.mixins.client; -import com.seibel.distanthorizons.common.util.ILightTextureMarker; +import com.mojang.blaze3d.platform.NativeImage; +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.texture.DynamicTexture; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -36,13 +39,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class MixinLightTexture { @Shadow - #if MC_VER >= MC_1_20_4 - (remap = false) - #endif @Final - private DynamicTexture lightTexture; + private NativeImage lightPixels; - @Inject(method = "", at = @At("RETURN")) - public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); } + + @Inject(method = "updateLightTexture(F)V", at = @At("RETURN")) + public void updateLightTexture(float partialTicks, CallbackInfo ci) + { + IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + if (mc == null || mc.getWrappedClientLevel() == null) + { + return; + } + + IClientLevelWrapper clientLevel = mc.getWrappedClientLevel(); + MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel); + } } diff --git a/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json index 296dc1e4d..5efe0dba6 100644 --- a/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json +++ b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json @@ -13,7 +13,6 @@ "client.MixinFogRenderer", "client.MixinGameRenderer", "client.MixinLevelRenderer", - "client.MixinDynamicTexture", "client.MixinLightTexture", "client.MixinOptionsScreen", "client.MixinTextureUtil" From d939cbeb96a20421037254a50ae879d50ea10305 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 19:44:44 -0500 Subject: [PATCH 10/22] remove unused MixinWorldupgrader files --- .../mixins/client/MixinWorldUpgrader.java | 156 ------------------ .../mixins/client/MixinWorldUpgrader.java | 126 -------------- 2 files changed, 282 deletions(-) delete mode 100644 forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java delete mode 100644 neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java deleted file mode 100644 index 9e2f76cda..000000000 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.seibel.distanthorizons.forge.mixins.client; - -import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType; -import com.seibel.distanthorizons.api.interfaces.world.IDhApiDimensionTypeWrapper; -import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper; -import com.seibel.distanthorizons.common.wrappers.world.DimensionTypeWrapper; -import com.seibel.distanthorizons.core.file.structure.LocalSaveStructure; -import com.seibel.distanthorizons.core.level.DhServerLevel; -import com.seibel.distanthorizons.core.pos.DhBlockPos; -import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper; -import net.minecraft.resources.ResourceKey; -import net.minecraft.util.worldupdate.WorldUpgrader; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.WorldGenSettings; -import net.minecraft.world.level.storage.DimensionDataStorage; -import net.minecraft.world.level.storage.LevelStorageSource; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import java.io.File; -import java.nio.file.Path; - -#if FALSE -@Mixin(WorldUpgrader.class) -public class MixinWorldUpgrader { - static class FakeLevelWrapper implements IServerLevelWrapper { - private Path saveFolder; - private LevelStem stem; - private DimensionType dimension; - private DimensionTypeWrapper dimensionTypeWrapper; - - public FakeLevelWrapper(LevelStorageSource.LevelStorageAccess storage, WorldGenSettings gen, ResourceKey dim) { - saveFolder = storage.getDimensionPath(dim); - stem = gen.dimensions().getOrThrow(WorldGenSettings.levelToLevelStem(dim)); - dimension = stem.typeHolder().value(); - dimensionTypeWrapper = DimensionTypeWrapper.getDimensionTypeWrapper(dimension); - } - - @Override - public EDhApiLevelType getLevelType() { - return EDhApiLevelType.SERVER_LEVEL; - } - - @Override - public IDhApiDimensionTypeWrapper getDimensionType() { - return dimensionTypeWrapper; - } - - @Override - public int getBlockLight(int x, int y, int z) { - return 0; - } - - @Override - public int getSkyLight(int x, int y, int z) { - return 0; - } - - @Override - public boolean hasCeiling() { - return dimension.hasCeiling(); - } - - @Override - public boolean hasSkyLight() { - return dimension.hasSkyLight(); - } - - @Override - public int getHeight() { - return dimension.height(); - } - - @Override - public int getMinHeight() { - return dimension.minY(); - } - - @Override - public boolean hasChunkLoaded(int chunkX, int chunkZ) { - return false; - } - - @Override - public IBlockStateWrapper getBlockState(DhBlockPos pos) { - return BlockStateWrapper.AIR; - } - - @Override - public IBiomeWrapper getBiome(DhBlockPos pos) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - @Override - public Object getWrappedMcObject() { - return null; - } - - @Nullable - @Override - public IClientLevelWrapper tryGetClientLevelWrapper() { - return null; - } - - @Override - public File getSaveFolder() { - return saveFolder.toFile(); - } - } - - @Unique - private DhServerLevel dhServerLevel; - @Unique - private FakeLevelWrapper fakeLevelWrapper; - @Unique - public LocalSaveStructure saveStructure; - - @Shadow @Final - private DimensionDataStorage overworldDataStorage; - @Shadow @Final - private LevelStorageSource.LevelStorageAccess levelStorage; - @Shadow @Final - private WorldGenSettings worldGenSettings; - - @Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V", - at = @At(value = "INVOKE") - ) - private void initWorldUpgrade() { - saveStructure = new LocalSaveStructure(); - } - - @Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/util/worldupdate/WorldUpgrader;getAllChunkPos(Lnet/minecraft/resources/ResourceKey;)Ljava/util/List;", shift = At.Shift.AFTER), - locals = LocalCapture.CAPTURE_FAILSOFT - ) - private void startWorldUpgrade(CallbackInfo info, ResourceKey resourceKey) { - ResourceKey key = resourceKey; - fakeLevelWrapper = new FakeLevelWrapper(levelStorage, worldGenSettings, key); - dhServerLevel = new DhServerLevel(saveStructure, fakeLevelWrapper); - } - - -} -#endif \ No newline at end of file diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java deleted file mode 100644 index dfba682ae..000000000 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.seibel.distanthorizons.neoforge.mixins.client; - -import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper; - -#if FALSE -@Mixin(WorldUpgrader.class) -public class MixinWorldUpgrader { - static class FakeLevelWrapper implements IServerLevelWrapper { - private Path saveFolder; - private LevelStem stem; - private DimensionType dimension; - private DimensionTypeWrapper dimensionTypeWrapper; - - public FakeLevelWrapper(LevelStorageSource.LevelStorageAccess storage, WorldGenSettings gen, ResourceKey dim) { - saveFolder = storage.getDimensionPath(dim); - stem = gen.dimensions().getOrThrow(WorldGenSettings.levelToLevelStem(dim)); - dimension = stem.typeHolder().value(); - dimensionTypeWrapper = DimensionTypeWrapper.getDimensionTypeWrapper(dimension); - } - - @Override - public EDhApiLevelType getLevelType() { - return EDhApiLevelType.SERVER_LEVEL; - } - - @Override - public IDhApiDimensionTypeWrapper getDimensionType() { - return dimensionTypeWrapper; - } - - @Override - public int getBlockLight(int x, int y, int z) { - return 0; - } - - @Override - public int getSkyLight(int x, int y, int z) { - return 0; - } - - @Override - public boolean hasCeiling() { - return dimension.hasCeiling(); - } - - @Override - public boolean hasSkyLight() { - return dimension.hasSkyLight(); - } - - @Override - public int getHeight() { - return dimension.height(); - } - - @Override - public int getMinHeight() { - return dimension.minY(); - } - - @Override - public boolean hasChunkLoaded(int chunkX, int chunkZ) { - return false; - } - - @Override - public IBlockStateWrapper getBlockState(DhBlockPos pos) { - return BlockStateWrapper.AIR; - } - - @Override - public IBiomeWrapper getBiome(DhBlockPos pos) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - @Override - public Object getWrappedMcObject() { - return null; - } - - @Nullable - @Override - public IClientLevelWrapper tryGetClientLevelWrapper() { - return null; - } - - @Override - public File getSaveFolder() { - return saveFolder.toFile(); - } - } - - @Unique - private DhServerLevel dhServerLevel; - @Unique - private FakeLevelWrapper fakeLevelWrapper; - @Unique - public LocalSaveStructure saveStructure; - - @Shadow @Final - private DimensionDataStorage overworldDataStorage; - @Shadow @Final - private LevelStorageSource.LevelStorageAccess levelStorage; - @Shadow @Final - private WorldGenSettings worldGenSettings; - - @Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V", - at = @At(value = "INVOKE") - ) - private void initWorldUpgrade() { - saveStructure = new LocalSaveStructure(); - } - - @Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/util/worldupdate/WorldUpgrader;getAllChunkPos(Lnet/minecraft/resources/ResourceKey;)Ljava/util/List;", shift = At.Shift.AFTER), - locals = LocalCapture.CAPTURE_FAILSOFT - ) - private void startWorldUpgrade(CallbackInfo info, ResourceKey resourceKey) { - ResourceKey key = resourceKey; - fakeLevelWrapper = new FakeLevelWrapper(levelStorage, worldGenSettings, key); - dhServerLevel = new DhServerLevel(saveStructure, fakeLevelWrapper); - } - - -} -#endif \ No newline at end of file From 3298857d0cfdc5c676245f55db685b48b8428da1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 20:30:51 -0500 Subject: [PATCH 11/22] Remove references to FastUtil 8.5.13 --- build.gradle | 6 ++++++ coreSubProjects | 2 +- gradle.properties | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9c7ff04ba..08977eb1e 100644 --- a/build.gradle +++ b/build.gradle @@ -196,6 +196,12 @@ subprojects { p -> implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") + // FastUtil + // Note: MC 1.16 uses 8.2.1, and versions after use 8.5.12 + // We cannot relocate this library since we call some MC classes that reference it + implementation("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") + + // Compression forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 forgeShadowMe("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd diff --git a/coreSubProjects b/coreSubProjects index 8ecd5dd9c..9196480e5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 8ecd5dd9cbf57f0e8ba7cbaa75289d5270176027 +Subproject commit 9196480e50b1c03d01c638de53b03119d99b0919 diff --git a/gradle.properties b/gradle.properties index bdf89dafb..1b6f9c5d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,9 @@ lz4_version=1.8.0 zstd_version=1.5.5-11 xz_version=1.9 sqlite_jdbc_version=3.43.0.0 -fastutil_version=8.5.13 +# 8.2.1 is the newest version we can use since that's the version MC 1.16.5 uses +# (at least until we can fix the gradle script so core and main can use/shade different fastutil versions) +fastutil_version=8.2.1 #svgSalamander_version=1.1.3 # Minecraft related libaries (included in MC's jar) From 49125cae476d3cac86225addc244aa37773b7de7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 21:17:54 -0500 Subject: [PATCH 12/22] Remove ZStd compression option Any ZStd data will be automatically deleted and re-generated --- build.gradle | 1 - coreSubProjects | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 08977eb1e..fc6c05d92 100644 --- a/build.gradle +++ b/build.gradle @@ -204,7 +204,6 @@ subprojects { p -> // Compression forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 - forgeShadowMe("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd forgeShadowMe("org.tukaani:xz:${rootProject.xz_version}") // LZMA // Sqlite Database diff --git a/coreSubProjects b/coreSubProjects index 9196480e5..c8f115483 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9196480e50b1c03d01c638de53b03119d99b0919 +Subproject commit c8f11548310017e852b9fd1bef3319b7d8d05abd From 0fa03701a45bfe26865f13cb76164760f67d2eda Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 21:24:08 -0500 Subject: [PATCH 13/22] Fix debug wireframes rendering on top of LODs --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index c8f115483..980086c53 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c8f11548310017e852b9fd1bef3319b7d8d05abd +Subproject commit 980086c53317a7fd84033da303902478324d5e88 From 6254f7156fa3981e1c1191d6a17e3559dc73c33e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Apr 2024 21:59:17 -0500 Subject: [PATCH 14/22] Improve nightly build and migration messages --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 980086c53..945853d01 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 980086c53317a7fd84033da303902478324d5e88 +Subproject commit 945853d0145c40cd98dc6aae05bee694dc38c240 From 6cc828474764d66cfef1f8cfa282f8376e9876fd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 1 May 2024 07:45:23 -0500 Subject: [PATCH 15/22] Start adding 1.20.6 --- fabric/build.gradle | 4 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- versionProperties/1.20.6.properties | 53 ++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 versionProperties/1.20.6.properties diff --git a/fabric/build.gradle b/fabric/build.gradle index 540278611..9a034c6fc 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -72,7 +72,9 @@ dependencies { // Mod Menu - modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") + if (rootProject.modmenu_version != "") { + modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") + } diff --git a/gradle.properties b/gradle.properties index 1b6f9c5d2..80e798747 100644 --- a/gradle.properties +++ b/gradle.properties @@ -49,7 +49,7 @@ 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.4 +mcVer=1.20.6 # Defines the maximum amount of memory Minecraft is allowed when run in a developement environment #minecraftMemoryJavaArg="-Xmx4G" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e0930..b82aa23a4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties new file mode 100644 index 000000000..ac216d04c --- /dev/null +++ b/versionProperties/1.20.6.properties @@ -0,0 +1,53 @@ +# 1.20.6 version +java_version=21 +minecraft_version=1.20.6 +parchment_version=1.20.4:2024.04.14 +compatible_minecraft_versions=["1.20.6"] +accessWidenerVersion=1_20_2 +builds_for=fabric +# neoforge can be added once the issue with mixins has been resolved + +# Fabric loader +fabric_loader_version=0.15.10 +fabric_api_version=0.97.8+1.20.6 + # Fabric mod versions + modmenu_version= + starlight_version_fabric= + phosphor_version_fabric= + lithium_version= + sodium_version=mc1.20.6-0.5.8 + iris_version=1.7.0+1.20.6 + bclib_version= + immersive_portals_version= + canvas_version= + + fabric_incompatibility_list={ "iris": "<=1.6.20" } + fabric_recommend_list={ "indium": "*" } + + # Fabric mod run + # 0 = Don't enable and don't run + # 1 = Can be referenced in code but doesn't run + # 2 = Can be referenced in code and runs in client + enable_starlight=0 + enable_phosphor=0 + enable_sodium=1 + enable_lithium=0 + enable_iris=1 + enable_bclib=0 + enable_immersive_portals=0 + enable_canvas=0 + +# (Neo)Forge loader +forge_version=50.0.0 +neoforge_version=20.6.11-beta + # (Neo)Forge mod versions + starlight_version_forge= + terraforged_version= + + # (Neo)Forge mod run + # 0 = Don't enable and don't run + # 1 = Can be referenced in code but doesn't run + # 2 = Can be referenced in code and runs in client + enable_starlight_forge=0 + enable_terraforged=0 + enable_terrafirmacraft=0 From 3b10ca5809e68f408969cd0c720d1ec2ec04464b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 2 May 2024 17:27:04 -0500 Subject: [PATCH 16/22] Update arch loom 1.5-snapshot -> 1.6-snapshot --- build.gradle | 2 +- fabric/build.gradle | 2 +- gradle.properties | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index fc6c05d92..eb25b6432 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" // Architectury is used here only as a replacement for forge's own loom - id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false } diff --git a/fabric/build.gradle b/fabric/build.gradle index 9a034c6fc..fa1fabb62 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -45,7 +45,7 @@ def addMod(path, enabled) { } dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" mappings loom.layered() { // Mojmap mappings officialMojangMappings() diff --git a/gradle.properties b/gradle.properties index 80e798747..efca12986 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues mod_discord=https://discord.gg/xAB8G4cENx # Global Plugin Versions -manifold_version=2024.1.9 +manifold_version=2024.1.12 nightconfig_version=3.6.6 lz4_version=1.8.0 zstd_version=1.5.5-11 @@ -49,7 +49,7 @@ 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.6 +mcVer=1.20.4 # Defines the maximum amount of memory Minecraft is allowed when run in a developement environment #minecraftMemoryJavaArg="-Xmx4G" From 21f4adc76941580de1a34e6d5d092817c5224ec3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 2 May 2024 17:28:30 -0500 Subject: [PATCH 17/22] Minor 1.20.6 preprocessor updates --- .../common/wrappers/WrapperFactory.java | 12 ++++++------ .../common/wrappers/chunk/ChunkWrapper.java | 8 +++++++- .../common/wrappers/world/ClientLevelWrapper.java | 7 ++++++- .../common/wrappers/world/ServerLevelWrapper.java | 5 +++++ .../worldGeneration/BatchGenerationEnvironment.java | 7 ++++++- .../mimicObject/DhLitWorldGenRegion.java | 8 +++++++- .../mimicObject/LightGetterAdaptor.java | 13 +++++++++++-- .../mimicObject/WorldGenStructFeatManager.java | 7 ++++++- .../wrappers/worldGeneration/step/StepBiomes.java | 10 +++++++--- .../wrappers/worldGeneration/step/StepFeatures.java | 7 ++++++- .../wrappers/worldGeneration/step/StepNoise.java | 12 +++++++----- .../step/StepStructureReference.java | 10 +++++++--- .../worldGeneration/step/StepStructureStart.java | 8 +++++++- .../wrappers/worldGeneration/step/StepSurface.java | 9 +++++++-- versionProperties/1.20.6.properties | 2 +- 15 files changed, 96 insertions(+), 29 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java index 2f922e3d8..dd71daf24 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java @@ -118,7 +118,7 @@ public class WrapperFactory implements IWrapperFactory } } - #if MC_VER <= MC_1_20_4 + #if MC_VER <= MC_1_20_6 else if (objectArray.length == 2) { // correct number of parameters from the API @@ -183,7 +183,7 @@ public class WrapperFactory implements IWrapperFactory { String[] expectedClassNames; - #if MC_VER <= MC_1_20_4 + #if MC_VER <= MC_1_20_6 expectedClassNames = new String[] { ChunkAccess.class.getName(), @@ -231,7 +231,7 @@ public class WrapperFactory implements IWrapperFactory Biome biome = (Biome) objectArray[0]; return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper); - #elif MC_VER <= MC_1_20_4 + #elif MC_VER <= MC_1_20_6 if (!(objectArray[0] instanceof Holder) || !(((Holder) objectArray[0]).value() instanceof Biome)) { throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); @@ -254,7 +254,7 @@ public class WrapperFactory implements IWrapperFactory #if MC_VER < MC_1_18_2 expectedClassNames = new String[] { Biome.class.getName() }; - #elif MC_VER <= MC_1_20_4 + #elif MC_VER <= MC_1_20_6 expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #else // See preprocessor comment in createChunkWrapper() for full documentation @@ -275,7 +275,7 @@ public class WrapperFactory implements IWrapperFactory - #if MC_VER <= MC_1_20_4 + #if MC_VER <= MC_1_20_6 if (objectArray.length != 1) { throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray)); @@ -302,7 +302,7 @@ public class WrapperFactory implements IWrapperFactory #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 expectedClassNames = new String[] { Biome.class.getName() }; - #elif MC_VER <= MC_1_20_4 + #elif MC_VER <= MC_1_20_6 expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #else // See preprocessor comment in createChunkWrapper() for full documentation 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 b49e01a74..ee6c373df 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 @@ -38,7 +38,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.levelgen.Heightmap; @@ -73,6 +72,13 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.core.SectionPos; #endif +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + + public class ChunkWrapper implements IChunkWrapper { private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java index 3bfe90a38..29522508d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java @@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkSource; -import net.minecraft.world.level.chunk.ChunkStatus; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -33,6 +32,12 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public class ClientLevelWrapper implements IClientLevelWrapper { private static final Logger LOGGER = DhLoggerBuilder.getLogger(ClientLevelWrapper.class.getSimpleName()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java index 0728a01f3..29eadb18e 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java @@ -41,7 +41,12 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapp import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkSource; + +#if MC_VER <= MC_1_20_4 import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index de268a590..59ffa4c5f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -66,7 +66,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.chunk.UpgradeData; @@ -79,6 +78,12 @@ import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; import net.minecraft.nbt.CompoundTag; import org.apache.logging.log4j.LogManager; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + /* Total: 3.135214124s ===================================== diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java index f8cdef103..4f66f315c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java @@ -52,11 +52,17 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ImposterProtoChunk; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.lighting.LevelLightEngine; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + + public class DhLitWorldGenRegion extends WorldGenRegion { private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java index 097962b94..8e6c71586 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java @@ -23,15 +23,24 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.chunk.LightChunkGetter; + #if MC_VER >= MC_1_17_1 import net.minecraft.world.level.LevelHeightAccessor; #endif -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.chunk.LightChunkGetter; + #if MC_VER >= MC_1_20_1 import net.minecraft.world.level.chunk.LightChunk; #endif +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + + + public class LightGetterAdaptor implements LightChunkGetter { private final BlockGetter heightGetter; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java index 05c846540..fcdc779b3 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java @@ -35,7 +35,6 @@ import net.minecraft.server.level.WorldGenRegion; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.levelgen.WorldGenSettings; #if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; @@ -57,6 +56,12 @@ import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.feature.StructureFeature; #endif +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureFeatureManager #else StructureManager #endif diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java index f0ee76c04..d52fdc447 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java @@ -27,15 +27,19 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if MC_VER < MC_1_19_2 -#endif import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; + #if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public final class StepBiomes { public static final ChunkStatus STATUS = ChunkStatus.BIOMES; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java index dcd46c044..4f6618e1f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java @@ -27,11 +27,16 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.gridList.ArrayGridList; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.levelgen.Heightmap; import org.apache.logging.log4j.Logger; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public final class StepFeatures { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java index 1974e385d..a99958aac 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java @@ -28,17 +28,19 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException; import net.minecraft.server.level.WorldGenRegion; -#if MC_VER >= MC_1_17_1 -#endif -#if MC_VER < MC_1_19_2 -#endif import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; + #if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public final class StepNoise { private static final ChunkStatus STATUS = ChunkStatus.NOISE; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java index 76ee86400..3894c522d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java @@ -27,12 +27,16 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if MC_VER < MC_1_19_2 -#endif import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + + public final class StepStructureReference { private static final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES; 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 63cc74800..24e9c90b5 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 @@ -30,10 +30,16 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; import org.apache.logging.log4j.Logger; +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + + public final class StepStructureStart { private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java index 5978651d8..384611a2f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java @@ -28,9 +28,14 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame import net.minecraft.server.level.WorldGenRegion; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.levelgen.Heightmap; + +#if MC_VER <= MC_1_20_4 +import net.minecraft.world.level.chunk.ChunkStatus; +#else +import net.minecraft.world.level.chunk.status.ChunkStatus; +#endif + public final class StepSurface { diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index ac216d04c..c2fc9045a 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -39,7 +39,7 @@ fabric_api_version=0.97.8+1.20.6 # (Neo)Forge loader forge_version=50.0.0 -neoforge_version=20.6.11-beta +neoforge_version=20.6.16-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From 9bfe2e8233937fb8426d1b00960089ee4afa2b4d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 09:22:44 -0500 Subject: [PATCH 18/22] Up 1.20 fabric loader versions 0.14.24/0.15.1 -> 0.15.6 --- versionProperties/1.20.1.properties | 2 +- versionProperties/1.20.2.properties | 2 +- versionProperties/1.20.4.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index 27d2166ad..3c73bd063 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -7,7 +7,7 @@ accessWidenerVersion=1_20 builds_for=fabric,forge # Fabric loader -fabric_loader_version=0.14.24 +fabric_loader_version=0.15.6 fabric_api_version=0.90.4+1.20.1 # Fabric mod versions modmenu_version=7.2.2 diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 6678cd53e..f443bc41c 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -7,7 +7,7 @@ accessWidenerVersion=1_20_2 builds_for=fabric,forge # Fabric loader -fabric_loader_version=0.14.24 +fabric_loader_version=0.15.6 fabric_api_version=0.90.4+1.20.2 # Fabric mod versions modmenu_version=8.0.0 diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index a8d6371a5..843ea79af 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -8,7 +8,7 @@ builds_for=fabric,forge # neoforge can be added once the issue with mixins has been resolved # Fabric loader -fabric_loader_version=0.15.1 +fabric_loader_version=0.15.6 fabric_api_version=0.91.2+1.20.4 # Fabric mod versions modmenu_version=9.0.0-pre.1 From 8e984448872fc85d82a0c63ff7e6589d36670a23 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 09:23:02 -0500 Subject: [PATCH 19/22] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 945853d01..950c951c2 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 945853d0145c40cd98dc6aae05bee694dc38c240 +Subproject commit 950c951c2de9242dc9bfd34b616efbeee7b2e870 From c7cf7885ae61f4cb3b5ecc204ce22f5cfa1cdbee Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 09:48:40 -0500 Subject: [PATCH 20/22] Fix #670 Remove outdated world gen options from tooltip --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 950c951c2..aad095ca1 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 950c951c2de9242dc9bfd34b616efbeee7b2e870 +Subproject commit aad095ca1a83bc20e4493835dab68fb018f7c6fb From 1f6e137759750eb400a7a40ccec7ccb31ec2d628 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 15:36:51 -0500 Subject: [PATCH 21/22] Fix F3 levels not closing with multiverse --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index aad095ca1..e1ca398b8 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit aad095ca1a83bc20e4493835dab68fb018f7c6fb +Subproject commit e1ca398b8f24d82d1c5f79a345cc641a2366d680 From 06ea56767f22e58560042c07ef4fa6ddab1a47de Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 15:37:20 -0500 Subject: [PATCH 22/22] Up manifold version 2024.1.12 -> 2024.1.13 --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index efca12986..d4fdcff7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,8 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues mod_discord=https://discord.gg/xAB8G4cENx # Global Plugin Versions -manifold_version=2024.1.12 +manifold_version=2024.1.13 +# 2023.1.17 can be used if there are mystery Java compiler issues nightconfig_version=3.6.6 lz4_version=1.8.0 zstd_version=1.5.5-11