From afb0a57920ee07feb45c464a21803a305060c4d7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 3 Dec 2023 19:13:19 -0600 Subject: [PATCH 001/301] up the version number 2.0.1-a -> 2.0.2-a --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index f32e25f52..b999a321c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f32e25f52fac692a85ff36e423f7617ae8940370 +Subproject commit b999a321c7f1fbc0144a7c5bcb76ad5e1bdcd678 diff --git a/gradle.properties b/gradle.properties index 6acf4eaba..4974e1d30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.0.1-a +mod_version=2.0.2-a-dev api_version=1.0.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons From 871c6031b8adaad2c6ca86bec447c991ff1d109d Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 4 Dec 2023 23:34:40 +1030 Subject: [PATCH 002/301] Added version number to updated jar --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b999a321c..614e1e027 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b999a321c7f1fbc0144a7c5bcb76ad5e1bdcd678 +Subproject commit 614e1e027f0f249accda19b3dd35eeb1f184a0e2 From 704a2ff21770d1d371ac102cb5e5b35762ef8c05 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 4 Dec 2023 07:17:51 -0600 Subject: [PATCH 003/301] Only display empty biomeWrapper string logs once --- .../common/wrappers/block/BiomeWrapper.java | 82 ++++++++++++------- 1 file changed, 53 insertions(+), 29 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 63fd98561..1ea448094 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 @@ -76,7 +76,14 @@ public class BiomeWrapper implements IBiomeWrapper public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); /** keep track of broken biomes so we don't log every time */ - private static final HashSet BrokenResourceLocationStrings = new HashSet<>(); + private static final HashSet brokenResourceLocationStrings = new HashSet<>(); + + /** + * Only display this warning once, otherwise the log may be spammed
+ * This is a known issue when joining Hypixel. + */ + private static boolean emptyStringWarningLogged = false; + private static boolean emptyLevelSerializeFailLogged = false; @@ -182,42 +189,55 @@ public class BiomeWrapper implements IBiomeWrapper public String serialize(ILevelWrapper levelWrapper) { + if (this.serialString != null) + { + return this.serialString; + } + + + // 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."); + } + return EMPTY_STRING; } - if (this.serialString == null) + + // generate the serial string // + + net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); + + ResourceLocation resourceLocation; + #if MC_1_16_5 || MC_1_17_1 + resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome); + #elif MC_1_18_2 || MC_1_19_2 + resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value()); + #else + resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value()); + #endif + + if (resourceLocation == null) { - net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); - - ResourceLocation resourceLocation; + String biomeName; #if MC_1_16_5 || MC_1_17_1 - resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome); - #elif MC_1_18_2 || MC_1_19_2 - resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value()); + biomeName = this.biome.toString(); #else - resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value()); + biomeName = this.biome.value().toString(); #endif - if (resourceLocation == null) - { - String biomeName; - #if MC_1_16_5 || MC_1_17_1 - biomeName = this.biome.toString(); - #else - biomeName = this.biome.value().toString(); - #endif - - LOGGER.warn("unable to serialize: " + biomeName); - // shouldn't normally happen, but just in case - this.serialString = ""; - } - else - { - this.serialString = resourceLocation.getNamespace() + ":" + resourceLocation.getPath(); - } + LOGGER.warn("unable to serialize: " + biomeName); + // shouldn't normally happen, but just in case + this.serialString = ""; + } + else + { + this.serialString = resourceLocation.getNamespace() + ":" + resourceLocation.getPath(); } return this.serialString; @@ -227,7 +247,11 @@ public class BiomeWrapper implements IBiomeWrapper { if (resourceLocationString.equals(EMPTY_STRING)) { - LOGGER.warn("["+EMPTY_STRING+"] biome string deserialized. This may mean there was a file saving error or a biome saving error."); + 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."); + } return EMPTY_WRAPPER; } else if (resourceLocationString.trim().isEmpty() || resourceLocationString.equals("")) @@ -270,9 +294,9 @@ public class BiomeWrapper implements IBiomeWrapper if (!success) { - if (!BrokenResourceLocationStrings.contains(resourceLocationString)) + if (!brokenResourceLocationStrings.contains(resourceLocationString)) { - BrokenResourceLocationStrings.add(resourceLocationString); + brokenResourceLocationStrings.add(resourceLocationString); LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]"); } return EMPTY_WRAPPER; From 926c7924dfdf9401829d42aef1b103a5f33ae02c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 5 Dec 2023 07:15:39 -0600 Subject: [PATCH 004/301] Merge in Builderb0y's render merging improvements --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 614e1e027..104be7804 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 614e1e027f0f249accda19b3dd35eeb1f184a0e2 +Subproject commit 104be7804cd0c43375156f97b1fbee1fcf631f9d From bae7e44dd8bcc1aee566bc2b5285da840f976e3c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 6 Dec 2023 07:50:10 -0600 Subject: [PATCH 005/301] Add overdraw number input --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 104be7804..070b52da5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 104be7804cd0c43375156f97b1fbee1fcf631f9d +Subproject commit 070b52da5ebfdca7b603122d5c87f24776af3761 From fabad7158e0771929a9f37c67f7bec697880984b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 6 Dec 2023 07:50:23 -0600 Subject: [PATCH 006/301] Up the api version number 1.0.0 -> 1.1.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4974e1d30..bdcfe672d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons mod_version=2.0.2-a-dev -api_version=1.0.0 +api_version=1.1.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. From 6f8c7e8249f3b953fa18561e5b4456436bdce363 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 7 Dec 2023 07:13:43 -0600 Subject: [PATCH 007/301] Add Config API methods getApiValue() and clearValue() --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 070b52da5..2c154613a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 070b52da5ebfdca7b603122d5c87f24776af3761 +Subproject commit 2c154613a0ca0ff017ce833189eb6ae7d528ce51 From 5b81ca27168550811c7c55e6c17e56284c3b970c Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 9 Dec 2023 14:09:24 +1030 Subject: [PATCH 008/301] Updated to 1.20.3/4 --- .../common/wrappers/gui/ClassicConfigGUI.java | 10 ++-- .../common/wrappers/gui/MinecraftScreen.java | 16 +++--- .../wrappers/gui/updater/ChangelogScreen.java | 16 +++--- .../wrappers/gui/updater/UpdateModScreen.java | 6 +-- .../minecraft/MinecraftClientWrapper.java | 4 ++ .../minecraft/MinecraftRenderWrapper.java | 22 ++++---- .../wrappers/modAccessor/BCLibAccessor.java | 4 +- versionProperties/1.20.4.properties | 51 +++++++++++++++++++ 8 files changed, 98 insertions(+), 31 deletions(-) create mode 100644 versionProperties/1.20.4.properties diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 0df21fe0c..7639dc12c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -278,7 +278,7 @@ public class ClassicConfigGUI Objects.requireNonNull(minecraft).setScreen(parent); })); - this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32, 25); + this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32); if (this.minecraft != null && this.minecraft.level != null) this.list.setRenderBackground(false); @@ -537,9 +537,13 @@ public class ClassicConfigGUI { Font textRenderer; - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m) + public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) { - super(minecraftClient, i, j, k, l, m); + #if PRE_MC_1_20_4 + super(minecraftClient, i, j, k, l, 25); + #else + super(minecraftClient, i, j, k, l); + #endif this.centerListVertically = false; textRenderer = minecraftClient.font; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index 716c98775..e90f235f5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -59,7 +59,7 @@ public class MinecraftScreen screen.scaledHeight = this.height; screen.init(); // Init our own config screen - this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, this.height, 25); // Select the area to tint + this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, this.height); // Select the area to tint if (this.minecraft != null && this.minecraft.level != null) // Check if in game this.list.setRenderBackground(false); // Disable from rendering this.addWidget(this.list); // Add the tint to the things to be rendered @@ -72,10 +72,10 @@ public class MinecraftScreen public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_20_2 - this.renderBackground(matrices, mouseX, mouseY, delta); // Render background - #else + #if PRE_MC_1_20_2 this.renderBackground(matrices); // Render background + #else + this.renderBackground(matrices, mouseX, mouseY, delta); // Render background #endif this.list.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker) @@ -131,9 +131,13 @@ public class MinecraftScreen public static class ConfigListWidget extends ContainerObjectSelectionList { - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m) + public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) { - super(minecraftClient, i, j, k, l, m); + #if PRE_MC_1_20_4 + super(minecraftClient, i, j, k, l, 25); + #else + super(minecraftClient, i, j, k, l); + #endif this.centerListVertically = false; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index 5b1f6ba39..ccccd8cc8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -134,7 +134,7 @@ public class ChangelogScreen extends DhScreen ); - this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, this.height - 32, 10); + this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, this.height - 32); for (int i = 0; i < changelog.size(); i++) { this.changelogArea.addButton(TextOrLiteral(changelog.get(i))); @@ -150,10 +150,10 @@ public class ChangelogScreen extends DhScreen public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_20_2 - this.renderBackground(matrices, mouseX, mouseY, delta); // Render background - #else + #if PRE_MC_1_20_2 this.renderBackground(matrices); // Render background + #else + this.renderBackground(matrices, mouseX, mouseY, delta); // Render background #endif if (!usable) return; @@ -185,9 +185,13 @@ public class ChangelogScreen extends DhScreen { Font textRenderer; - public TextArea(Minecraft minecraftClient, int i, int j, int k, int l, int m) + public TextArea(Minecraft minecraftClient, int i, int j, int k, int l) { - super(minecraftClient, i, j, k, l, m); + #if PRE_MC_1_20_4 + super(minecraftClient, i, j, k, l, 10); + #else + super(minecraftClient, i, j, k, l); + #endif this.centerListVertically = false; textRenderer = minecraftClient.font; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 70c8592c7..5addfc306 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -152,10 +152,10 @@ public class UpdateModScreen extends DhScreen public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_20_2 - this.renderBackground(matrices, mouseX, mouseY, delta); // Render background - #else + #if PRE_MC_1_20_2 this.renderBackground(matrices); // Render background + #else + this.renderBackground(matrices, mouseX, mouseY, delta); // Render background #endif diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index 611172844..208387960 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -282,7 +282,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra { LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception); CrashReport report = new CrashReport(errorMessage, exception); + #if PRE_MC_1_20_4 Minecraft.crash(report); + #else + Minecraft.getInstance().delayCrash(report); + #endif } @Override 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 5108d556d..6a05e158f 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 @@ -44,7 +44,7 @@ import com.mojang.math.Vector3f; #else import org.joml.Vector3f; #endif -#if MC_1_20_2 +#if POST_MC_1_20_2 import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; #endif @@ -321,16 +321,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { try { - #if MC_1_20_2 - LevelRenderer levelRenderer = MC.levelRenderer; - Collection chunks = levelRenderer.visibleSections; - - return (chunks.stream().map((chunk) -> { - AABB chunkBoundingBox = chunk.getBoundingBox(); - return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), - Math.floorDiv((int) chunkBoundingBox.minZ, 16)); - }).collect(Collectors.toCollection(HashSet::new))); - #else + #if PRE_MC_1_20_2 LevelRenderer levelRenderer = MC.levelRenderer; Collection chunks = #if PRE_MC_1_18_2 levelRenderer.renderChunks; @@ -343,6 +334,15 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), Math.floorDiv((int) chunkBoundingBox.minZ, 16)); }).collect(Collectors.toCollection(HashSet::new))); + #else + LevelRenderer levelRenderer = MC.levelRenderer; + Collection chunks = levelRenderer.visibleSections; + + return (chunks.stream().map((chunk) -> { + AABB chunkBoundingBox = chunk.getBoundingBox(); + return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), + Math.floorDiv((int) chunkBoundingBox.minZ, 16)); + }).collect(Collectors.toCollection(HashSet::new))); #endif } catch (LinkageError e) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index 968a98086..a12f1f0a4 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -1,7 +1,7 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor; -#if MC_1_16_5 || MC_1_17_1 +#if MC_1_16_5 || MC_1_17_1 || MC_1_20_4 // These versions either don't have BCLib, or the implementation is different #elif MC_1_18_2 import ru.bclib.config.ClientConfig; import ru.bclib.config.Configs; @@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor public void setRenderCustomFog(boolean newValue) { - #if !(MC_1_16_5 || MC_1_17_1) // 1.16 and 1.17 don't have "ClientConfig.CUSTOM_FOG_RENDERING" + #if !(MC_1_16_5 || MC_1_17_1 || MC_1_20_4) // These versions either don't have BCLib, or the implementation is different // Change the value of CUSTOM_FOG_RENDERING in the bclib client config // This disabled fog from rendering within bclib diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties new file mode 100644 index 000000000..3edc33c15 --- /dev/null +++ b/versionProperties/1.20.4.properties @@ -0,0 +1,51 @@ +# 1.20.4 version +java_version=17 +minecraft_version=1.20.4 +parchment_version=1.20.1:2023.09.03 +compatible_minecraft_versions=["1.20.4", "1.20.3"] +accessWidenerVersion=1_20_2 +builds_for=fabric,forge + +# Fabric loader +fabric_loader_version=0.15.1 +fabric_api_version=0.91.2+1.20.4 + # Fabric mod versions + modmenu_version=9.0.0-pre.1 + starlight_version_fabric= + phosphor_version_fabric= + lithium_version= + sodium_version=mc1.20.3-0.5.4 + iris_version=1.6.13+1.20.4 + bclib_version= + immersive_portals_version= + canvas_version= + + fabric_incompatibility_list={ } + 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 + +# Forge loader +forge_version=49.0.3 + # Forge mod versions + starlight_version_forge= + terraforged_version= + + # 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 04ddd8351951228474c0e05a7cfa7e534c1342b7 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 9 Dec 2023 14:41:15 +1030 Subject: [PATCH 009/301] Fixed up screens looking incorrect on 1.20.4 mc versions --- .../common/wrappers/gui/ClassicConfigGUI.java | 8 ++++---- .../common/wrappers/gui/MinecraftScreen.java | 8 ++++---- .../common/wrappers/gui/updater/ChangelogScreen.java | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 7639dc12c..ac5a98482 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -278,7 +278,7 @@ public class ClassicConfigGUI Objects.requireNonNull(minecraft).setScreen(parent); })); - this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32); + this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25); if (this.minecraft != null && this.minecraft.level != null) this.list.setRenderBackground(false); @@ -537,12 +537,12 @@ public class ClassicConfigGUI { Font textRenderer; - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) + public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 25); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; textRenderer = minecraftClient.font; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index e90f235f5..aaa804181 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -59,7 +59,7 @@ public class MinecraftScreen screen.scaledHeight = this.height; screen.init(); // Init our own config screen - this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, this.height); // Select the area to tint + this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint if (this.minecraft != null && this.minecraft.level != null) // Check if in game this.list.setRenderBackground(false); // Disable from rendering this.addWidget(this.list); // Add the tint to the things to be rendered @@ -131,12 +131,12 @@ public class MinecraftScreen public static class ConfigListWidget extends ContainerObjectSelectionList { - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) + public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 25); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index ccccd8cc8..0b3b493db 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -134,7 +134,7 @@ public class ChangelogScreen extends DhScreen ); - this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, this.height - 32); + this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, 32, 10); for (int i = 0; i < changelog.size(); i++) { this.changelogArea.addButton(TextOrLiteral(changelog.get(i))); @@ -185,12 +185,12 @@ public class ChangelogScreen extends DhScreen { Font textRenderer; - public TextArea(Minecraft minecraftClient, int i, int j, int k, int l) + public TextArea(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 10); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; textRenderer = minecraftClient.font; From 8714be1dc704e40e8cbc283c4f18f2a0de407af2 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 9 Dec 2023 14:47:19 +1030 Subject: [PATCH 010/301] Updated ci to include 1.20.4 --- .gitlab-ci.yml | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b2e0acab..8097c0218 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ build: stage: build parallel: matrix: - - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2"] + - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4"] script: # this both runs the unit tests and assembles the code - ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; diff --git a/gradle.properties b/gradle.properties index bdcfe672d..b57fed3ee 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=2023.1.29 +manifold_version=2023.1.31 nightconfig_version=3.6.6 lz4_version=1.8.0 sqlite_jdbc_version=3.43.0.0 From 963d22b2f5121e36e39ac425283ff72046f51003 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 9 Dec 2023 09:42:18 -0600 Subject: [PATCH 011/301] Add a potential fix to unconfigured C2ME crashing/log spam --- .../RegionFileStorageExternalCache.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index d5c346c70..94fc0a2c3 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -1,11 +1,13 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.storage.RegionFile; import net.minecraft.world.level.chunk.storage.RegionFileStorage; +import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; import java.io.DataInputStream; @@ -17,9 +19,13 @@ import java.util.concurrent.locks.ReentrantLock; public class RegionFileStorageExternalCache implements AutoCloseable { + private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + public final RegionFileStorage storage; public static final int MAX_CACHE_SIZE = 16; + public static boolean regionCacheNullPointerWarningSent = false; + /** * Present to reduce the chance that we accidentally break underlying MC code that isn't thread safe, * specifically: "it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.getAndMoveToFirst()" @@ -98,6 +104,19 @@ public class RegionFileStorageExternalCache implements AutoCloseable } #endif } + catch (NullPointerException e) + { + // Can sometimes happen when other mods modify the region cache system (IE C2ME) + // instead of blowing up, just use DH's cache instead + + if (!regionCacheNullPointerWarningSent) + { + regionCacheNullPointerWarningSent = true; + LOGGER.warn("Unable to access Minecraft's chunk cache. This may be due to another mod changing said cache. Falling back to DH's internal cache."); + } + + break; + } finally { this.getRegionFileLock.unlock(); From ed52efa72b2ed8a335c018a53851fac0391a3566 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 9 Dec 2023 10:05:17 -0600 Subject: [PATCH 012/301] Fix SSAO and Fog not applying when Optifine shaders are enabled --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 2c154613a..0c30c72d2 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2c154613a0ca0ff017ce833189eb6ae7d528ce51 +Subproject commit 0c30c72d267b3704719d92f008280e2f5443fc8d From e787d7d31766b60b515ee8f1da0e00b8c4b88172 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 9 Dec 2023 16:18:17 -0600 Subject: [PATCH 013/301] Attempt to fix a rare concurrent lighting engine issue with ChunkWrapper.getBlockLightPosList() --- .../distanthorizons/common/wrappers/chunk/ChunkWrapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 7f6a203b1..0bbb83552 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 @@ -374,8 +374,12 @@ public class ChunkWrapper implements IChunkWrapper } } + /** + * FIXME synchronized is necessary for a rare issue where this method is called from two separate threads at the same time + * before the list has finished populating. + */ @Override - public ArrayList getBlockLightPosList() + public synchronized ArrayList getBlockLightPosList() { // only populate the list once if (this.blockLightPosList == null) From fee1c98a341bf62919349a462040c8699a7abce2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 9 Dec 2023 16:19:05 -0600 Subject: [PATCH 014/301] Fix 595 (crash on save and exit) --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 0c30c72d2..88d78c53f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 0c30c72d267b3704719d92f008280e2f5443fc8d +Subproject commit 88d78c53fd3a5071366f329d4187912ba169900d From 2bb2f5a2339cc768b63f951c8efefd49d923ee5c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 11 Dec 2023 07:45:54 -0600 Subject: [PATCH 015/301] Remove PRE and POST preprocessor MC versions --- build.gradle | 48 ++++++--------- .../common/forge/LodForgeMethodCaller.java | 4 +- .../common/rendering/SeamlessOverdraw.java | 4 +- .../common/wrappers/McObjectConverter.java | 6 +- .../common/wrappers/VersionConstants.java | 2 +- .../common/wrappers/WrapperFactory.java | 6 +- .../common/wrappers/block/BiomeWrapper.java | 28 ++++----- .../wrappers/block/BlockStateWrapper.java | 20 +++---- .../block/TextureAtlasSpriteWrapper.java | 4 +- .../block/TintGetterOverrideFast.java | 4 +- .../block/TintGetterOverrideSmooth.java | 4 +- .../block/TintWithoutLevelOverrider.java | 8 +-- .../TintWithoutLevelSmoothOverrider.java | 8 +-- .../block/cache/ClientBlockDetailMap.java | 2 +- .../block/cache/ClientBlockStateCache.java | 10 ++-- .../block/cache/ServerBlockDetailMap.java | 2 +- .../common/wrappers/chunk/ChunkWrapper.java | 34 +++++------ .../common/wrappers/gui/ClassicConfigGUI.java | 18 +++--- .../common/wrappers/gui/DhScreen.java | 6 +- .../common/wrappers/gui/GuiHelper.java | 14 ++--- .../common/wrappers/gui/MinecraftScreen.java | 10 ++-- .../wrappers/gui/TexturedButtonWidget.java | 23 ++++---- .../wrappers/gui/updater/ChangelogScreen.java | 16 ++--- .../wrappers/gui/updater/UpdateModScreen.java | 6 +- .../minecraft/MinecraftClientWrapper.java | 8 +-- .../minecraft/MinecraftRenderWrapper.java | 26 ++++----- .../wrappers/misc/ServerPlayerWrapper.java | 2 +- .../wrappers/world/ClientLevelWrapper.java | 2 +- .../wrappers/world/ServerLevelWrapper.java | 2 +- .../BatchGenerationEnvironment.java | 18 +++--- .../worldGeneration/GlobalParameters.java | 18 +++--- .../worldGeneration/ThreadedParameters.java | 14 ++--- .../mimicObject/ChunkLoader.java | 58 +++++++++---------- .../mimicObject/DhLitWorldGenRegion.java | 20 +++---- .../mimicObject/DummyLightEngine.java | 6 +- .../mimicObject/LightGetterAdaptor.java | 8 +-- .../RegionFileStorageExternalCache.java | 8 +-- .../WorldGenStructFeatManager.java | 28 ++++----- .../worldGeneration/step/StepBiomes.java | 10 ++-- .../worldGeneration/step/StepFeatures.java | 4 +- .../worldGeneration/step/StepNoise.java | 12 ++-- .../step/StepStructureReference.java | 2 +- .../step/StepStructureStart.java | 10 ++-- .../worldGeneration/step/StepSurface.java | 4 +- .../fabric/FabricClientProxy.java | 2 +- .../distanthorizons/fabric/FabricMain.java | 4 +- .../mixins/client/MixinClientLevel.java | 8 +-- .../client/MixinClientPacketListener.java | 6 +- .../mixins/client/MixinFogRenderer.java | 8 +-- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 14 ++--- .../fabric/mixins/client/MixinMinecraft.java | 4 +- .../mixins/client/MixinOptionsScreen.java | 6 +- .../mixins/events/MixinServerLevel.java | 2 +- .../mods/sodium/MixinSodiumRenderer.java | 4 +- .../mixins/server/MixinChunkGenerator.java | 2 +- .../fabric/mixins/server/MixinChunkMap.java | 4 +- .../server/MixinUtilBackgroundThread.java | 4 +- .../server/unsafe/MixinThreadingDetector.java | 2 +- .../wrappers/modAccessor/BCLibAccessor.java | 6 +- .../wrappers/modAccessor/IrisAccessor.java | 2 +- .../wrappers/modAccessor/SodiumAccessor.java | 10 ++-- .../forge/ForgeClientProxy.java | 26 ++++----- .../distanthorizons/forge/ForgeMain.java | 22 +++---- .../forge/ForgeServerProxy.java | 14 ++--- .../client/MixinClientPacketListener.java | 2 +- .../forge/mixins/client/MixinFogRenderer.java | 8 +-- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 18 +++--- .../forge/mixins/client/MixinMinecraft.java | 4 +- .../mixins/client/MixinOptionsScreen.java | 6 +- .../mixins/server/MixinChunkGenerator.java | 2 +- .../mixins/server/MixinTFChunkGenerator.java | 2 +- .../server/MixinUtilBackgroundThread.java | 4 +- .../server/unsafe/MixinThreadingDetector.java | 2 +- 75 files changed, 368 insertions(+), 381 deletions(-) diff --git a/build.gradle b/build.gradle index 3d152fce7..ca35855bc 100644 --- a/build.gradle +++ b/build.gradle @@ -23,48 +23,35 @@ plugins { * @param mcVers array of all MC versions * @param mcIndex array index of the currently active MC version */ -def writeBuildGradlePredefine(List mcVers, int mcIndex) { +def writeBuildGradlePredefine(List mcVers, int mcIndex) +{ ArrayList redefineList = new ArrayList() - - for (int i = 0; i < mcVers.size(); i++) { - String mcStr = mcVers[i].replace(".", "_") + + for (int i = 0; i < mcVers.size(); i++) + { + String fullVerStr = mcVers[i].replace(".", "_"); + String majorVerStr = fullVerStr.substring(0, fullVerStr.lastIndexOf("_")); - if (mcIndex < i) { - // exclusive before - // FIXME doesn't function correctly for 1.16.5 (IE the first item in the list) - redefineList.add("PRE_MC_" + mcStr) - } - if (mcIndex <= i) { - // inclusive before - redefineList.add("PRE_AND_MC_" + mcStr) - } - - if (mcIndex == i) { + if (mcIndex == i) + { // exact - redefineList.add("MC_" + mcStr) - } - - if (mcIndex > i) { - // inclusive after - redefineList.add("POST_AND_MC_" + mcStr) - } - if (mcIndex >= i) { - // exclusive after - redefineList.add("POST_MC_" + mcStr) + redefineList.add("MC_" + fullVerStr); + redefineList.add("MC_" + majorVerStr); } } // Build the list of preprocessors to use - StringBuilder sb = new StringBuilder() + StringBuilder sb = new StringBuilder(); - sb.append("# DON'T TOUCH THIS FILE, This is handled by the build script\n") + sb.append("# DON'T TOUCH THIS FILE, This is handled by the build script\n"); // Check if this is a development build - if (mod_version.toLowerCase().contains("dev")) { + if (mod_version.toLowerCase().contains("dev")) + { // WARNING: only use this for logging, we don't want to have confusion // when a method doesn't work correctly in the release build. - sb.append("DEV_BUILD") - sb.append("=\n") + sb.append("DEV_BUILD"); + sb.append("=\n"); } // Build the MC version preprocessors @@ -500,6 +487,7 @@ allprojects { p -> maven { url "https://maven.architectury.dev" } // For Git repositories + // navigating to the URL in a web browser allows for testing and viewing possible downloads maven { url "https://jitpack.io" } // For Manifold Preprocessor diff --git a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java index 0d9b8da4a..66883973a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.common.forge; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if POST_MC_1_19_2 +#if MC_1_19 || MC_1_20 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; @@ -41,7 +41,7 @@ import java.util.Random; */ public interface LodForgeMethodCaller { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19 #else List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java index 264dc636a..e3d3f142c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.common.rendering; -#if PRE_MC_1_19_4 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 import com.mojang.math.Matrix4f; #else @@ -43,7 +43,7 @@ public class SeamlessOverdraw { float[] matrixFloatArray; - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16); minecraftProjectionMatrix.store(matrixFloatBuffer); matrixFloatArray = matrixFloatBuffer.array(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java index c11e57c77..9d81c9264 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java @@ -23,7 +23,7 @@ import java.nio.FloatBuffer; import java.util.function.BiConsumer; import java.util.function.Consumer; -#if PRE_MC_1_19_4 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 import com.mojang.math.Matrix4f; #else import org.joml.Matrix4f; @@ -54,7 +54,7 @@ public class McObjectConverter /** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */ private static void storeMatrix(Matrix4f matrix, FloatBuffer buffer) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 matrix.store(buffer); #else // Mojang starts to use joml's Matrix4f libary in 1.19.3 so we copy their store method and use it here if its newer than 1.19.3 @@ -83,7 +83,7 @@ public class McObjectConverter FloatBuffer buffer = FloatBuffer.allocate(16); storeMatrix(mcMatrix, buffer); Mat4f matrix = new Mat4f(buffer); - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it #endif return matrix; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java index 643a23f25..2853bb0c2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java @@ -59,7 +59,7 @@ public class VersionConstants implements IVersionConstants @Override public String getMinecraftVersion() { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 return Minecraft.getInstance().getGame().getVersion().getId(); #else return SharedConstants.getCurrentVersion().getId(); 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 6bc8d7907..5992f67a6 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 @@ -106,8 +106,7 @@ public class WrapperFactory implements IWrapperFactory } } - // MC 1.16, 1.18, 1.19, 1.20 - #if POST_MC_1_17_1 || MC_1_16_5 + #if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20 else if (objectArray.length == 2) { // correct number of parameters from the API @@ -174,8 +173,7 @@ public class WrapperFactory implements IWrapperFactory "Chunk wrapper creation failed. \n" + "Expected parameters: \n"); - // MC 1.16, 1.18, 1.19, 1.20 - #if POST_MC_1_17_1 || MC_1_16_5 + #if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20 message.append("[" + ChunkAccess.class.getName() + "], \n"); message.append("[" + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + "]. \n"); #else 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 1ea448094..3440b5b4d 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 @@ -38,13 +38,13 @@ import net.minecraft.core.Holder; import net.minecraft.resources.RegistryOps; #endif -#if POST_MC_1_19_2 +#if MC_1_19_4 || MC_1_20 #endif -#if MC_1_16_5 || MC_1_17_1 +#if MC_1_16_5 || MC_1_17 import net.minecraft.core.Registry; -#elif MC_1_18_2 || MC_1_19_2 +#elif MC_1_18 || MC_1_19_2 import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; @@ -56,7 +56,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome; -#if !PRE_MC_1_18_2 +#if !MC_1_16 || MC_1_17 import net.minecraft.world.level.biome.Biomes; #endif @@ -66,7 +66,7 @@ public class BiomeWrapper implements IBiomeWrapper { private static final Logger LOGGER = LogManager.getLogger(); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 public static final ConcurrentMap WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #else public static final ConcurrentMap, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); @@ -89,7 +89,7 @@ public class BiomeWrapper implements IBiomeWrapper // properties // - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 public final Biome biome; #else public final Holder biome; @@ -104,7 +104,7 @@ public class BiomeWrapper implements IBiomeWrapper // constructors // //==============// - static public IBiomeWrapper getBiomeWrapper(#if PRE_MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) + static public IBiomeWrapper getBiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) { if (biome == null) { @@ -124,7 +124,7 @@ public class BiomeWrapper implements IBiomeWrapper } } - private BiomeWrapper(#if PRE_MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) + private BiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) { this.biome = biome; this.serialString = this.serialize(levelWrapper); @@ -145,7 +145,7 @@ public class BiomeWrapper implements IBiomeWrapper return EMPTY_STRING; } - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 return biome.toString(); #else return this.biome.unwrapKey().orElse(Biomes.THE_VOID).registry().toString(); @@ -214,9 +214,9 @@ public class BiomeWrapper implements IBiomeWrapper net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); ResourceLocation resourceLocation; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome); - #elif MC_1_18_2 || MC_1_19_2 + #elif MC_1_18 || MC_1_19_2 resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value()); #else resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value()); @@ -225,7 +225,7 @@ public class BiomeWrapper implements IBiomeWrapper if (resourceLocation == null) { String biomeName; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 biomeName = this.biome.toString(); #else biomeName = this.biome.value().toString(); @@ -277,10 +277,10 @@ public class BiomeWrapper implements IBiomeWrapper net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); boolean success; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); success = (biome != null); - #elif MC_1_18_2 || MC_1_19_2 + #elif MC_1_18 || MC_1_19_2 Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); success = (unwrappedBiome != null); Holder biome = new Holder.Direct<>(unwrappedBiome); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 25aa8dd9b..6c6c12999 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -32,11 +32,11 @@ import java.io.IOException; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -#if MC_1_16_5 || MC_1_17_1 +#if MC_1_16_5 || MC_1_17 import net.minecraft.core.Registry; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; -#elif MC_1_18_2 || MC_1_19_2 +#elif MC_1_18 || MC_1_19_2 import net.minecraft.client.Minecraft; import net.minecraft.world.level.Level; import net.minecraft.core.BlockPos; @@ -252,7 +252,7 @@ public class BlockStateWrapper implements IBlockStateWrapper @Override public boolean isSolid() { - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 return this.blockState.getMaterial().isSolid(); #else return !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty(); @@ -267,7 +267,7 @@ public class BlockStateWrapper implements IBlockStateWrapper return false; } - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 return this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty(); #else return !this.blockState.getFluidState().isEmpty(); @@ -293,15 +293,15 @@ public class BlockStateWrapper implements IBlockStateWrapper // older versions of MC have a static registry - #if !(MC_1_16_5 || MC_1_17_1) + #if !(MC_1_16_5 || MC_1_17) Level level = (Level)levelWrapper.getWrappedMcObject(); net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); #endif ResourceLocation resourceLocation; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock()); - #elif MC_1_18_2 || MC_1_19_2 + #elif MC_1_18 || MC_1_19_2 resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock()); #else resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock()); @@ -356,16 +356,16 @@ public class BlockStateWrapper implements IBlockStateWrapper try { - #if !(MC_1_16_5 || MC_1_17_1) + #if !(MC_1_16_5 || MC_1_17) // use the given level if possible, otherwise try using the currently loaded one Level level = (levelWrapper != null ? (Level)levelWrapper.getWrappedMcObject() : null); level = (level == null ? Minecraft.getInstance().level : level); #endif Block block; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 block = Registry.BLOCK.get(resourceLocation); - #elif MC_1_18_2 || MC_1_19_2 + #elif MC_1_18 || MC_1_19_2 net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation); #else diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java index b5334f956..da309c851 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java @@ -40,11 +40,11 @@ public class TextureAtlasSpriteWrapper */ public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y) { - #if PRE_MC_1_17_1 + #if MC_1_16 return sprite.mainImage[0].getPixelRGBA( x + sprite.framesX[frameIndex] * sprite.getWidth(), y + sprite.framesY[frameIndex] * sprite.getHeight()); - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 if (sprite.animatedTexture != null) { x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index 7a8a92e6e..ed4cad81a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -50,7 +50,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -167,7 +167,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index 94015d4de..6ff85ee1c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -53,7 +53,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -193,7 +193,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { 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 4f35469ea..c4728dfee 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 @@ -29,7 +29,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.core.Holder; #endif @@ -46,9 +46,9 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if POST_MC_1_18_2 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #else Biome #endif biome) { - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 return biome.value(); #else return biome; @@ -84,7 +84,7 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter } - #if MC_1_17_1 || POST_MC_1_18_2 + #if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20 @Override public int getHeight() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java index c4f4d4438..5aacf7efb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java @@ -30,7 +30,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.core.Holder; #endif @@ -49,9 +49,9 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if POST_MC_1_18_2 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #else Biome #endif biome) { - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 return biome.value(); #else return biome; @@ -116,7 +116,7 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter } - #if MC_1_17_1 || POST_MC_1_18_2 + #if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20 @Override public int getHeight() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java index e078d6685..864be6cd5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; public class ClientBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ClientLevelWrapper level; public ClientBlockDetailMap(ClientLevelWrapper level) { this.level = level; } 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 a14db741f..9f8de4c95 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 @@ -38,7 +38,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FlowerBlock; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RotatedPillarBlock; -#if POST_MC_1_19_2 +#if MC_1_19 || MC_1_20 import net.minecraft.util.RandomSource; #else import java.util.Random; @@ -60,7 +60,7 @@ public class ClientBlockStateCache private static final HashSet BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); private static final HashSet BROKEN_BLOCK_STATES = new HashSet<>(); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public static final Random random = new Random(0); #else public static final RandomSource random = RandomSource.create(); @@ -102,7 +102,7 @@ public class ClientBlockStateCache private static int getWidth(TextureAtlasSprite texture) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 return texture.getWidth(); #else return texture.contents().width(); @@ -111,7 +111,7 @@ public class ClientBlockStateCache private static int getHeight(TextureAtlasSprite texture) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 return texture.getHeight(); #else return texture.contents().height(); @@ -211,7 +211,7 @@ public class ClientBlockStateCache needShade = quads.get(0).isShade(); tintIndex = quads.get(0).getTintIndex(); baseColor = calculateColorFromTexture( - #if PRE_MC_1_17_1 quads.get(0).sprite, + #if MC_1_16 quads.get(0).sprite, #else quads.get(0).getSprite(), #endif ColorMode.getColorMode(blockState.getBlock())); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java index 453761f53..28b69397f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java @@ -29,7 +29,7 @@ import net.minecraft.world.level.block.state.BlockState; public class ServerBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ServerLevelWrapper level; public ServerBlockDetailMap(ServerLevelWrapper level) { this.level = level; } 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 0bbb83552..3c5b2a2d4 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 @@ -47,7 +47,7 @@ import org.apache.logging.log4j.Logger; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.core.QuartPos; #endif @@ -55,19 +55,19 @@ import net.minecraft.core.QuartPos; import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_17_1 +#if MC_1_17 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_18_2 +#if MC_1_18 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_19_2 || MC_1_19_4 +#if MC_1_19 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.core.SectionPos; @@ -145,7 +145,7 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getHeight() { - #if PRE_MC_1_17_1 + #if MC_1_16 return 255; #else return this.chunk.getHeight(); @@ -155,7 +155,7 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getMinBuildHeight() { - #if PRE_MC_1_17_1 + #if MC_1_16 return 0; #else return this.chunk.getMinBuildHeight(); @@ -181,7 +181,7 @@ public class ChunkWrapper implements IChunkWrapper // convert from an index to a block coordinate return this.chunk.getSections()[index].bottomBlockY() * 16; } - #elif MC_1_17_1 + #elif MC_1_17 if (!sections[index].isEmpty()) { // convert from an index to a block coordinate @@ -210,15 +210,15 @@ public class ChunkWrapper implements IChunkWrapper @Override public IBiomeWrapper getBiome(int relX, int relY, int relZ) { - #if PRE_MC_1_17_1 + #if MC_1_16 return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome( relX >> 2, relY >> 2, relZ >> 2), this.wrappedLevel); - #elif PRE_MC_1_18_2 + #elif MC_1_16 || MC_1_17 return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome( QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)), this.wrappedLevel); - #elif PRE_MC_1_18_2 + #elif MC_1_16 || MC_1_17 return BiomeWrapper.getBiomeWrapper(this.chunk.getNoiseBiome( QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)), this.wrappedLevel); @@ -264,7 +264,7 @@ public class ChunkWrapper implements IChunkWrapper } - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 return false; // MC's lighting engine doesn't work consistently enough to trust for 1.16 or 1.17 #else if (this.chunk instanceof LevelChunk) @@ -387,7 +387,7 @@ public class ChunkWrapper implements IChunkWrapper this.blockLightPosList = new ArrayList<>(); - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 this.chunk.getLights().forEach((blockPos) -> { this.blockLightPosList.add(new DhBlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ())); @@ -454,7 +454,7 @@ public class ChunkWrapper implements IChunkWrapper public static void syncedUpdateClientLightStatus() { - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 // TODO: Check what to do in 1.18.1 and older // since we don't currently handle this list, @@ -481,16 +481,16 @@ public class ChunkWrapper implements IChunkWrapper LevelChunk levelChunk = (LevelChunk) this.chunk; ClientChunkCache clientChunkCache = ((ClientLevel) levelChunk.getLevel()).getChunkSource(); this.isMcClientLightingCorrect = clientChunkCache.getChunkForLighting(this.chunk.getPos().x, this.chunk.getPos().z) != null && - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 levelChunk.isLightCorrect(); - #elif PRE_MC_1_20_1 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 levelChunk.isClientLightReady(); #else checkLightSectionsOnChunk(levelChunk, levelChunk.getLevel().getLightEngine()); #endif } } - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine) { LevelChunkSection[] sections = chunk.getSections(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index ac5a98482..1b041665f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -35,7 +35,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -#if PRE_MC_1_20_1 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.GuiComponent; #else @@ -49,7 +49,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.client.resources.language.I18n; // translation -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.client.gui.narration.NarratableEntry; #endif import net.minecraft.resources.ResourceLocation; @@ -379,13 +379,13 @@ public class ClassicConfigGUI } @Override - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if PRE_MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 // 1.20.2 now enables this by default in the `this.list.render` function this.renderBackground(matrices); // Renders background #else super.render(matrices, mouseX, mouseY, delta); @@ -441,7 +441,7 @@ public class ClassicConfigGUI } } } - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 super.render(matrices, mouseX, mouseY, delta); #endif } @@ -539,7 +539,7 @@ public class ClassicConfigGUI public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if PRE_MC_1_20_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); @@ -605,7 +605,7 @@ public class ClassicConfigGUI } @Override - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) #else public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) @@ -627,7 +627,7 @@ public class ClassicConfigGUI indexButton.render(matrices, mouseX, mouseY, tickDelta); } if (text != null && (!text.getString().contains("spacer") || button != null)) - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 GuiComponent.drawString(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF); #else matrices.drawString(textRenderer, text, 12, y + 5, 0xFFFFFF); @@ -642,7 +642,7 @@ public class ClassicConfigGUI // Only for 1.17 and over // Remove in 1.16 and below - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java index fbeb7f4c3..37e1cc0d9 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java @@ -1,7 +1,7 @@ package com.seibel.distanthorizons.common.wrappers.gui; import net.minecraft.client.gui.Font; -#if PRE_MC_1_20_1 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 import com.mojang.blaze3d.vertex.PoseStack; #else import net.minecraft.client.gui.GuiGraphics; @@ -24,14 +24,14 @@ public class DhScreen extends Screen // addButton in 1.16 and below protected Button addBtn(Button button) { - #if PRE_MC_1_17_1 + #if MC_1_16 return this.addButton(button); #else return this.addRenderableWidget(button); #endif } - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 protected void DhDrawCenteredString(PoseStack guiStack, Font font, Component text, int x, int y, int color) { drawCenteredString(guiStack, font, text, x, y, color); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java index 1bd0655a1..86183b3b2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java @@ -5,7 +5,7 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; #endif @@ -17,7 +17,7 @@ public class GuiHelper */ public static Button MakeBtn(Component base, int a, int b, int c, int d, Button.OnPress action) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 return new Button(a, b, c, d, base, action); #else return Button.builder(base, action).bounds(a, b, c, d).build(); @@ -26,7 +26,7 @@ public class GuiHelper public static MutableComponent TextOrLiteral(String text) { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 return new TextComponent(text); #else return Component.literal(text); @@ -35,7 +35,7 @@ public class GuiHelper public static MutableComponent TextOrTranslatable(String text) { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 return new TextComponent(text); #else return Component.translatable(text); @@ -44,7 +44,7 @@ public class GuiHelper public static MutableComponent Translatable(String text, Object... args) { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 return new TranslatableComponent(text, args); #else return Component.translatable(text, args); @@ -53,7 +53,7 @@ public class GuiHelper public static void SetX(AbstractWidget w, int x) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 w.x = x; #else w.setX(x); @@ -62,7 +62,7 @@ public class GuiHelper public static void SetY(AbstractWidget w, int y) { - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 w.y = y; #else w.setY(y); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index aaa804181..572d4ef1d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.config.gui.AbstractScreen; import net.minecraft.client.Minecraft; -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 import net.minecraft.client.gui.GuiGraphics; #endif import net.minecraft.client.gui.components.ContainerObjectSelectionList; @@ -28,7 +28,7 @@ public class MinecraftScreen private AbstractScreen screen; - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public static net.minecraft.network.chat.TranslatableComponent translate(String str, Object... args) { return new net.minecraft.network.chat.TranslatableComponent(str, args); @@ -66,13 +66,13 @@ public class MinecraftScreen } @Override - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background @@ -133,7 +133,7 @@ public class MinecraftScreen { public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if PRE_MC_1_20_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java index 866ef61c7..037034280 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java @@ -34,17 +34,18 @@ import net.minecraft.client.gui.components.ImageButton; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.client.renderer.GameRenderer; #endif -#if PRE_MC_1_20_1 + +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; #else import net.minecraft.client.gui.GuiGraphics; #endif -#if PRE_MC_1_20_2 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 public class TexturedButtonWidget extends ImageButton #else public class TexturedButtonWidget extends Button @@ -52,7 +53,7 @@ public class TexturedButtonWidget extends Button { public final boolean renderBackground; - #if POST_MC_1_20_2 + #if MC_1_20_2 || MC_1_20_4 private final int u; private final int v; private final int hoveredVOffset; @@ -69,7 +70,7 @@ public class TexturedButtonWidget extends Button } public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, Component text, boolean renderBackground) { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text); #else // We don't pass on the text option as otherwise it will render (we normally pass it for narration) @@ -89,13 +90,13 @@ public class TexturedButtonWidget extends Button this.renderBackground = renderBackground; } - #if PRE_MC_1_20_2 - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Override public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { if (this.renderBackground) // Renders the background of the button { - #if PRE_MC_1_17_1 + #if MC_1_16 Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION); RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha); #else @@ -108,7 +109,7 @@ public class TexturedButtonWidget extends Button RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableDepthTest(); - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height); this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); #else @@ -120,7 +121,7 @@ public class TexturedButtonWidget extends Button super.renderButton(matrices, mouseX, mouseY, delta); } #else - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 @Override public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta) { @@ -138,7 +139,7 @@ public class TexturedButtonWidget extends Button if (!this.active) i = 0; else if (this.isHovered) i = 2; - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableDepthTest(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index 0b3b493db..be2c549a9 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -15,11 +15,11 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.client.gui.narration.NarratableEntry; #endif -#if PRE_MC_1_20_1 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 import net.minecraft.client.gui.GuiComponent; #else import net.minecraft.client.gui.GuiGraphics; @@ -144,13 +144,13 @@ public class ChangelogScreen extends DhScreen } @Override - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background @@ -161,7 +161,7 @@ public class ChangelogScreen extends DhScreen // Set the scroll position to the mouse height relative to the screen // This is a bit of a hack as we cannot scroll on this area double scrollAmount = ((double) mouseY) / ((double) this.height) * 1.1 * this.changelogArea.getMaxScroll(); - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 this.changelogArea.setScrollAmount(scrollAmount); #else this.changelogArea.scrollAmount = scrollAmount; @@ -187,7 +187,7 @@ public class ChangelogScreen extends DhScreen public TextArea(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if PRE_MC_1_20_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); @@ -225,7 +225,7 @@ public class ChangelogScreen extends DhScreen return new ButtonEntry(text); } - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 @Override public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { @@ -244,7 +244,7 @@ public class ChangelogScreen extends DhScreen { return children; } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 5addfc306..a03323457 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -11,7 +11,7 @@ import com.seibel.distanthorizons.core.jar.JarUtils; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import net.minecraft.client.Minecraft; -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 import net.minecraft.client.gui.GuiGraphics; #else import com.mojang.blaze3d.vertex.PoseStack; @@ -146,13 +146,13 @@ public class UpdateModScreen extends DhScreen } @Override - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index 208387960..4fc7d68e8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -47,7 +47,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.network.chat.TextComponent; #endif import net.minecraft.server.level.ServerLevel; @@ -197,7 +197,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra @Override public DhChunkPos getPlayerChunkPos() { - #if PRE_MC_1_17_1 + #if MC_1_16 ChunkPos playerPos = new ChunkPos(getPlayer().blockPosition()); #else ChunkPos playerPos = getPlayer().chunkPosition(); @@ -262,7 +262,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra { LocalPlayer p = getPlayer(); if (p == null) return; - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 p.sendMessage(new TextComponent(string), getPlayer().getUUID()); #else p.sendSystemMessage(net.minecraft.network.chat.Component.translatable(string)); @@ -282,7 +282,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra { LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception); CrashReport report = new CrashReport(errorMessage, exception); - #if PRE_MC_1_20_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 Minecraft.crash(report); #else Minecraft.getInstance().delayCrash(report); 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 6a05e158f..0131998fc 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 @@ -39,12 +39,12 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.render.DhApiRenderProxy; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; -#if PRE_MC_1_19_4 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 import com.mojang.math.Vector3f; #else import org.joml.Vector3f; #endif -#if POST_MC_1_20_2 +#if MC_1_20_2 || MC_1_20_4 import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; #endif @@ -67,7 +67,7 @@ import net.minecraft.client.renderer.FogRenderer; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.effect.MobEffects; -#if PRE_MC_1_17_1 +#if MC_1_16 import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.FluidState; @@ -133,7 +133,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper public boolean playerHasBlindingEffect() { return MC.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null - #if POST_AND_MC_1_19_2 + #if MC_1_19 || MC_1_20 || MC.player.getActiveEffectsMap().get(MobEffects.DARKNESS) != null // Deep dark effect #endif ; @@ -151,7 +151,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public Mat4f getDefaultProjectionMatrix(float partialTicks) { - #if PRE_MC_1_17_1 + #if MC_1_16 return McObjectConverter.Convert(Minecraft.getInstance().gameRenderer.getProjectionMatrix(Minecraft.getInstance().gameRenderer.getMainCamera(), partialTicks, true)); #else return McObjectConverter.Convert(MC.gameRenderer.getProjectionMatrix(MC.gameRenderer.getFov(MC.gameRenderer.getMainCamera(), partialTicks, true))); @@ -161,7 +161,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public double getGamma() { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 return MC.options.gamma; #else return MC.options.gamma().get(); @@ -171,7 +171,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public Color getFogColor(float partialTicks) { - #if PRE_MC_1_17_1 + #if MC_1_16 float[] colorValues = new float[4]; GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues); #else @@ -192,7 +192,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { if (MC.level.dimensionType().hasSkyLight()) { - #if PRE_MC_1_17_1 + #if MC_1_16 Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime()); #else Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime()); @@ -213,7 +213,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public int getRenderDistance() { - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 //FIXME: How to resolve this? return MC.options.renderDistance; #else @@ -321,15 +321,15 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { try { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 LevelRenderer levelRenderer = MC.levelRenderer; Collection chunks = - #if PRE_MC_1_18_2 levelRenderer.renderChunks; + #if MC_1_16 || MC_1_17 levelRenderer.renderChunks; #else levelRenderer.renderChunkStorage.get().renderChunks; #endif return (chunks.stream().map((chunk) -> { AABB chunkBoundingBox = - #if PRE_MC_1_18_2 chunk.chunk.bb; + #if MC_1_16 || MC_1_17 chunk.chunk.bb; #else chunk.chunk.getBoundingBox(); #endif return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), Math.floorDiv((int) chunkBoundingBox.minZ, 16)); @@ -371,7 +371,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public boolean isFogStateSpecial() { - #if PRE_MC_1_17_1 + #if MC_1_16 Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera(); FluidState fluidState = camera.getFluidInCamera(); Entity entity = camera.getEntity(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java index b327c32a4..eb70a535b 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java @@ -33,7 +33,7 @@ public class ServerPlayerWrapper implements IServerPlayerWrapper public IServerLevelWrapper getLevel() { - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 return ServerLevelWrapper.getWrapper(this.serverPlayer.getLevel()); #else return ServerLevelWrapper.getWrapper(this.serverPlayer.serverLevel()); 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 08ffe1656..78138d85b 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 @@ -136,7 +136,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper @Override public int getMinHeight() { - #if PRE_MC_1_17_1 + #if MC_1_16 return 0; #else return this.level.getMinBuildHeight(); 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 b6fea22b8..28d7c6281 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 @@ -130,7 +130,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper @Override public int getMinHeight() { - #if PRE_MC_1_17_1 + #if MC_1_16 return 0; #else return level.getMinBuildHeight(); 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 8d238f508..b0549a495 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 @@ -56,7 +56,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStruc import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStructureStart; import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepSurface; -#if POST_MC_1_19_4 +#if MC_1_19_4 || MC_1_20 import net.minecraft.core.registries.Registries; #else import net.minecraft.core.Registry; @@ -365,9 +365,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv private static ProtoChunk EmptyChunk(ServerLevel level, ChunkPos chunkPos) { return new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if POST_MC_1_17_1 , level #endif - #if POST_MC_1_18_2 , level.registryAccess().registryOrThrow( - #if PRE_MC_1_19_4 + #if MC_1_18 || MC_1_19 || MC_1_20 , level #endif + #if MC_1_18 || MC_1_19 || MC_1_20 , level.registryAccess().registryOrThrow( + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 Registry.BIOME_REGISTRY #else Registries.BIOME @@ -463,8 +463,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv if (target == null) { target = new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if POST_MC_1_17_1 , params.level #endif - #if POST_MC_1_18_2 , params.biomes, null #endif + #if MC_1_18 || MC_1_19 || MC_1_20 , params.level #endif + #if MC_1_18 || MC_1_19 || MC_1_20 , params.biomes, null #endif ); } return target; @@ -507,7 +507,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv ChunkAccess target = wrappedChunk.getChunk(); if (target instanceof LevelChunk) { - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 ((LevelChunk) target).setLoaded(true); #else ((LevelChunk) target).loaded = true; @@ -520,7 +520,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk; - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 boolean isPartial = target.isOldNoiseGeneration(); #endif if (isFull) @@ -528,7 +528,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv LOAD_LOGGER.info("Detected full existing chunk at {}", target.getPos()); genEvent.resultConsumer.accept(wrappedChunk); } - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 else if (isPartial) { LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java index aafc01bb3..d3240b09a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java @@ -31,16 +31,16 @@ import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.chunk.ChunkGenerator; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.chunk.storage.ChunkScanAccess; #endif import net.minecraft.world.level.levelgen.WorldGenSettings; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; #else import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import net.minecraft.world.level.levelgen.RandomState; -#if POST_MC_1_19_4 +#if MC_1_19_4 || MC_1_20 import net.minecraft.world.level.levelgen.WorldOptions; import net.minecraft.core.registries.Registries; #endif @@ -50,13 +50,13 @@ import net.minecraft.world.level.storage.WorldData; public final class GlobalParameters { public final ChunkGenerator generator; - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public final StructureManager structures; #else public final StructureTemplateManager structures; public final RandomState randomState; #endif - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 public final WorldGenSettings worldGenSettings; #else public final WorldOptions worldOptions; @@ -67,7 +67,7 @@ public final class GlobalParameters public final RegistryAccess registry; public final long worldSeed; public final DataFixer fixerUpper; - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 public final BiomeManager biomeManager; public final ChunkScanAccess chunkScanner; // FIXME: Figure out if this is actually needed #endif @@ -81,7 +81,7 @@ public final class GlobalParameters WorldData worldData = server.getWorldData(); registry = server.registryAccess(); - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 worldGenSettings = worldData.worldGenSettings(); biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY); worldSeed = worldGenSettings.seed(); @@ -90,14 +90,14 @@ public final class GlobalParameters biomes = registry.registryOrThrow(Registries.BIOME); worldSeed = worldOptions.seed(); #endif - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed)); chunkScanner = level.getChunkSource().chunkScanner(); #endif structures = server.getStructureManager(); generator = level.getChunkSource().getGenerator(); fixerUpper = server.getFixerUpper(); - #if POST_MC_1_19_2 + #if MC_1_19 || MC_1_20 randomState = level.getChunkSource().randomState(); #endif } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java index d5e391be5..3b6bb23d5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java @@ -25,7 +25,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.Wo import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.WorldGenLevel; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif @@ -35,7 +35,7 @@ public final class ThreadedParameters final ServerLevel level; public WorldGenStructFeatManager structFeat = null; - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 public StructureCheck structCheck; #endif boolean isValid = true; @@ -63,9 +63,9 @@ public final class ThreadedParameters previousGlobalParameters = param; this.level = param.level; - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 this.structFeat = new WorldGenStructFeatManager(param.worldGenSettings, level); - #elif PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 this.structCheck = this.createStructureCheck(param); #else this.structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures, @@ -80,15 +80,15 @@ public final class ThreadedParameters public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param) { - #if PRE_MC_1_19_4 - structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if POST_MC_1_18_2 , structCheck #endif ); + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , structCheck #endif ); #else structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck); #endif } - #if POST_MC_1_18_2 && PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public void recreateStructureCheck() { if (previousGlobalParameters != null) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index dda02fa40..9986c402c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -37,7 +37,7 @@ import java.util.Objects; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; -#if POST_MC_1_19_4 +#if MC_1_19_4 || MC_1_20 import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; #endif @@ -55,24 +55,24 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.*; import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.minecraft.world.level.levelgen.Heightmap; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.levelgen.blending.BlendingData; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.world.level.levelgen.feature.StructureFeature; #endif import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.ticks.LevelChunkTicks; #endif -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.core.Holder; import net.minecraft.core.RegistryAccess; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; #endif #endif -#if MC_1_16_5 || MC_1_17_1 +#if MC_1_16_5 || MC_1_17 import net.minecraft.world.level.material.Fluids; #endif @@ -81,9 +81,9 @@ import net.minecraft.world.level.material.Fluid; public class ChunkLoader { - #if POST_MC_1_19_2 + #if MC_1_19 || MC_1_20 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); - #elif POST_MC_1_18_2 + #elif MC_1_18 || MC_1_19 || MC_1_20 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); #endif private static final String TAG_UPGRADE_DATA = "UpgradeData"; @@ -93,7 +93,7 @@ public class ChunkLoader private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks"; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER; - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 private static BlendingData readBlendingData(CompoundTag chunkData) { BlendingData blendingData = null; @@ -109,16 +109,16 @@ public class ChunkLoader private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData) { - #if POST_MC_1_18_2 - #if PRE_MC_1_19_4 + #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); #else Registry biomes = level.registryAccess().registryOrThrow(Registries.BIOME); #endif - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 Codec> biomeCodec = PalettedContainer.codec( biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); - #elif PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 Codec>> biomeCodec = PalettedContainer.codec( biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); #else @@ -126,7 +126,7 @@ public class ChunkLoader biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); #endif #endif - int i = #if PRE_MC_1_17_1 16; #else level.getSectionsCount(); #endif + int i = #if MC_1_16 16; #else level.getSectionsCount(); #endif LevelChunkSection[] chunkSections = new LevelChunkSection[i]; boolean isLightOn = chunkData.getBoolean("isLightOn"); @@ -139,7 +139,7 @@ public class ChunkLoader CompoundTag tagSection = tagSections.getCompound(j); int sectionYPos = tagSection.getByte("Y"); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12)) { LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4); @@ -147,7 +147,7 @@ public class ChunkLoader tagSection.getLongArray("BlockStates")); levelChunkSection.recalcBlockCounts(); if (!levelChunkSection.isEmpty()) - chunkSections[#if PRE_MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] + chunkSections[#if MC_1_16 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] = levelChunkSection; } #else @@ -155,7 +155,7 @@ public class ChunkLoader if (sectionId >= 0 && sectionId < chunkSections.length) { PalettedContainer blockStateContainer; - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 PalettedContainer biomeContainer; #else PalettedContainer> biomeContainer; @@ -165,7 +165,7 @@ public class ChunkLoader ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 biomeContainer = tagSection.contains("biomes", 10) ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); @@ -174,7 +174,7 @@ public class ChunkLoader ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error) : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); #endif - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); #else chunkSections[sectionId] = new LevelChunkSection(blockStateContainer, biomeContainer); @@ -223,7 +223,7 @@ public class ChunkLoader public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) { - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 CompoundTag tagLevel = chunkData.getCompound("Level"); #else CompoundTag tagLevel = chunkData; @@ -237,12 +237,12 @@ public class ChunkLoader } ChunkStatus.ChunkType chunkType = readChunkType(tagLevel); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK) return null; #else BlendingData blendingData = readBlendingData(tagLevel); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise())) return null; #else @@ -255,27 +255,27 @@ public class ChunkLoader //================== Read params for making the LevelChunk ================== UpgradeData upgradeData = tagLevel.contains(TAG_UPGRADE_DATA, 10) - ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if POST_MC_1_17_1 , level #endif ) + ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ) : UpgradeData.EMPTY; boolean isLightOn = tagLevel.getBoolean("isLightOn"); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer( - level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if POST_MC_1_17_1 , level #endif , + level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif , chunkPos, level.getLevel().getChunkSource().getGenerator().getBiomeSource(), tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null); TickList blockTicks = tagLevel.contains(BLOCK_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(BLOCK_TICKS_TAG_PRE18, 10), Registry.BLOCK::getKey, Registry.BLOCK::get) : new ProtoTickList(block -> (block == null || block.defaultBlockState().isAir()), chunkPos, - tagLevel.getList("ToBeTicked", 9)#if POST_MC_1_17_1 , level #endif ); + tagLevel.getList("ToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ); TickList fluidTicks = tagLevel.contains(FLUID_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(FLUID_TICKS_TAG_PRE18, 10), Registry.FLUID::getKey, Registry.FLUID::get) : new ProtoTickList(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos, - tagLevel.getList("LiquidsToBeTicked", 9)#if POST_MC_1_17_1 , level #endif ); + tagLevel.getList("LiquidsToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ); #else - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 LevelChunkTicks blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10), string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos); LevelChunkTicks fluidTicks = LevelChunkTicks.load(tagLevel.getList(FLUID_TICKS_TAG_18, 10), @@ -291,7 +291,7 @@ public class ChunkLoader LevelChunkSection[] levelChunkSections = readSections(level, chunkPos, tagLevel); // ====================== Make the chunk ========================= - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 LevelChunk chunk = new LevelChunk((Level) level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks, fluidTicks, inhabitedTime, levelChunkSections, null); #else 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 34a27482d..b384ca2bb 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 @@ -41,7 +41,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ColorResolver; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.LevelHeightAccessor; #endif import net.minecraft.world.level.LightLayer; @@ -73,11 +73,11 @@ public class DhLitWorldGenRegion extends WorldGenRegion */ ReentrantLock getChunkLock = new ReentrantLock(); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 private ChunkPos overrideCenterPos = null; public void setOverrideCenter(ChunkPos pos) { overrideCenterPos = pos; } - #if PRE_MC_1_17_1 + #if MC_1_16 @Override public int getCenterX() { @@ -104,7 +104,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion List chunkList, ChunkStatus chunkStatus, int writeRadius, BatchGenerationEnvironment.EmptyChunkGenerator generator) { - super(serverLevel, chunkList #if POST_MC_1_17_1 , chunkStatus, writeRadius #endif ); + super(serverLevel, chunkList #if MC_1_18 || MC_1_19 || MC_1_20 , chunkStatus, writeRadius #endif ); this.firstPos = chunkList.get(0).getPos(); this.generator = generator; this.lightEngine = lightEngine; @@ -115,7 +115,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 // Bypass BCLib mixin overrides. @Override public boolean ensureCanWrite(BlockPos blockPos) @@ -130,7 +130,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion { return false; } - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 if (center.isUpgrading()) { LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration(); @@ -185,7 +185,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion BlockState blockState = this.getBlockState(blockPos); // This is a bypass for the spawner block since MC complains about not having it - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 if (blockState.getBlock() instanceof SpawnerBlock) { return ((EntityBlock) blockState.getBlock()).newBlockEntity(blockPos, blockState); @@ -269,7 +269,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl); if (chunk instanceof LevelChunk) { - chunk = new ImposterProtoChunk((LevelChunk) chunk #if POST_MC_1_18_2 , true #endif ); + chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_1_18 || MC_1_19 || MC_1_20 , true #endif ); } return chunk; } @@ -331,7 +331,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion private Biome _getBiome(BlockPos pos) { - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 return getBiome(pos).value(); #else return getBiome(pos); @@ -340,7 +340,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver) { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 int i = (Minecraft.getInstance()).options.biomeBlendRadius; #else int i = (Minecraft.getInstance()).options.biomeBlendRadius().get(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java index 106af9f4a..ad6334ece 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java @@ -39,7 +39,7 @@ public class DummyLightEngine extends LevelLightEngine } - #if PRE_MC_1_20_1 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 @Override public void onBlockEmissionIncrease(BlockPos blockPos, int i) { } @@ -63,7 +63,7 @@ public class DummyLightEngine extends LevelLightEngine #endif @Override - public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if PRE_MC_1_20_1 , boolean bl #endif ) { } + public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 , boolean bl #endif ) { } @Override public void checkBlock(BlockPos blockPos) { } @@ -87,7 +87,7 @@ public class DummyLightEngine extends LevelLightEngine @Override public void retainData(ChunkPos chunkPos, boolean bl) { } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public int getLightSectionCount() { throw new UnsupportedOperationException("This should never be used!"); } @Override 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 b18b8f41b..91add021d 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,12 +23,12 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor; import net.minecraft.world.level.BlockGetter; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.LevelHeightAccessor; #endif import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LightChunkGetter; -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 import net.minecraft.world.level.chunk.LightChunk; #endif @@ -50,7 +50,7 @@ public class LightGetterAdaptor implements LightChunkGetter } @Override - public #if PRE_MC_1_20_1 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ) + public #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ) { if (genRegion == null) throw new IllegalStateException("World Gen region has not been set!"); @@ -64,7 +64,7 @@ public class LightGetterAdaptor implements LightChunkGetter return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter); } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 public LevelHeightAccessor getLevelHeightAccessor() { return heightGetter; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index 94fc0a2c3..761241c68 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -70,7 +70,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable { this.getRegionFileLock.lock(); - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 rFile = this.storage.getRegionFile(pos); // keeping the region cache size low helps prevent concurrency issues @@ -90,7 +90,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable } catch (ArrayIndexOutOfBoundsException e) { - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 // the file just wasn't cached break; #else @@ -145,7 +145,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable // Otherwise, check if file exist, and if so, add it to the cache Path storageFolderPath; - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 storageFolderPath = this.storage.folder.toPath(); #else storageFolderPath = this.storage.folder; @@ -157,7 +157,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable } Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca"); - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false); #else rFile = new RegionFile(regionFilePath, storageFolderPath, false); 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 79259fd36..096e1ad84 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 @@ -37,49 +37,49 @@ 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 PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.StructureFeatureManager; #else -#if POST_MC_1_19_4 +#if MC_1_19_4 || MC_1_20 import net.minecraft.world.level.levelgen.WorldOptions; #endif import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.StructureManager; #endif -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif import net.minecraft.world.level.levelgen.structure.StructureStart; -#if PRE_MC_1_18_2 +#if MC_1_16 || MC_1_17 import net.minecraft.world.level.levelgen.feature.StructureFeature; #endif -public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatureManager #else StructureManager #endif +public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 StructureFeatureManager #else StructureManager #endif { final WorldGenLevel genLevel; - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 WorldGenSettings worldGenSettings; #else WorldOptions worldOptions; #endif - #if POST_MC_1_18_2 + #if MC_1_18 || MC_1_19 || MC_1_20 StructureCheck structureCheck; #endif - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 public WorldGenStructFeatManager( WorldGenSettings worldGenSettings, - WorldGenLevel genLevel #if POST_MC_1_18_2 , StructureCheck structureCheck #endif ) + WorldGenLevel genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , StructureCheck structureCheck #endif ) { - super(genLevel, worldGenSettings #if POST_MC_1_18_2 , structureCheck #endif ); + super(genLevel, worldGenSettings #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif ); this.genLevel = genLevel; this.worldGenSettings = worldGenSettings; } @@ -100,8 +100,8 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur { if (worldGenRegion == genLevel) return this; - #if PRE_MC_1_19_4 - return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if POST_MC_1_18_2 , structureCheck #endif ); + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif ); #else return new WorldGenStructFeatManager(worldOptions, worldGenRegion, structureCheck); #endif @@ -113,7 +113,7 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur return genLevel.getChunk(x, z, status, false); } - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 @Override public Stream> startsForFeature( SectionPos sectionPos2, @@ -165,7 +165,7 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur return builder.build(); } #else - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 @Override public List startsForFeature(SectionPos sectionPos, Predicate> predicate) { 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 0ea6286a2..7d3571264 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,12 +27,12 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 #endif import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.levelgen.blending.Blender; #endif @@ -65,12 +65,12 @@ public final class StepBiomes for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepBiomes: "+chunk.getPos()); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 environment.params.generator.createBiomes(environment.params.biomes, chunk); - #elif PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else 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 8f2b94fb8..7d36c5038 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 @@ -32,7 +32,7 @@ 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 POST_MC_1_18_2 +#if MC_1_19 || MC_1_20 #endif public final class StepFeatures @@ -65,7 +65,7 @@ public final class StepFeatures { try { - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 worldGenRegion.setOverrideCenter(chunk.getPos()); environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat); #else 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 f2670d97a..a520c7015 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,14 +28,14 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException; import net.minecraft.server.level.WorldGenRegion; -#if POST_MC_1_17_1 +#if MC_1_18 || MC_1_19 || MC_1_20 #endif -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 #endif import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ProtoChunk; -#if POST_MC_1_18_2 +#if MC_1_18 || MC_1_19 || MC_1_20 import net.minecraft.world.level.levelgen.blending.Blender; #endif @@ -69,12 +69,12 @@ public final class StepNoise for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepNoise: "+chunk.getPos()); - #if PRE_MC_1_17_1 + #if MC_1_16 environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk); - #elif PRE_MC_1_18_2 + #elif MC_1_16 || MC_1_17 chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); - #elif PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else 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 e9bc14cfb..1320280f5 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,7 +27,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 #endif import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; 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 b4d76c08d..e8a18e566 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 @@ -77,10 +77,10 @@ public final class StepStructureStart } } - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 if (environment.params.worldGenSettings.generateFeatures()) { - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 if (environment.params.worldGenSettings.generateStructures()) { #else if (environment.params.worldOptions.generateStructures()) @@ -98,10 +98,10 @@ public final class StepStructureStart // and should prevent some concurrency issues STRUCTURE_PLACEMENT_LOCK.lock(); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures, environment.params.worldSeed); - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 environment.params.generator.createStructures(environment.params.registry, environment.params.randomState, tParams.structFeat, chunk, environment.params.structures, environment.params.worldSeed); #else @@ -110,7 +110,7 @@ public final class StepStructureStart tParams.structFeat, chunk, environment.params.structures); #endif - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 try { tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts()); 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 39c4a6e8d..a50adc7a4 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 @@ -61,9 +61,9 @@ public final class StepSurface for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepSurface: "+chunk.getPos()); - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 environment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk); - #elif PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk); #else environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), environment.params.randomState, chunk); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 6eb5f15e4..9f23e8596 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -205,7 +205,7 @@ public class FabricClientProxy #if MC_1_16_5 SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray)); #else renderContext.projectionMatrix().set(matrixFloatArray); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 5941f54c9..c43b73d85 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -59,7 +59,7 @@ public class FabricMain if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 #endif @@ -118,7 +118,7 @@ public class FabricMain ModAccessorInjector.INSTANCE.bind(IBCLibAccessor.class, new BCLibAccessor()); } - #if MC_1_16_5 || MC_1_18_2 || MC_1_19_2 || MC_1_19_4 || MC_1_20_1 + #if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1 // 1.17.1 won't support this since there isn't a matching Iris version if (modChecker.isModLoaded("iris")) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java index 4343c34a7..a617a6faa 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java @@ -24,7 +24,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.api.internal.SharedApi; import net.minecraft.client.multiplayer.ClientLevel; -#if POST_MC_1_18_2 +#if MC_1_19 || MC_1_20 #endif import net.minecraft.world.level.chunk.LevelChunk; import org.spongepowered.asm.mixin.Mixin; @@ -44,14 +44,14 @@ public class MixinClientLevel // //Moved to MixinClientPacketListener // @Inject(method = "", at = @At("TAIL")) // private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, -// #if POST_MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i, -// #if POST_MC_1_18_2 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) +// #if MC_1_19 || MC_1_20 Holder holder, #else DimensionType dimensionType, #endif int i, +// #if MC_1_19 || MC_1_20 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) // { // ClientApi.INSTANCE.clientLevelLoadEvent(WorldWrapper.getWorldWrapper((ClientLevel)(Object)this)); // } // Moved to overriding the enableChunkLight(...) method over at ClientPacketListener for 1.20+ - #if POST_MC_1_18_2 && PRE_MC_1_20_1 // Only the setLightReady is only available after 1.18. This ensures the light data is ready. + #if (MC_1_19 || MC_1_20) && (MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19) // Only the setLightReady is only available after 1.18. This ensures the light data is ready. @Inject(method = "setLightReady", at = @At("HEAD")) private void onChunkLightReady(int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java index b290d6aad..d86208188 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.world.level.chunk.LevelChunk; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; @@ -31,7 +31,7 @@ public class MixinClientPacketListener @Inject(method = "handleRespawn", at = @At("RETURN")) void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); } - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(method = "cleanup", at = @At("HEAD")) #else @Inject(method = "close", at = @At("HEAD")) @@ -45,7 +45,7 @@ public class MixinClientPacketListener ClientApi.INSTANCE.onClientOnlyDisconnected(); } - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 @Inject(method = "enableChunkLight", at = @At("TAIL")) void onEnableChunkLight(LevelChunk chunk, int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java index ead892c02..d01145bf5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java @@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; -#if PRE_MC_1_17_1 +#if MC_1_16 import net.minecraft.world.level.material.FluidState; #else import net.minecraft.world.level.material.FogType; @@ -50,14 +50,14 @@ public class MixinFogRenderer private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F; @Inject(at = @At("RETURN"), method = "setupFog") - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) { #else private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float g, CallbackInfo callback) { #endif - #if PRE_MC_1_17_1 + #if MC_1_16 FluidState fluidState = camera.getFluidInCamera(); boolean cameraNotInFluid = fluidState.isEmpty(); #else @@ -71,7 +71,7 @@ public class MixinFogRenderer && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial() && Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get()) { - #if PRE_MC_1_17_1 + #if MC_1_16 RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE); RenderSystem.fogEnd(A_EVEN_LARGER_VALUE); #else diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java index 27b97fe65..5da0b369e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 5c687cd4e..8422bebf4 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.fabric.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; -#if PRE_MC_1_19_4 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; @@ -67,7 +67,7 @@ public class MixinLevelRenderer // Inject rendering at first call to renderChunkLayer // HEAD or RETURN - #if PRE_MC_1_17_1 + #if MC_1_16 @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) { @@ -84,17 +84,17 @@ public class MixinLevelRenderer } #endif - #if PRE_MC_1_17_1 + #if MC_1_16 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #elif PRE_MC_1_20_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) @@ -113,10 +113,10 @@ public class MixinLevelRenderer } } - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) - #elif PRE_MC_1_20_1 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 92d79850a..8c4a32972 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -25,7 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 #if MC_1_20_1 @Redirect( method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if POST_MC_1_20_2 + #if MC_1_20_4 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 7fbb823a1..5df2f3cf8 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; @@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) - this. #if PRE_MC_1_17_1 addButton #else addRenderableWidget #endif + this. #if MC_1_16 addButton #else addRenderableWidget #endif (new TexturedButtonWidget( // Where the button is on the screen this.width / 2 - 180, this.height / 6 - 12, @@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen // For now it goes to the client option by default (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the utton - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 new TranslatableComponent(ModInfo.ID + ".title"))); #else Component.translatable(ModInfo.ID + ".title"))); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java index a475b61a6..765b8deac 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java @@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.Mixin; @Deprecated // TODO: Not sure if this is needed anymore public class MixinServerLevel { -// #if PRE_MC_1_17_1 +// #if MC_1_16 // @Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V", shift = At.Shift.AFTER)) // private void saveWorldEvent(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) { // Main.client_proxy.worldSaveEvent(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java index bb9741d58..6b4c4d2a4 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java @@ -2,7 +2,7 @@ package com.seibel.distanthorizons.fabric.mixins.mods.sodium; /* Removed since DH now uses Indium so we can use the Fabric rendering API instead -#if POST_MC_1_20_1 +#if MC_1_20_2 || MC_1_20_4 // Sodium 0.5 import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.api.internal.ClientApi; @@ -55,7 +55,7 @@ public class MixinSodiumRenderer } -#elif POST_MC_1_17_1 +#elif MC_1_18 || MC_1_19 || MC_1_20 // Sodium 0.3 to 0.4 import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java index e0d28ec86..fce9efd57 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; -#if PRE_MC_1_18_2 +#if MC_1_16 || MC_1_17 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java index 90033b89a..1e9711597 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java @@ -37,7 +37,7 @@ public class MixinChunkMap // MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks) // this logic should prevent that from happening - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect()) { return; @@ -55,7 +55,7 @@ public class MixinChunkMap //==================// // some chunks may be missing their biomes, which cause issues when attempting to save them - #if MC_1_16_5 || MC_1_17_1 + #if MC_1_16_5 || MC_1_17 if (chunk.getBiomes() == null) { return; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java index 6e58f36af..fe6b7b4c8 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index b6027388f..63f2e345e 100644 --- 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 @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; //FIXME: Is this still needed? -#if POST_MC_1_18_2 +#if MC_1_19 || MC_1_20 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index a12f1f0a4..3d7ddf888 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -1,8 +1,8 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor; -#if MC_1_16_5 || MC_1_17_1 || MC_1_20_4 // These versions either don't have BCLib, or the implementation is different -#elif MC_1_18_2 +#if MC_1_16_5 || MC_1_17 || MC_1_20_4 // These versions either don't have BCLib, or the implementation is different +#elif MC_1_18 import ru.bclib.config.ClientConfig; import ru.bclib.config.Configs; #else @@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor public void setRenderCustomFog(boolean newValue) { - #if !(MC_1_16_5 || MC_1_17_1 || MC_1_20_4) // These versions either don't have BCLib, or the implementation is different + #if !(MC_1_16_5 || MC_1_17 || MC_1_20_4) // These versions either don't have BCLib, or the implementation is different // Change the value of CUSTOM_FOG_RENDERING in the bclib client config // This disabled fog from rendering within bclib diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java index 37fe1b2a0..d08de388b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; -#if MC_1_16_5 || MC_1_18_2 || MC_1_19_2 || MC_1_19_4 || MC_1_20_1 +#if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1 import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; import net.coderbot.iris.Iris; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java index 72289277a..cd340c2e5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java @@ -33,7 +33,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAcce import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; import net.minecraft.client.Minecraft; -#if PRE_MC_1_17_1 +#if MC_1_16 import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.world.entity.Entity; @@ -60,21 +60,21 @@ public class SodiumAccessor implements ISodiumAccessor return "Sodium-Fabric"; } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Override public HashSet getNormalRenderedChunks() { SodiumWorldRenderer renderer = SodiumWorldRenderer.instance(); LevelHeightAccessor height = Minecraft.getInstance().level; - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 // TODO: This is just a tmp solution, use a proper solution later return MC_RENDER.getMaximumRenderedChunks().stream().filter((DhChunkPos chunk) -> { return (renderer.isBoxVisible( chunk.getMinBlockX() + 1, height.getMinBuildHeight() + 1, chunk.getMinBlockZ() + 1, chunk.getMinBlockX() + 15, height.getMaxBuildHeight() - 1, chunk.getMinBlockZ() + 15)); }).collect(Collectors.toCollection(HashSet::new)); - #elif POST_MC_1_18_2 + #elif MC_1_19 || MC_1_20 // 0b11 = Lighted chunk & loaded chunk return renderer.getChunkTracker().getChunks(0b00).filter( (long l) -> { @@ -134,7 +134,7 @@ public class SodiumAccessor implements ISodiumAccessor @Override public void setFogOcclusion(boolean b) { - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 me.jellysquid.mods.sodium.client.SodiumClientMod.options().performance.useFogOcclusion = b; #endif } 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 c96b8ce10..302475759 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -36,7 +36,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.world.level.LevelAccessor; import net.minecraft.client.multiplayer.ClientLevel; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; #else @@ -44,7 +44,7 @@ import net.minecraftforge.event.level.ChunkEvent; import net.minecraftforge.event.level.LevelEvent; #endif -#if POST_MC_1_18_2 +#if MC_1_19 || MC_1_20 import net.minecraftforge.client.event.RenderLevelStageEvent; #endif import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -79,7 +79,7 @@ public class ForgeClientProxy // private static SimpleChannel multiversePluginChannel; - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } #else private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -107,7 +107,7 @@ public class ForgeClientProxy //==============// @SubscribeEvent - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public void clientLevelLoadEvent(WorldEvent.Load event) #else public void clientLevelLoadEvent(LevelEvent.Load event) @@ -115,7 +115,7 @@ public class ForgeClientProxy { LOGGER.info("level load"); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -131,7 +131,7 @@ public class ForgeClientProxy ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper); } @SubscribeEvent - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public void clientLevelUnloadEvent(WorldEvent.Unload event) #else public void clientLevelUnloadEvent(LevelEvent.Load event) @@ -139,7 +139,7 @@ public class ForgeClientProxy { LOGGER.info("level unload"); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -165,7 +165,7 @@ public class ForgeClientProxy { LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -179,7 +179,7 @@ public class ForgeClientProxy { LOGGER.trace("break or block attack at blockPos: " + event.getPos()); - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -217,7 +217,7 @@ public class ForgeClientProxy //==============// @SubscribeEvent - public void registerKeyBindings(#if PRE_MC_1_19_2 InputEvent.KeyInputEvent #else InputEvent.Key #endif event) + public void registerKeyBindings(#if MC_1_16 || MC_1_17 || MC_1_18 InputEvent.KeyInputEvent #else InputEvent.Key #endif event) { if (Minecraft.getInstance().player == null) { @@ -298,15 +298,15 @@ public class ForgeClientProxy //===========// @SubscribeEvent - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 public void afterLevelRenderEvent(RenderLevelStageEvent event) #else public void afterLevelRenderEvent(TickEvent.RenderTickEvent event) #endif { - #if POST_MC_1_20_1 + #if MC_1_20_2 || MC_1_20_4 if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_LEVEL) - #elif POST_MC_1_18_2 + #elif MC_1_19 || MC_1_20 if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS) #else // FIXME: Is this the correct location for 1.16 & 1.17??? diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index 6ee80e4de..dbf61fcd0 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -39,7 +39,7 @@ import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if POST_MC_1_19_2 +#if MC_1_19 || MC_1_20 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; @@ -51,11 +51,11 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.*; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -#if PRE_MC_1_17_1 +#if MC_1_16 import net.minecraftforge.fml.ExtensionPoint; -#elif MC_1_17_1 +#elif MC_1_17 import net.minecraftforge.fmlclient.ConfigGuiHandler; -#elif POST_MC_1_18_2 && PRE_MC_1_19_2 +#elif MC_1_18 import net.minecraftforge.client.ConfigGuiHandler; #else import net.minecraftforge.client.ConfigScreenHandler; @@ -64,7 +64,7 @@ import net.minecraftforge.client.ConfigScreenHandler; import org.apache.logging.log4j.Logger; // these imports change due to forge refactoring classes in 1.19 -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraftforge.client.model.data.ModelDataMap; import java.util.Random; @@ -128,10 +128,10 @@ public class ForgeMain implements LodForgeMethodCaller ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); } - #if PRE_MC_1_17_1 + #if MC_1_16 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> GetConfigScreen.getScreen(parent)); - #elif MC_1_17_1 || MC_1_18_2 || PRE_MC_1_19_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class, () -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> GetConfigScreen.getScreen(parent))); #else @@ -169,14 +169,14 @@ public class ForgeMain implements LodForgeMethodCaller LOGGER.info("Mod Post-Initialized"); } - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 private final ModelDataMap modelData = new ModelDataMap.Builder().build(); #else private final ModelData modelData = ModelData.EMPTY; #endif @Override - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) { return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData); @@ -184,14 +184,14 @@ public class ForgeMain implements LodForgeMethodCaller #else public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if POST_MC_1_19_2 , RenderType.solid() #endif ); + return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_1_19 || MC_1_20 , RenderType.solid() #endif ); } #endif @Override //TODO: Check this if its still needed public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) { - #if MC_1_17_1______Still_needed + #if MC_1_17______Still_needed return resolver.m_130045_(biome, x, z); #else return resolver.getColor(biome, x, z); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java index 46d2f5c6a..b646ecb12 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -14,7 +14,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraftforge.event.TickEvent; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; #else @@ -26,7 +26,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; #if MC_1_16_5 import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; -#elif MC_1_17_1 +#elif MC_1_17 import net.minecraftforge.fmlserverevents.FMLServerAboutToStartEvent; import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent; #else @@ -41,7 +41,7 @@ import java.util.function.Supplier; public class ForgeServerProxy { - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } #else private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -81,21 +81,21 @@ public class ForgeServerProxy // ServerWorldLoadEvent @SubscribeEvent - public void dedicatedWorldLoadEvent(#if MC_1_16_5 || MC_1_17_1 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event) + public void dedicatedWorldLoadEvent(#if MC_1_16_5 || MC_1_17 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event) { this.serverApi.serverLoadEvent(this.isDedicated); } // ServerWorldUnloadEvent @SubscribeEvent - public void serverWorldUnloadEvent(#if MC_1_16_5 || MC_1_17_1 FMLServerStoppingEvent #else ServerStoppingEvent #endif event) + public void serverWorldUnloadEvent(#if MC_1_16_5 || MC_1_17 FMLServerStoppingEvent #else ServerStoppingEvent #endif event) { this.serverApi.serverUnloadEvent(); } // ServerLevelLoadEvent @SubscribeEvent - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public void serverLevelLoadEvent(WorldEvent.Load event) #else public void serverLevelLoadEvent(LevelEvent.Load event) @@ -109,7 +109,7 @@ public class ForgeServerProxy // ServerLevelUnloadEvent @SubscribeEvent - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 public void serverLevelUnloadEvent(WorldEvent.Unload event) #else public void serverLevelUnloadEvent(LevelEvent.Unload event) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java index 1bb20e3fa..21ef500a5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java @@ -16,7 +16,7 @@ public class MixinClientPacketListener @Inject(method = "handleLogin", at = @At("RETURN")) void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); } - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(method = "cleanup", at = @At("HEAD")) #else @Inject(method = "close", at = @At("HEAD")) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java index 597a9850b..a9e59c9ca 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java @@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; -#if PRE_MC_1_17_1 +#if MC_1_16 import net.minecraft.world.level.material.FluidState; #else import net.minecraft.world.level.material.FogType; @@ -53,10 +53,10 @@ public class MixinFogRenderer @Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V", - remap = #if MC_1_17_1 || MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge + remap = #if MC_1_17 || MC_1_18 false #else true #endif ) // Remap messiness due to this being weird in forge private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) { - #if PRE_MC_1_17_1 + #if MC_1_16 FluidState fluidState = camera.getFluidInCamera(); boolean cameraNotInFluid = fluidState.isEmpty(); #else @@ -71,7 +71,7 @@ public class MixinFogRenderer && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial() && Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get()) { - #if PRE_MC_1_17_1 + #if MC_1_16 RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE); RenderSystem.fogEnd(A_EVEN_LARGER_VALUE); #else diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java index 316e89d59..64899ab54 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer { private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 2239adb4f..7e1e13eb2 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.forge.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; -#if PRE_MC_1_19_4 +#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; @@ -52,7 +52,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.nio.FloatBuffer; -#if PRE_MC_1_17_1 +#if MC_1_16 import org.lwjgl.opengl.GL15; #endif @@ -84,7 +84,7 @@ public class MixinLevelRenderer throw new NullPointerException("Null cannot be cast to non-null type."); } - #if PRE_MC_1_17_1 + #if MC_1_16 @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) #else @@ -99,17 +99,17 @@ public class MixinLevelRenderer // TODO: Can we move this to forge's client proxy similarly to how fabric does it - #if PRE_MC_1_17_1 + #if MC_1_16 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #elif PRE_MC_1_20_2 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) @@ -151,7 +151,7 @@ public class MixinLevelRenderer #if MC_1_16_5 SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif PRE_MC_1_19_4 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); #else projectionMatrix.set(matrixFloatArray); @@ -165,10 +165,10 @@ public class MixinLevelRenderer } } - #if PRE_MC_1_19_4 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) - #elif PRE_MC_1_20_1 + #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index 1aaa81bf7..5a1141d7f 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -25,7 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - #if PRE_MC_1_20_2 + #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 #if MC_1_20_1 @Redirect( method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if POST_MC_1_20_2 + #if MC_1_20_4 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java index af33b5db0..a95f9a79e 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java @@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if PRE_MC_1_19_2 +#if MC_1_16 || MC_1_17 || MC_1_18 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; @@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) - this. #if PRE_MC_1_17_1 addButton #else addRenderableWidget #endif + this. #if MC_1_16 addButton #else addRenderableWidget #endif (new TexturedButtonWidget( // Where the button is on the screen this.width / 2 - 180, this.height / 6 - 12, @@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen // For now it goes to the client option by default (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the button - #if PRE_MC_1_19_2 + #if MC_1_16 || MC_1_17 || MC_1_18 new TranslatableComponent(ModInfo.ID + ".title"))); #else Component.translatable(ModInfo.ID + ".title"))); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java index 5b15692ce..134886824 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.forge.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; -#if PRE_MC_1_18_2 +#if MC_1_16 || MC_1_17 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java index 537592d1b..31d787a62 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java @@ -9,7 +9,7 @@ class MixinTFChunkGenerator { // not currently implemented, attempting to run with the mod enabled in the IDE causes the game to lock up } -#elif PRE_MC_1_17_1 +#elif MC_1_16 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java index 59904ca04..ad96fc080 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if POST_MC_1_17_1 + #if MC_1_18 || MC_1_19 || MC_1_20 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if POST_MC_1_18_2 + #if MC_1_19 || MC_1_20 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index d692a4c49..e3d1c545d 100644 --- 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 @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.forge.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; -#if POST_MC_1_18_2 +#if MC_1_19 || MC_1_20 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; From 7d5357dec8bf3bef53b084a4172e8bd6e21d4955 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 11 Dec 2023 07:46:50 -0600 Subject: [PATCH 016/301] downgrade 1.17.1 bclib 0.5.6 -> 0.5.5 For some reason my machine refused to download 0.5.6, anyone can re-update to the latest if the issue becomes resolved --- versionProperties/1.17.1.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 8a8531d51..44be229a8 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -16,7 +16,7 @@ fabric_api_version=0.46.1+1.17 lithium_version= sodium_version=mc1.17.1-0.3.4 iris_version=1.17.x-v1.2.7 - bclib_version=0.5.6 + bclib_version=0.5.5 immersive_portals_version= canvas_version= From 4ae7083dcfbb6d5aa57adfddb9b6a77479c23d65 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 11 Dec 2023 07:46:53 -0600 Subject: [PATCH 017/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 88d78c53f..706a423c5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 88d78c53fd3a5071366f329d4187912ba169900d +Subproject commit 706a423c5f13ff82b970db4f41226facda466152 From 0fe017df74e129d8aef07e54b512717c7815ece7 Mon Sep 17 00:00:00 2001 From: Pierre Remacle <61838082+PierreRemacle@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:05:03 +0100 Subject: [PATCH 018/301] Chisels & Bits blocks transparent --- .../wrappers/block/cache/ClientBlockStateCache.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 9f8de4c95..5e33f3ceb 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 @@ -91,11 +91,13 @@ public class ClientBlockStateCache { Default, Flower, - Leaves; + Leaves, + Chisel; static ColorMode getColorMode(Block b) { if (b instanceof LeavesBlock) return Leaves; if (b instanceof FlowerBlock) return Flower; + if (b.toString().equals("Block{chiselsandbits:chiseled}")) return Chisel; return Default; } } @@ -160,7 +162,14 @@ public class ClientBlockStateCache { scale = FLOWER_COLOR_SCALE; } - + //make Chiseled block not render + else if (colorMode == ColorMode.Chisel) + { + r = 0; + g = 0; + b = 0; + a = 0; + } count += scale; alpha += a * a * scale; red += r * r * scale; From b00c252f171931d6fad98410350296e8857d34a6 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 17:56:44 +1030 Subject: [PATCH 019/301] Updated gradle (and its wrapper), and fabric and architectury loom --- Readme.md | 6 ++-- build.gradle | 4 +-- fabric/build.gradle | 6 ++-- forge/build.gradle | 7 ++-- gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 43462 bytes gradle/wrapper/gradle-wrapper.properties | 5 +-- gradlew | 41 ++++++++++++++++------- gradlew.bat | 15 +++++---- settings.gradle | 3 ++ 9 files changed, 56 insertions(+), 31 deletions(-) diff --git a/Readme.md b/Readme.md index f37ac9c2a..8145a1792 100644 --- a/Readme.md +++ b/Readme.md @@ -77,10 +77,10 @@ Modmenu: 1.16.22 ### Plugin and Library versions -Fabric loom: 1.1.+\ -Forge gradle (Using Architectury): 3.4-SNAPSHOT\ +Gradle: 8.5\ +Fabric loom: 1.4-SNAPSHOT\ +Architectury loom (Forge gradle replacement): 1.4-SNAPSHOT\ Sponge vanilla gradle: 0.2.1-SNAPSHOT\ -Sponge mixin: 0.8.5\ Java Preprocessor plugin: Manifold Preprocessor
diff --git a/build.gradle b/build.gradle index ca35855bc..349ec564a 100644 --- a/build.gradle +++ b/build.gradle @@ -10,11 +10,11 @@ plugins { // Manifold preprocessor id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" - // Provides mc libraries to core +// // Provides mc libraries to core // id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false // Architectury is used here only as a replacement for forge's own loom - id "dev.architectury.loom" version "1.1.+" apply false + id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false } /** diff --git a/fabric/build.gradle b/fabric/build.gradle index 84c5e42ac..ee52d6df3 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "fabric-loom" version "1.1.+" + id "fabric-loom" version "1.4-SNAPSHOT" } loom { @@ -25,7 +25,7 @@ loom { remapJar { inputFile = shadowJar.archiveFile dependsOn shadowJar - classifier null +// classifier null } configurations { @@ -127,7 +127,7 @@ processResources { runClient { dependsOn(copyCoreResources) dependsOn(copyCommonLoaderResources) - jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) +// jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) finalizedBy(deleteResources) } diff --git a/forge/build.gradle b/forge/build.gradle index 2a2753f91..0e34fa028 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,4 +1,6 @@ plugins { + // Note: This is only needed for multi-loader projects + // The main architectury loom version is set at the start of the root build.gradle id "architectury-plugin" version "3.4-SNAPSHOT" } @@ -18,6 +20,7 @@ architectury { //} loom { + silentMojangMappingsLicense() // Shut the licencing warning accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") forge { @@ -36,7 +39,7 @@ loom { setConfigName("Forge Client") ideConfigGenerated(true) runDir("../run") - vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) +// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) } server { server() @@ -50,7 +53,7 @@ loom { remapJar { inputFile = shadowJar.archiveFile dependsOn shadowJar - classifier null +// classifier null } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..d64cd4917707c1f8861d8cb53dd15194d4248596 100644 GIT binary patch literal 43462 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 literal 59203 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

K7UpUK$>l@ zw`1S}(D?mUXu_C{wupRS-jiX~w=Uqqhf|Vb3Cm9L=T+w91Cu^ z*&Ty%sN?x*h~mJc4g~k{xD4ZmF%FXZNC;oVDwLZ_WvrnzY|{v8hc1nmx4^}Z;yriXsAf+Lp+OFLbR!&Ox?xABwl zu8w&|5pCxmu#$?Cv2_-Vghl2LZ6m7}VLEfR5o2Ou$x02uA-%QB2$c(c1rH3R9hesc zfpn#oqpbKuVsdfV#cv@5pV4^f_!WS+F>SV6N0JQ9E!T90EX((_{bSSFv9ld%I0&}9 zH&Jd4MEX1e0iqDtq~h?DBrxQX1iI0lIs<|kB$Yrh&cpeK0-^K%=FBsCBT46@h#yi!AyDq1V(#V}^;{{V*@T4WJ&U-NTq43w=|K>z8%pr_nC>%C(Wa_l78Ufib$r8Od)IIN=u>417 z`Hl{9A$mI5A(;+-Q&$F&h-@;NR>Z<2U;Y21>>Z;s@0V@SbkMQQj%_;~+qTuQ?c|AV zcWm3XZQHhP&R%QWarS%mJ!9R^&!_)*s(v+VR@I#QrAT}`17Y+l<`b-nvmDNW`De%y zrwTZ9EJrj1AFA>B`1jYDow}~*dfPs}IZMO3=a{Fy#IOILc8F0;JS4x(k-NSpbN@qM z`@aE_e}5{!$v3+qVs7u?sOV(y@1Os*Fgu`fCW9=G@F_#VQ%xf$hj0~wnnP0$hFI+@ zkQj~v#V>xn)u??YutKsX>pxKCl^p!C-o?+9;!Nug^ z{rP!|+KsP5%uF;ZCa5F;O^9TGac=M|=V z_H(PfkV1rz4jl?gJ(ArXMyWT4y(86d3`$iI4^l9`vLdZkzpznSd5Ikfrs8qcSy&>z zTIZgWZGXw0n9ibQxYWE@gI0(3#KA-dAdPcsL_|hg2@~C!VZDM}5;v_Nykfq!*@*Zf zE_wVgx82GMDryKO{U{D>vSzSc%B~|cjDQrt5BN=Ugpsf8H8f1lR4SGo#hCuXPL;QQ z#~b?C4MoepT3X`qdW2dNn& zo8)K}%Lpu>0tQei+{>*VGErz|qjbK#9 zvtd8rcHplw%YyQCKR{kyo6fgg!)6tHUYT(L>B7er5)41iG`j$qe*kSh$fY!PehLcD zWeKZHn<492B34*JUQh=CY1R~jT9Jt=k=jCU2=SL&&y5QI2uAG2?L8qd2U(^AW#{(x zThSy=C#>k+QMo^7caQcpU?Qn}j-`s?1vXuzG#j8(A+RUAY})F@=r&F(8nI&HspAy4 z4>(M>hI9c7?DCW8rw6|23?qQMSq?*Vx?v30U%luBo)B-k2mkL)Ljk5xUha3pK>EEj z@(;tH|M@xkuN?gsz;*bygizwYR!6=(Xgcg^>WlGtRYCozY<rFX2E>kaZo)O<^J7a`MX8Pf`gBd4vrtD|qKn&B)C&wp0O-x*@-|m*0egT=-t@%dD zgP2D+#WPptnc;_ugD6%zN}Z+X4=c61XNLb7L1gWd8;NHrBXwJ7s0ce#lWnnFUMTR& z1_R9Fin4!d17d4jpKcfh?MKRxxQk$@)*hradH2$3)nyXep5Z;B z?yX+-Bd=TqO2!11?MDtG0n(*T^!CIiF@ZQymqq1wPM_X$Iu9-P=^}v7npvvPBu!d$ z7K?@CsA8H38+zjA@{;{kG)#AHME>Ix<711_iQ@WWMObXyVO)a&^qE1GqpP47Q|_AG zP`(AD&r!V^MXQ^e+*n5~Lp9!B+#y3#f8J^5!iC@3Y@P`;FoUH{G*pj*q7MVV)29+j z>BC`a|1@U_v%%o9VH_HsSnM`jZ-&CDvbiqDg)tQEnV>b%Ptm)T|1?TrpIl)Y$LnG_ zzKi5j2Fx^K^PG1=*?GhK;$(UCF-tM~^=Z*+Wp{FSuy7iHt9#4n(sUuHK??@v+6*|10Csdnyg9hAsC5_OrSL;jVkLlf zHXIPukLqbhs~-*oa^gqgvtpgTk_7GypwH><53riYYL*M=Q@F-yEPLqQ&1Sc zZB%w}T~RO|#jFjMWcKMZccxm-SL)s_ig?OC?y_~gLFj{n8D$J_Kw%{r0oB8?@dWzn zB528d-wUBQzrrSSLq?fR!K%59Zv9J4yCQhhDGwhptpA5O5U?Hjqt>8nOD zi{)0CI|&Gu%zunGI*XFZh(ix)q${jT8wnnzbBMPYVJc4HX*9d^mz|21$=R$J$(y7V zo0dxdbX3N#=F$zjstTf*t8vL)2*{XH!+<2IJ1VVFa67|{?LP&P41h$2i2;?N~RA30LV`BsUcj zfO9#Pg1$t}7zpv#&)8`mis3~o+P(DxOMgz-V*(?wWaxi?R=NhtW}<#^Z?(BhSwyar zG|A#Q7wh4OfK<|DAcl9THc-W4*>J4nTevsD%dkj`U~wSUCh15?_N@uMdF^Kw+{agk zJ`im^wDqj`Ev)W3k3stasP`88-M0ZBs7;B6{-tSm3>I@_e-QfT?7|n0D~0RRqDb^G zyHb=is;IwuQ&ITzL4KsP@Z`b$d%B0Wuhioo1CWttW8yhsER1ZUZzA{F*K=wmi-sb#Ju+j z-l@In^IKnb{bQG}Ps>+Vu_W#grNKNGto+yjA)?>0?~X`4I3T@5G1)RqGUZuP^NJCq&^HykuYtMDD8qq+l8RcZNJsvN(10{ zQ1$XcGt}QH-U^WU!-wRR1d--{B$%vY{JLWIV%P4-KQuxxDeJaF#{eu&&r!3Qu{w}0f--8^H|KwE>)ORrcR+2Qf zb})DRcH>k0zWK8@{RX}NYvTF;E~phK{+F;MkIP$)T$93Ba2R2TvKc>`D??#mv9wg$ zd~|-`Qx5LwwsZ2hb*Rt4S9dsF%Cny5<1fscy~)d;0m2r$f=83<->c~!GNyb!U)PA; zq^!`@@)UaG)Ew(9V?5ZBq#c%dCWZrplmuM`o~TyHjAIMh0*#1{B>K4po-dx$Tk-Cq z=WZDkP5x2W&Os`N8KiYHRH#UY*n|nvd(U>yO=MFI-2BEp?x@=N<~CbLJBf6P)}vLS?xJXYJ2^<3KJUdrwKnJnTp{ zjIi|R=L7rn9b*D#Xxr4*R<3T5AuOS+#U8hNlfo&^9JO{VbH!v9^JbK=TCGR-5EWR@ zN8T-_I|&@A}(hKeL4_*eb!1G8p~&_Im8|wc>Cdir+gg90n1dw?QaXcx6Op_W1r=axRw>4;rM*UOpT#Eb9xU1IiWo@h?|5uP zka>-XW0Ikp@dIe;MN8B01a7+5V@h3WN{J=HJ*pe0uwQ3S&MyWFni47X32Q7SyCTNQ z+sR!_9IZa5!>f&V$`q!%H8ci!a|RMx5}5MA_kr+bhtQy{-^)(hCVa@I!^TV4RBi zAFa!Nsi3y37I5EK;0cqu|9MRj<^r&h1lF}u0KpKQD^5Y+LvFEwM zLU@@v4_Na#Axy6tn3P%sD^5P#<7F;sd$f4a7LBMk zGU^RZHBcxSA%kCx*eH&wgA?Qwazm8>9SCSz_!;MqY-QX<1@p$*T8lc?@`ikEqJ>#w zcG``^CoFMAhdEXT9qt47g0IZkaU)4R7wkGs^Ax}usqJ5HfDYAV$!=6?>J6+Ha1I<5 z|6=9soU4>E))tW$<#>F ziZ$6>KJf0bPfbx_)7-}tMINlc=}|H+$uX)mhC6-Hz+XZxsKd^b?RFB6et}O#+>Wmw9Ec9) z{q}XFWp{3@qmyK*Jvzpyqv57LIR;hPXKsrh{G?&dRjF%Zt5&m20Ll?OyfUYC3WRn{cgQ?^V~UAv+5 z&_m#&nIwffgX1*Z2#5^Kl4DbE#NrD&Hi4|7SPqZ}(>_+JMz=s|k77aEL}<=0Zfb)a z%F(*L3zCA<=xO)2U3B|pcTqDbBoFp>QyAEU(jMu8(jLA61-H!ucI804+B!$E^cQQa z)_ERrW3g!B9iLb3nn3dlkvD7KsY?sRvls3QC0qPi>o<)GHx%4Xb$5a3GBTJ(k@`e@ z$RUa^%S15^1oLEmA=sayrP5;9qtf!Z1*?e$ORVPsXpL{jL<6E)0sj&swP3}NPmR%FM?O>SQgN5XfHE< zo(4#Cv11(%Nnw_{_Ro}r6=gKd{k?NebJ~<~Kv0r(r0qe4n3LFx$5%x(BKvrz$m?LG zjLIc;hbj0FMdb9aH9Lpsof#yG$(0sG2%RL;d(n>;#jb!R_+dad+K;Ccw!|RY?uS(a zj~?=&M!4C(5LnlH6k%aYvz@7?xRa^2gml%vn&eKl$R_lJ+e|xsNfXzr#xuh(>`}9g zLHSyiFwK^-p!;p$yt7$F|3*IfO3Mlu9e>Dpx8O`37?fA`cj`C0B-m9uRhJjs^mRp# zWB;Aj6|G^1V6`jg7#7V9UFvnB4((nIwG?k%c7h`?0tS8J3Bn0t#pb#SA}N-|45$-j z$R>%7cc2ebAClXc(&0UtHX<>pd)akR3Kx_cK+n<}FhzmTx!8e9^u2e4%x{>T6pQ`6 zO182bh$-W5A3^wos0SV_TgPmF4WUP-+D25KjbC{y_6W_9I2_vNKwU(^qSdn&>^=*t z&uvp*@c8#2*paD!ZMCi3;K{Na;I4Q35zw$YrW5U@Kk~)&rw;G?d7Q&c9|x<Hg|CNMsxovmfth*|E*GHezPTWa^Hd^F4!B3sF;)? z(NaPyAhocu1jUe(!5Cy|dh|W2=!@fNmuNOzxi^tE_jAtzNJ0JR-avc_H|ve#KO}#S z#a(8secu|^Tx553d4r@3#6^MHbH)vmiBpn0X^29xEv!Vuh1n(Sr5I0V&`jA2;WS|Y zbf0e}X|)wA-Pf5gBZ>r4YX3Mav1kKY(ulAJ0Q*jB)YhviHK)w!TJsi3^dMa$L@^{` z_De`fF4;M87vM3Ph9SzCoCi$#Fsd38u!^0#*sPful^p5oI(xGU?yeYjn;Hq1!wzFk zG&2w}W3`AX4bxoVm03y>ts{KaDf!}b&7$(P4KAMP=vK5?1In^-YYNtx1f#}+2QK@h zeSeAI@E6Z8a?)>sZ`fbq9_snl6LCu6g>o)rO;ijp3|$vig+4t} zylEo7$SEW<_U+qgVcaVhk+4k+C9THI5V10qV*dOV6pPtAI$)QN{!JRBKh-D zk2^{j@bZ}yqW?<#VVuI_27*cI-V~sJiqQv&m07+10XF+#ZnIJdr8t`9s_EE;T2V;B z4UnQUH9EdX%zwh-5&wflY#ve!IWt0UE-My3?L#^Bh%kcgP1q{&26eXLn zTkjJ*w+(|_>Pq0v8{%nX$QZbf)tbJaLY$03;MO=Ic-uqYUmUCuXD>J>o6BCRF=xa% z3R4SK9#t1!K4I_d>tZgE>&+kZ?Q}1qo4&h%U$GfY058s%*=!kac{0Z+4Hwm!)pFLR zJ+5*OpgWUrm0FPI2ib4NPJ+Sk07j(`diti^i#kh&f}i>P4~|d?RFb#!JN)~D@)beox}bw?4VCf^y*`2{4`-@%SFTry2h z>9VBc9#JxEs1+0i2^LR@B1J`B9Ac=#FW=(?2;5;#U$0E0UNag_!jY$&2diQk_n)bT zl5Me_SUvqUjwCqmVcyb`igygB_4YUB*m$h5oeKv3uIF0sk}~es!{D>4r%PC*F~FN3owq5e0|YeUTSG#Vq%&Gk7uwW z0lDo#_wvflqHeRm*}l?}o;EILszBt|EW*zNPmq#?4A+&i0xx^?9obLyY4xx=Y9&^G;xYXYPxG)DOpPg!i_Ccl#3L}6xAAZzNhPK1XaC_~ z!A|mlo?Be*8Nn=a+FhgpOj@G7yYs(Qk(8&|h@_>w8Y^r&5nCqe0V60rRz?b5%J;GYeBqSAjo|K692GxD4` zRZyM2FdI+-jK2}WAZTZ()w_)V{n5tEb@>+JYluDozCb$fA4H)$bzg(Ux{*hXurjO^ zwAxc+UXu=&JV*E59}h3kzQPG4M)X8E*}#_&}w*KEgtX)cU{vm9b$atHa;s>| z+L6&cn8xUL*OSjx4YGjf6{Eq+Q3{!ZyhrL&^6Vz@jGbI%cAM9GkmFlamTbcQGvOlL zmJ?(FI)c86=JEs|*;?h~o)88>12nXlpMR4@yh%qdwFNpct;vMlc=;{FSo*apJ;p}! zAX~t;3tb~VuP|ZW;z$=IHf->F@Ml)&-&Bnb{iQyE#;GZ@C$PzEf6~q}4D>9jic@mTO5x76ulDz@+XAcm35!VSu zT*Gs>;f0b2TNpjU_BjHZ&S6Sqk6V1370+!eppV2H+FY!q*n=GHQ!9Rn6MjY!Jc77A zG7Y!lFp8?TIHN!LXO?gCnsYM-gQxsm=Ek**VmZu7vnuufD7K~GIxfxbsQ@qv2T zPa`tvHB$fFCyZl>3oYg?_wW)C>^_iDOc^B7klnTOoytQH18WkOk)L2BSD0r%xgRSW zQS9elF^?O=_@|58zKLK;(f77l-Zzu}4{fXed2saq!5k#UZAoDBqYQS{sn@j@Vtp|$ zG%gnZ$U|9@u#w1@11Sjl8ze^Co=)7yS(}=;68a3~g;NDe_X^}yJj;~s8xq9ahQ5_r zxAlTMnep*)w1e(TG%tWsjo3RR;yVGPEO4V{Zp?=a_0R#=V^ioQu4YL=BO4r0$$XTX zZfnw#_$V}sDAIDrezGQ+h?q24St0QNug_?{s-pI(^jg`#JRxM1YBV;a@@JQvH8*>> zIJvku74E0NlXkYe_624>znU0J@L<-c=G#F3k4A_)*;ky!C(^uZfj%WB3-*{*B$?9+ zDm$WFp=0(xnt6`vDQV3Jl5f&R(Mp};;q8d3I%Kn>Kx=^;uSVCw0L=gw53%Bp==8Sw zxtx=cs!^-_+i{2OK`Q;913+AXc_&Z5$@z3<)So0CU3;JAv=H?@Zpi~riQ{z-zLtVL z!oF<}@IgJp)Iyz1zVJ42!SPHSkjYNS4%ulVVIXdRuiZ@5Mx8LJS}J#qD^Zi_xQ@>DKDr-_e#>5h3dtje*NcwH_h;i{Sx7}dkdpuW z(yUCjckQsagv*QGMSi9u1`Z|V^}Wjf7B@q%j2DQXyd0nOyqg%m{CK_lAoKlJ7#8M} z%IvR?Vh$6aDWK2W!=i?*<77q&B8O&3?zP(Cs@kapc)&p7En?J;t-TX9abGT#H?TW? ztO5(lPKRuC7fs}zwcUKbRh=7E8wzTsa#Z{a`WR}?UZ%!HohN}d&xJ=JQhpO1PI#>X zHkb>pW04pU%Bj_mf~U}1F1=wxdBZu1790>3Dm44bQ#F=T4V3&HlOLsGH)+AK$cHk6 zia$=$kog?)07HCL*PI6}DRhpM^*%I*kHM<#1Se+AQ!!xyhcy6j7`iDX7Z-2i73_n# zas*?7LkxS-XSqv;YBa zW_n*32D(HTYQ0$feV_Fru1ZxW0g&iwqixPX3=9t4o)o|kOo79V$?$uh?#8Q8e>4e)V6;_(x&ViUVxma+i25qea;d-oK7ouuDsB^ab{ zu1qjQ%`n56VtxBE#0qAzb7lph`Eb-}TYpXB!H-}3Ykqyp`otprp7{VEuW*^IR2n$Fb99*nAtqT&oOFIf z@w*6>YvOGw@Ja?Pp1=whZqydzx@9X4n^2!n83C5{C?G@|E?&$?p*g68)kNvUTJ)I6 z1Q|(#UuP6pj78GUxq11m-GSszc+)X{C2eo-?8ud9sB=3(D47v?`JAa{V(IF zPZQ_0AY*9M97>Jf<o%#O_%Wq}8>YM=q0|tGY+hlXcpE=Z4Od z`NT7Hu2hnvRoqOw@g1f=bv`+nba{GwA$Ak0INlqI1k<9!x_!sL()h?hEWoWrdU3w` zZ%%)VR+Bc@_v!C#koM1p-3v_^L6)_Ktj4HE>aUh%2XZE@JFMOn)J~c`_7VWNb9c-N z2b|SZMR4Z@E7j&q&9(6H3yjEu6HV7{2!1t0lgizD;mZ9$r(r7W5G$ky@w(T_dFnOD z*p#+z$@pKE+>o@%eT(2-p_C}wbQ5s(%Sn_{$HDN@MB+Ev?t@3dPy`%TZ!z}AThZSu zN<1i$siJhXFdjV zP*y|V<`V8t=h#XTRUR~5`c`Z9^-`*BZf?WAehGdg)E2Je)hqFa!k{V(u+(hTf^Yq& zoruUh2(^3pe)2{bvt4&4Y9CY3js)PUHtd4rVG57}uFJL)D(JfSIo^{P=7liFXG zq5yqgof0V8paQcP!gy+;^pp-DA5pj=gbMN0eW=-eY+N8~y+G>t+x}oa!5r>tW$xhI zPQSv=pi;~653Gvf6~*JcQ%t1xOrH2l3Zy@8AoJ+wz@daW@m7?%LXkr!bw9GY@ns3e zSfuWF_gkWnesv?s3I`@}NgE2xwgs&rj?kH-FEy82=O8`+szN ziHch`vvS`zNfap14!&#i9H@wF7}yIPm=UB%(o(}F{wsZ(wA0nJ2aD^@B41>>o-_U6 zUqD~vdo48S8~FTb^+%#zcbQiiYoDKYcj&$#^;Smmb+Ljp(L=1Kt_J!;0s%1|JK}Wi z;={~oL!foo5n8=}rs6MmUW~R&;SIJO3TL4Ky?kh+b2rT9B1Jl4>#Uh-Bec z`Hsp<==#UEW6pGPhNk8H!!DUQR~#F9jEMI6T*OWfN^Ze&X(4nV$wa8QUJ>oTkruH# zm~O<`J7Wxseo@FqaZMl#Y(mrFW9AHM9Kb|XBMqaZ2a)DvJgYipkDD_VUF_PKd~dT7 z#02}bBfPn9a!X!O#83=lbJSK#E}K&yx-HI#T6ua)6o0{|={*HFusCkHzs|Fn&|C3H zBck1cmfcWVUN&i>X$YU^Sn6k2H;r3zuXbJFz)r5~3$d$tUj(l1?o={MM){kjgqXRO zc5R*#{;V7AQh|G|)jLM@wGAK&rm2~@{Pewv#06pHbKn#wL0P6F1!^qw9g&cW3Z=9} zj)POhOlwsh@eF=>z?#sIs*C-Nl(yU!#DaiaxhEs#iJqQ8w%(?+6lU02MYSeDkr!B- zPjMv+on6OLXgGnAtl(ao>|X2Y8*Hb}GRW5}-IzXnoo-d0!m4Vy$GS!XOLy>3_+UGs z2D|YcQx@M#M|}TDOetGi{9lGo9m-=0-^+nKE^*?$^uHkxZh}I{#UTQd;X!L+W@jm( zDg@N4+lUqI92o_rNk{3P>1gxAL=&O;x)ZT=q1mk0kLlE$WeWuY_$0`0jY-Kkt zP*|m3AF}Ubd=`<>(Xg0har*_@x2YH}bn0Wk*OZz3*e5;Zc;2uBdnl8?&XjupbkOeNZsNh6pvsq_ydmJI+*z**{I{0K)-;p1~k8cpJXL$^t!-`E}=*4G^-E8>H!LjTPxSx zcF+cS`ommfKMhNSbas^@YbTpH1*RFrBuATUR zt{oFWSk^$xU&kbFQ;MCX22RAN5F6eq9UfR$ut`Jw--p2YX)A*J69m^!oYfj2y7NYcH6&r+0~_sH^c^nzeN1AU4Ga7=FlR{S|Mm~MpzY0$Z+p2W(a={b-pR9EO1Rs zB%KY|@wLcAA@)KXi!d2_BxrkhDn`DT1=Dec}V!okd{$+wK z4E{n8R*xKyci1(CnNdhf$Dp2(Jpof0-0%-38X=Dd9PQgT+w%Lshx9+loPS~MOm%ZT zt%2B2iL_KU_ita%N>xjB!#71_3=3c}o zgeW~^U_ZTJQ2!PqXulQd=3b=XOQhwATK$y(9$#1jOQ4}4?~l#&nek)H(04f(Sr=s| zWv7Lu1=%WGk4FSw^;;!8&YPM)pQDCY9DhU`hMty1@sq1=Tj7bFsOOBZOFlpR`W>-J$-(kezWJj;`?x-v>ev{*8V z8p|KXJPV$HyQr1A(9LVrM47u-XpcrIyO`yWvx1pVYc&?154aneRpLqgx)EMvRaa#|9?Wwqs2+W8n5~79G z(}iCiLk;?enn}ew`HzhG+tu+Ru@T+K5juvZN)wY;x6HjvqD!&!)$$;1VAh~7fg0K| zEha#aN=Yv|3^~YFH}cc38ovVb%L|g@9W6fo(JtT6$fa?zf@Ct88e}m?i)b*Jgc{fl zExfdvw-BYDmH6>(4QMt#p0;FUIQqkhD}aH?a7)_%JtA~soqj{ppP_82yi9kaxuK>~ ze_)Zt>1?q=ZH*kF{1iq9sr*tVuy=u>Zev}!gEZx@O6-fjyu9X00gpIl-fS_pzjpqJ z1yqBmf9NF!jaF<+YxgH6oXBdK)sH(>VZ)1siyA$P<#KDt;8NT*l_0{xit~5j1P)FN zI8hhYKhQ)i z37^aP13B~u65?sg+_@2Kr^iWHN=U;EDSZ@2W2!5ALhGNWXnFBY%7W?1 z=HI9JzQ-pLKZDYTv<0-lt|6c-RwhxZ)mU2Os{bsX_i^@*fKUj8*aDO5pks=qn3Dv6 zwggpKLuyRCTVPwmw1r}B#AS}?X7b837UlXwp~E2|PJw2SGVueL7){Y&z!jL!XN=0i zU^Eig`S2`{+gU$68aRdWx?BZ{sU_f=8sn~>s~M?GU~`fH5kCc; z8ICp+INM3(3{#k32RZdv6b9MQYdZXNuk7ed8;G?S2nT+NZBG=Tar^KFl2SvhW$bGW#kdWL-I)s_IqVnCDDM9fm8g;P;8 z7t4yZn3^*NQfx7SwmkzP$=fwdC}bafQSEF@pd&P8@H#`swGy_rz;Z?Ty5mkS%>m#% zp_!m9e<()sfKiY(nF<1zBz&&`ZlJf6QLvLhl`_``%RW&{+O>Xhp;lwSsyRqGf=RWd zpftiR`={2(siiPAS|p}@q=NhVc0ELprt%=fMXO3B)4ryC2LT(o=sLM7hJC!}T1@)E zA3^J$3&1*M6Xq>03FX`R&w*NkrZE?FwU+Muut;>qNhj@bX17ZJxnOlPSZ=Zeiz~T_ zOu#yc3t6ONHB;?|r4w+pI)~KGN;HOGC)txxiUN8#mexj+W(cz%9a4sx|IRG=}ia zuEBuba3AHsV2feqw-3MvuL`I+2|`Ud4~7ZkN=JZ;L20|Oxna5vx1qbIh#k2O4$RQF zo`tL()zxaqibg^GbB+BS5#U{@K;WWQj~GcB1zb}zJkPwH|5hZ9iH2308!>_;%msji zJHSL~s)YHBR=Koa1mLEOHos*`gp=s8KA-C zu0aE+W!#iJ*0xqKm3A`fUGy#O+X+5W36myS>Uh2!R*s$aCU^`K&KKLCCDkejX2p=5 z%o7-fl03x`gaSNyr?3_JLv?2RLS3F*8ub>Jd@^Cc17)v8vYEK4aqo?OS@W9mt%ITJ z9=S2%R8M){CugT@k~~0x`}Vl!svYqX=E)c_oU6o}#Hb^%G1l3BudxA{F*tbjG;W_>=xV73pKY53v%>I)@D36I_@&p$h|Aw zonQS`07z_F#@T-%@-Tb|)7;;anoD_WH>9ewFy(ZcEOM$#Y)8>qi7rCnsH9GO-_7zF zu*C87{Df1P4TEOsnzZ@H%&lvV(3V@;Q!%+OYRp`g05PjY^gL$^$-t0Y>H*CDDs?FZly*oZ&dxvsxaUWF!{em4{A>n@vpXg$dwvt@_rgmHF z-MER`ABa8R-t_H*kv>}CzOpz;!>p^^9ztHMsHL|SRnS<-y5Z*r(_}c4=fXF`l^-i}>e7v!qs_jv zqvWhX^F=2sDNWA9c@P0?lUlr6ecrTKM%pNQ^?*Lq?p-0~?_j50xV%^(+H>sMul#Tw zeciF*1=?a7cI(}352%>LO96pD+?9!fNyl^9v3^v&Y4L)mNGK0FN43&Xf8jUlxW1Bw zyiu2;qW-aGNhs=zbuoxnxiwZ3{PFZM#Kw)9H@(hgX23h(`Wm~m4&TvoZoYp{plb^> z_#?vXcxd>r7K+1HKJvhed>gtK`TAbJUazUWQY6T~t2af%#<+Veyr%7-#*A#@&*;@g58{i|E%6yC_InGXCOd{L0;$)z#?n7M`re zh!kO{6=>7I?*}czyF7_frt#)s1CFJ_XE&VrDA?Dp3XbvF{qsEJgb&OLSNz_5g?HpK z9)8rsr4JN!Af3G9!#Qn(6zaUDqLN(g2g8*M)Djap?WMK9NKlkC)E2|-g|#-rp%!Gz zAHd%`iq|81efi93m3yTBw3g0j#;Yb2X{mhRAI?&KDmbGqou(2xiRNb^sV}%%Wu0?< z?($L>(#BO*)^)rSgyNRni$i`R4v;GhlCZ8$@e^ROX(p=2_v6Y!%^As zu022)fHdv_-~Yu_H6WVPLpHQx!W%^6j)cBhS`O3QBW#x(eX54d&I22op(N59b*&$v zFiSRY6rOc^(dgSV1>a7-5C;(5S5MvKcM2Jm-LD9TGqDpP097%52V+0>Xqq!! zq4e3vj53SE6i8J`XcQB|MZPP8j;PAOnpGnllH6#Ku~vS42xP*Nz@~y%db7Xi8s09P z1)e%8ys6&M8D=Dt6&t`iKG_4X=!kgRQoh%Z`dc&mlOUqXk-k`jKv9@(a^2-Upw>?< zt5*^DV~6Zedbec4NVl($2T{&b)zA@b#dUyd>`2JC0=xa_fIm8{5um zr-!ApXZhC8@=vC2WyxO|!@0Km)h8ep*`^he92$@YwP>VcdoS5OC^s38e#7RPsg4j+ zbVGG}WRSET&ZfrcR(x~k8n1rTP%CnfUNKUonD$P?FtNFF#cn!wEIab-;jU=B1dHK@ z(;(yAQJ`O$sMn>h;pf^8{JISW%d+@v6@CnXh9n5TXGC}?FI9i-D0OMaIg&mAg=0Kn zNJ7oz5*ReJukD55fUsMuaP+H4tDN&V9zfqF@ zr=#ecUk9wu{0;!+gl;3Bw=Vn^)z$ahVhhw)io!na&9}LmWurLb0zubxK=UEnU*{5P z+SP}&*(iBKSO4{alBHaY^)5Q=mZ+2OwIooJ7*Q5XJ+2|q`9#f?6myq!&oz?klihLq z4C)$XP!BNS0G_Z1&TM>?Jk{S~{F3n83ioli=IO6f%wkvCl(RFFw~j0tb{GvXTx>*sB0McY0s&SNvj4+^h`9nJ_wM>F!Uc>X}9PifQekn0sKI2SAJP!a4h z5cyGTuCj3ZBM^&{dRelIlT^9zcfaAuL5Y~bl!ppSf`wZbK$z#6U~rdclk``e+!qhe z6Qspo*%<)eu6?C;Bp<^VuW6JI|Ncvyn+LlSl;Mp22Bl7ARQ0Xc24%29(ZrdsIPw&-=yHQ7_Vle|5h>AST0 zUGX2Zk34vp?U~IHT|;$U86T+UUHl_NE4m|}>E~6q``7hccCaT^#y+?wD##Q%HwPd8 zV3x4L4|qqu`B$4(LXqDJngNy-{&@aFBvVsywt@X^}iH7P%>bR?ciC$I^U-4Foa`YKI^qDyGK7k%E%c_P=yzAi`YnxGA%DeNd++j3*h^ z=rn>oBd0|~lZ<6YvmkKY*ZJlJ;Im0tqgWu&E92eqt;+NYdxx`eS(4Hw_Jb5|yVvBg z*tbdY^!AN;luEyN4VRhS@-_DC{({ziH{&Z}iGElSV~qvT>L-8G%+yEL zX#MFOhj{InyKG=mvW-<1B@c-}x$vA(nU?>S>0*eN#!SLzQ)Ex7fvQ)S4D<8|I#N$3 zT5Ei`Z?cxBODHX8(Xp73v`IsAYC@9b;t}z0wxVuQSY1J^GRwDPN@qbM-ZF48T$GZ< z8WU+;Pqo?{ghI-KZ-i*ydXu`Ep0Xw^McH_KE9J0S7G;x8Fe`DVG?j3Pv=0YzJ}yZR z%2=oqHiUjvuk0~Ca>Kol4CFi0_xQT~;_F?=u+!kIDl-9g`#ZNZ9HCy17Ga1v^Jv9# z{T4Kb1-AzUxq*MutfOWWZgD*HnFfyYg0&e9f(5tZ>krPF6{VikNeHoc{linPPt#Si z&*g>(c54V8rT_AX!J&bNm-!umPvOR}vDai#`CX___J#=zeB*{4<&2WpaDncZsOkp* zsg<%@@rbrMkR_ux9?LsQxzoBa1s%$BBn6vk#{&&zUwcfzeCBJUwFYSF$08qDsB;gWQN*g!p8pxjofWbqNSZOEKOaTx@+* zwdt5*Q47@EOZ~EZL9s?1o?A%9TJT=Ob_13yyugvPg*e&ZU(r6^k4=2+D-@n=Hv5vu zSXG|hM(>h9^zn=eQ=$6`JO&70&2|%V5Lsx>)(%#;pcOfu>*nk_3HB_BNaH$`jM<^S zcSftDU1?nL;jy)+sfonQN}(}gUW?d_ikr*3=^{G)=tjBtEPe>TO|0ddVB zTklrSHiW+!#26frPXQQ(YN8DG$PZo?(po(QUCCf_OJC`pw*uey00%gmH!`WJkrKXj2!#6?`T25mTu9OJp2L8z3! z=arrL$ZqxuE{%yV)14Kd>k}j7pxZ6#$Dz8$@WV5p8kTqN<-7W)Q7Gt2{KoOPK_tZ| zf2WG~O5@{qPI+W<4f_;reuFVdO^5`ADC1!JQE|N`s3cq@(0WB!n0uh@*c{=LAd;~} zyGK@hbF-Oo+!nN)@i*O(`@FA#u?o=~e{`4O#5}z&=UkU*50fOrzi11D^&FOqe>wii z?*k+2|EcUs;Gx{!@KBT~>PAwLrIDT7Th=Utu?~?np@t^gFs?zgX=D${RwOY^WGh-+ z+#4$066ISh8eYW#FXWp~S`<*%O^ZuItL1Tyqt8#tZ zY120E;^VG`!lZn&3sPd$RkdHpU#|w+bYV)pJC|SH9g%|5IkxVTQcBA4CL0}$&}ef@ zW^Vtj%M;;_1xxP9x#ex17&4N*{ksO*_4O}xYu(p*JkL#yr}@7b)t5X?%CY<+s5_MJ zuiqt+N_;A(_)%lumoyRFixWa-M7qK_9s6<1X?JDa9fP!+_6u~~M$5L=ipB=7(j#f< zZ34J%=bs549%~_mA(|={uZNs_0?o7;-LBP(ZRnkd{-^|2|=4vUTmtByHL8 zEph`(LSEzQj68a+`d$V<45J7cyv^#|^|%fD#si1Nx!4NW*`l*{->HEWNh6-|g>-=r zXmQ|-i}Ku$ndUeHQ^&ieT!Lf}vf6GaqW9$DJ2NWrqwPY%%4nip$@vK$nRp*_C-v<| zuKz~ZyN&<%!NS26&x?jhy+@awJipMQ-8(X4#Ae5??U<1QMt1l9R=w9fAnEF}NYu$2 z>6}Vkc zIb*A?G*z8^IvibmBKn_u^5&T_1oey0gZS2~obf(#xk=erZGTEdQnt3DMGM+0oPwss zj5zXD;(oWhB_T@~Ig#9@v)AKtXu3>Inmgf@A|-lD-1U>cNyl3h?ADD9)GG4}zUGPk zZzaXe!~Kf?<~@$G?Uql3t8jy9{2!doq4=J}j9ktTxss{p6!9UdjyDERlA*xZ!=Q)KDs5O)phz>Vq3BNGoM(H|=1*Q4$^2fTZw z(%nq1P|5Rt81}SYJpEEzMPl5VJsV5&4e)ZWKDyoZ>1EwpkHx-AQVQc8%JMz;{H~p{=FXV>jIxvm4X*qv52e?Y-f%DJ zxEA165GikEASQ^fH6K#d!Tpu2HP{sFs%E=e$gYd$aj$+xue6N+Wc(rAz~wUsk2`(b z8Kvmyz%bKQxpP}~baG-rwYcYCvkHOi zlkR<=>ZBTU*8RF_d#Bl@zZsRIhx<%~Z@Z=ik z>adw3!DK(8R|q$vy{FTxw%#xliD~6qXmY^7_9kthVPTF~Xy1CfBqbU~?1QmxmU=+k z(ggxvEuA;0e&+ci-zQR{-f7aO{O(Pz_OsEjLh_K>MbvoZ4nxtk5u{g@nPv)cgW_R} z9}EA4K4@z0?7ue}Z(o~R(X&FjejUI2g~08PH1E4w>9o{)S(?1>Z0XMvTb|;&EuyOE zGvWNpYX)Nv<8|a^;1>bh#&znEcl-r!T#pn= z4$?Yudha6F%4b>*8@=BdtXXY4N+`U4Dmx$}>HeVJk-QdTG@t!tVT#0(LeV0gvqyyw z2sEp^9eY0N`u10Tm4n8No&A=)IeEC|gnmEXoNSzu!1<4R<%-9kY_8~5Ej?zRegMn78wuMs#;i&eUA0Zk_RXQ3b&TT} z;SCI=7-FUB@*&;8|n>(_g^HGf3@QODE3LpmX~ELnymQm{Sx9xrKS zK29p~?v@R$0=v6Dr5aW>-!{+h@?Q58|Kz8{{W`%J+lDAdb&M5VHrX_mDY;1-JLnf)ezmPau$)1;=`-FU=-r-83tX=C`S#}GZufju zQ>sXNT0Ny=k@nc%cFnvA_i4SC)?_ORXHq8B4D%el1uPX`c~uG#S1M7C+*MMqLw78E zhY2dI8@+N^qrMI1+;TUda(vGqGSRyU{Fnm`aqrr7bz42c5xsOO-~oZpkzorD1g}Y<6rk&3>PsSGy}W?MtqFky@A(X# zIuNZK0cK?^=;PUAu>j0#HtjbHCV*6?jzA&OoE$*Jlga*}LF`SF?WLhv1O|zqC<>*> zYB;#lsYKx0&kH@BFpW8n*yDcc6?;_zaJs<-jPSkCsSX-!aV=P5kUgF@Nu<{a%#K*F z134Q{9|YX7X(v$62_cY3^G%t~rD>Q0z@)1|zs)vjJ6Jq9;7#Ki`w+eS**En?7;n&7 zu==V3T&eFboN3ZiMx3D8qYc;VjFUk_H-WWCau(VFXSQf~viH0L$gwD$UfFHqNcgN`x}M+YQ6RnN<+@t>JUp#)9YOkqst-Ga?{FsDpEeX0(5v{0J~SEbWiL zXC2}M4?UH@u&|;%0y`eb33ldo4~z-x8zY!oVmV=c+f$m?RfDC35mdQ2E>Pze7KWP- z>!Bh<&57I+O_^s}9Tg^k)h7{xx@0a0IA~GAOt2yy!X%Q$1rt~LbTB6@Du!_0%HV>N zlf)QI1&gvERKwso23mJ!Ou6ZS#zCS5W`gxE5T>C#E|{i<1D35C222I33?Njaz`On7 zi<+VWFP6D{e-{yiN#M|Jgk<44u1TiMI78S5W`Sdb5f+{zu34s{CfWN7a3Cf^@L%!& zN$?|!!9j2c)j$~+R6n#891w-z8(!oBpL2K=+%a$r2|~8-(vQj5_XT`<0Ksf;oP+tz z9CObS!0m)Tgg`K#xBM8B(|Z)Wb&DYL{WTYv`;A=q6~Nnx2+!lTIXtj8J7dZE!P_{z z#f8w6F}^!?^KE#+ZDv+xd5O&3EmomZzsv?>E-~ygGum45fk!SBN&|eo1rKw^?aZJ4 E2O(~oYXATM diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9502e869d..e6aba2515 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -# TODO: Wait for forge to fix gradle 8 support, once it did change gradle to a newer version -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c78733..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index b1e6b43cb..7a873a6bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,6 +23,9 @@ pluginManagement { } mavenCentral() gradlePluginPortal() + + // Not needed, but useful for debugging gradle plugins + mavenLocal() } } From 14d64d535a7b7b9c02f12ec5b7f58067e0464ed7 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 18:11:26 +1030 Subject: [PATCH 020/301] Changed preprocessor to use version numbers --- build.gradle | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 349ec564a..e8a34a59c 100644 --- a/build.gradle +++ b/build.gradle @@ -25,40 +25,30 @@ plugins { */ def writeBuildGradlePredefine(List mcVers, int mcIndex) { - ArrayList redefineList = new ArrayList() - - for (int i = 0; i < mcVers.size(); i++) - { - String fullVerStr = mcVers[i].replace(".", "_"); - String majorVerStr = fullVerStr.substring(0, fullVerStr.lastIndexOf("_")); - - if (mcIndex == i) - { - // exact - redefineList.add("MC_" + fullVerStr); - redefineList.add("MC_" + majorVerStr); - } - } - // Build the list of preprocessors to use StringBuilder sb = new StringBuilder(); sb.append("# DON'T TOUCH THIS FILE, This is handled by the build script\n"); + + + for (int i = 0; i < mcVers.size(); i++) + { + String verStr = mcVers[i].replace(".", "_"); + sb.append(verStr + "=" + i.toString() + "\n"); + + if (mcIndex == i) + sb.append("MC_VER=" + i.toString() + "\n"); + } + // Check if this is a development build if (mod_version.toLowerCase().contains("dev")) { // WARNING: only use this for logging, we don't want to have confusion // when a method doesn't work correctly in the release build. - sb.append("DEV_BUILD"); - sb.append("=\n"); - } - - // Build the MC version preprocessors - for (String redefinedVersion : redefineList) { - sb.append(redefinedVersion) - sb.append("=\n") + sb.append("DEV_BUILD=\n"); } + new File(projectDir, "build.properties").text = sb.toString() } From 61460f9ac0b7ad37b6eae83c09e7154a5100ed23 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 18:18:59 +1030 Subject: [PATCH 021/301] Updated java files to use version numbers --- build.gradle | 3 +- .../common/forge/LodForgeMethodCaller.java | 4 +- .../common/rendering/SeamlessOverdraw.java | 6 +- .../common/wrappers/McObjectConverter.java | 6 +- .../common/wrappers/VersionConstants.java | 2 +- .../common/wrappers/WrapperFactory.java | 4 +- .../common/wrappers/block/BiomeWrapper.java | 34 +++++------ .../wrappers/block/BlockStateWrapper.java | 20 +++---- .../block/TextureAtlasSpriteWrapper.java | 4 +- .../block/TintGetterOverrideFast.java | 4 +- .../block/TintGetterOverrideSmooth.java | 4 +- .../block/TintWithoutLevelOverrider.java | 8 +-- .../TintWithoutLevelSmoothOverrider.java | 8 +-- .../block/cache/ClientBlockDetailMap.java | 2 +- .../block/cache/ClientBlockStateCache.java | 10 ++-- .../block/cache/ServerBlockDetailMap.java | 2 +- .../common/wrappers/chunk/ChunkWrapper.java | 38 ++++++------ .../common/wrappers/gui/ClassicConfigGUI.java | 18 +++--- .../common/wrappers/gui/DhScreen.java | 6 +- .../common/wrappers/gui/GuiHelper.java | 14 ++--- .../common/wrappers/gui/MinecraftScreen.java | 10 ++-- .../wrappers/gui/TexturedButtonWidget.java | 23 ++++---- .../wrappers/gui/updater/ChangelogScreen.java | 16 ++--- .../wrappers/gui/updater/UpdateModScreen.java | 6 +- .../minecraft/MinecraftClientWrapper.java | 8 +-- .../minecraft/MinecraftRenderWrapper.java | 26 ++++----- .../wrappers/misc/ServerPlayerWrapper.java | 2 +- .../wrappers/world/ClientLevelWrapper.java | 2 +- .../wrappers/world/ServerLevelWrapper.java | 2 +- .../BatchGenerationEnvironment.java | 18 +++--- .../worldGeneration/GlobalParameters.java | 18 +++--- .../worldGeneration/ThreadedParameters.java | 14 ++--- .../mimicObject/ChunkLoader.java | 58 +++++++++---------- .../mimicObject/DhLitWorldGenRegion.java | 20 +++---- .../mimicObject/DummyLightEngine.java | 6 +- .../mimicObject/LightGetterAdaptor.java | 8 +-- .../RegionFileStorageExternalCache.java | 8 +-- .../WorldGenStructFeatManager.java | 30 +++++----- .../worldGeneration/step/StepBiomes.java | 10 ++-- .../worldGeneration/step/StepFeatures.java | 4 +- .../worldGeneration/step/StepNoise.java | 12 ++-- .../step/StepStructureReference.java | 2 +- .../step/StepStructureStart.java | 10 ++-- .../worldGeneration/step/StepSurface.java | 4 +- .../fabric/FabricClientProxy.java | 4 +- .../distanthorizons/fabric/FabricMain.java | 4 +- .../mixins/client/MixinClientLevel.java | 8 +-- .../client/MixinClientPacketListener.java | 6 +- .../mixins/client/MixinFogRenderer.java | 8 +-- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 14 ++--- .../fabric/mixins/client/MixinMinecraft.java | 6 +- .../mixins/client/MixinOptionsScreen.java | 6 +- .../mixins/client/MixinTextureUtil.java | 2 +- .../mixins/events/MixinServerLevel.java | 2 +- .../mods/sodium/MixinSodiumRenderer.java | 4 +- .../mixins/server/MixinChunkGenerator.java | 2 +- .../fabric/mixins/server/MixinChunkMap.java | 4 +- .../server/MixinUtilBackgroundThread.java | 4 +- .../server/unsafe/MixinThreadingDetector.java | 2 +- .../wrappers/modAccessor/BCLibAccessor.java | 6 +- .../wrappers/modAccessor/IrisAccessor.java | 2 +- .../wrappers/modAccessor/SodiumAccessor.java | 10 ++-- .../forge/ForgeClientProxy.java | 26 ++++----- .../distanthorizons/forge/ForgeMain.java | 22 +++---- .../forge/ForgeServerProxy.java | 16 ++--- .../client/MixinClientPacketListener.java | 2 +- .../forge/mixins/client/MixinFogRenderer.java | 8 +-- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 22 +++---- .../forge/mixins/client/MixinMinecraft.java | 6 +- .../mixins/client/MixinOptionsScreen.java | 6 +- .../mixins/server/MixinChunkGenerator.java | 2 +- .../mixins/server/MixinTFChunkGenerator.java | 4 +- .../server/MixinUtilBackgroundThread.java | 4 +- .../server/unsafe/MixinThreadingDetector.java | 2 +- gradle.properties | 2 +- 77 files changed, 361 insertions(+), 373 deletions(-) diff --git a/build.gradle b/build.gradle index e8a34a59c..2656dd32f 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) for (int i = 0; i < mcVers.size(); i++) { String verStr = mcVers[i].replace(".", "_"); - sb.append(verStr + "=" + i.toString() + "\n"); + sb.append("MC_" + verStr + "=" + i.toString() + "\n"); if (mcIndex == i) sb.append("MC_VER=" + i.toString() + "\n"); @@ -477,7 +477,6 @@ allprojects { p -> maven { url "https://maven.architectury.dev" } // For Git repositories - // navigating to the URL in a web browser allows for testing and viewing possible downloads maven { url "https://jitpack.io" } // For Manifold Preprocessor diff --git a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java index 66883973a..b8b2add63 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.common.forge; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_19_2 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; @@ -41,7 +41,7 @@ import java.util.Random; */ public interface LodForgeMethodCaller { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19 #else List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java index e3d3f142c..e6795c666 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java @@ -19,11 +19,9 @@ package com.seibel.distanthorizons.common.rendering; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 - +#if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else - import org.joml.Matrix4f; #endif import com.seibel.distanthorizons.core.config.Config; @@ -43,7 +41,7 @@ public class SeamlessOverdraw { float[] matrixFloatArray; - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16); minecraftProjectionMatrix.store(matrixFloatBuffer); matrixFloatArray = matrixFloatBuffer.array(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java index 9d81c9264..b37282f4d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java @@ -23,7 +23,7 @@ import java.nio.FloatBuffer; import java.util.function.BiConsumer; import java.util.function.Consumer; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 +#if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else import org.joml.Matrix4f; @@ -54,7 +54,7 @@ public class McObjectConverter /** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */ private static void storeMatrix(Matrix4f matrix, FloatBuffer buffer) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 matrix.store(buffer); #else // Mojang starts to use joml's Matrix4f libary in 1.19.3 so we copy their store method and use it here if its newer than 1.19.3 @@ -83,7 +83,7 @@ public class McObjectConverter FloatBuffer buffer = FloatBuffer.allocate(16); storeMatrix(mcMatrix, buffer); Mat4f matrix = new Mat4f(buffer); - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it #endif return matrix; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java index 2853bb0c2..925ae4adb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java @@ -59,7 +59,7 @@ public class VersionConstants implements IVersionConstants @Override public String getMinecraftVersion() { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 return Minecraft.getInstance().getGame().getVersion().getId(); #else return SharedConstants.getCurrentVersion().getId(); 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 5992f67a6..8b597fbfd 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 @@ -106,7 +106,7 @@ public class WrapperFactory implements IWrapperFactory } } - #if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER // Always true else if (objectArray.length == 2) { // correct number of parameters from the API @@ -173,7 +173,7 @@ public class WrapperFactory implements IWrapperFactory "Chunk wrapper creation failed. \n" + "Expected parameters: \n"); - #if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER // Always true message.append("[" + ChunkAccess.class.getName() + "], \n"); message.append("[" + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + "]. \n"); #else 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 3440b5b4d..843817892 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 @@ -33,18 +33,10 @@ import org.apache.logging.log4j.Logger; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; import net.minecraft.client.Minecraft; -#if POST_MC_1_17 -import net.minecraft.core.Holder; -import net.minecraft.resources.RegistryOps; -#endif -#if MC_1_19_4 || MC_1_20 -#endif - - -#if MC_1_16_5 || MC_1_17 +#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 import net.minecraft.core.Registry; -#elif MC_1_18 || MC_1_19_2 +#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; @@ -56,7 +48,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome; -#if !MC_1_16 || MC_1_17 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.biome.Biomes; #endif @@ -66,7 +58,7 @@ public class BiomeWrapper implements IBiomeWrapper { private static final Logger LOGGER = LogManager.getLogger(); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 public static final ConcurrentMap WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #else public static final ConcurrentMap, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); @@ -89,7 +81,7 @@ public class BiomeWrapper implements IBiomeWrapper // properties // - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 public final Biome biome; #else public final Holder biome; @@ -104,7 +96,7 @@ public class BiomeWrapper implements IBiomeWrapper // constructors // //==============// - static public IBiomeWrapper getBiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) + static public IBiomeWrapper getBiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) { if (biome == null) { @@ -124,7 +116,7 @@ public class BiomeWrapper implements IBiomeWrapper } } - private BiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) + private BiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) { this.biome = biome; this.serialString = this.serialize(levelWrapper); @@ -145,7 +137,7 @@ public class BiomeWrapper implements IBiomeWrapper return EMPTY_STRING; } - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 return biome.toString(); #else return this.biome.unwrapKey().orElse(Biomes.THE_VOID).registry().toString(); @@ -214,9 +206,9 @@ public class BiomeWrapper implements IBiomeWrapper net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); ResourceLocation resourceLocation; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome); - #elif MC_1_18 || MC_1_19_2 + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value()); #else resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value()); @@ -225,7 +217,7 @@ public class BiomeWrapper implements IBiomeWrapper if (resourceLocation == null) { String biomeName; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 biomeName = this.biome.toString(); #else biomeName = this.biome.value().toString(); @@ -277,10 +269,10 @@ public class BiomeWrapper implements IBiomeWrapper net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); boolean success; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); success = (biome != null); - #elif MC_1_18 || MC_1_19_2 + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); success = (unwrappedBiome != null); Holder biome = new Holder.Direct<>(unwrappedBiome); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 6c6c12999..23e635044 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -32,11 +32,11 @@ import java.io.IOException; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -#if MC_1_16_5 || MC_1_17 +#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 import net.minecraft.core.Registry; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; -#elif MC_1_18 || MC_1_19_2 +#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 import net.minecraft.client.Minecraft; import net.minecraft.world.level.Level; import net.minecraft.core.BlockPos; @@ -252,7 +252,7 @@ public class BlockStateWrapper implements IBlockStateWrapper @Override public boolean isSolid() { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 return this.blockState.getMaterial().isSolid(); #else return !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty(); @@ -267,7 +267,7 @@ public class BlockStateWrapper implements IBlockStateWrapper return false; } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 return this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty(); #else return !this.blockState.getFluidState().isEmpty(); @@ -293,15 +293,15 @@ public class BlockStateWrapper implements IBlockStateWrapper // older versions of MC have a static registry - #if !(MC_1_16_5 || MC_1_17) + #if MC_VER > MC_1_17_1 Level level = (Level)levelWrapper.getWrappedMcObject(); net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); #endif ResourceLocation resourceLocation; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock()); - #elif MC_1_18 || MC_1_19_2 + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock()); #else resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock()); @@ -356,16 +356,16 @@ public class BlockStateWrapper implements IBlockStateWrapper try { - #if !(MC_1_16_5 || MC_1_17) + #if MC_VER > MC_1_17_1 // use the given level if possible, otherwise try using the currently loaded one Level level = (levelWrapper != null ? (Level)levelWrapper.getWrappedMcObject() : null); level = (level == null ? Minecraft.getInstance().level : level); #endif Block block; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 block = Registry.BLOCK.get(resourceLocation); - #elif MC_1_18 || MC_1_19_2 + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation); #else diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java index da309c851..3b777e533 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java @@ -40,11 +40,11 @@ public class TextureAtlasSpriteWrapper */ public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return sprite.mainImage[0].getPixelRGBA( x + sprite.framesX[frameIndex] * sprite.getWidth(), y + sprite.framesY[frameIndex] * sprite.getHeight()); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 if (sprite.animatedTexture != null) { x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index ed4cad81a..04c8c1d98 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -50,7 +50,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -167,7 +167,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index 6ff85ee1c..c67d8c3e4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -53,7 +53,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -193,7 +193,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { 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 c4728dfee..ab8876e74 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 @@ -29,7 +29,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.core.Holder; #endif @@ -46,9 +46,9 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder #else Biome #endif biome) { - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 return biome.value(); #else return biome; @@ -84,7 +84,7 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter } - #if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER == MC_1_17_1 || MC_VER > MC_1_18_2 @Override public int getHeight() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java index 5aacf7efb..0c293eb7f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java @@ -30,7 +30,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.core.Holder; #endif @@ -49,9 +49,9 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder #else Biome #endif biome) { - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 return biome.value(); #else return biome; @@ -116,7 +116,7 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter } - #if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER >= MC_1_17_1 && MC_VER != MC_1_18_2 @Override public int getHeight() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java index 864be6cd5..e05b1a966 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; public class ClientBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_VER < MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ClientLevelWrapper level; public ClientBlockDetailMap(ClientLevelWrapper level) { this.level = level; } 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 9f8de4c95..629a705f3 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 @@ -38,7 +38,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FlowerBlock; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RotatedPillarBlock; -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_19_2 import net.minecraft.util.RandomSource; #else import java.util.Random; @@ -60,7 +60,7 @@ public class ClientBlockStateCache private static final HashSet BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); private static final HashSet BROKEN_BLOCK_STATES = new HashSet<>(); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public static final Random random = new Random(0); #else public static final RandomSource random = RandomSource.create(); @@ -102,7 +102,7 @@ public class ClientBlockStateCache private static int getWidth(TextureAtlasSprite texture) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 return texture.getWidth(); #else return texture.contents().width(); @@ -111,7 +111,7 @@ public class ClientBlockStateCache private static int getHeight(TextureAtlasSprite texture) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 return texture.getHeight(); #else return texture.contents().height(); @@ -211,7 +211,7 @@ public class ClientBlockStateCache needShade = quads.get(0).isShade(); tintIndex = quads.get(0).getTintIndex(); baseColor = calculateColorFromTexture( - #if MC_1_16 quads.get(0).sprite, + #if MC_VER < MC_1_17_1 quads.get(0).sprite, #else quads.get(0).getSprite(), #endif ColorMode.getColorMode(blockState.getBlock())); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java index 28b69397f..22dfd9ca8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java @@ -29,7 +29,7 @@ import net.minecraft.world.level.block.state.BlockState; public class ServerBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_VER < MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ServerLevelWrapper level; public ServerBlockDetailMap(ServerLevelWrapper level) { this.level = level; } 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 3c5b2a2d4..b92d0e8ce 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 @@ -47,27 +47,27 @@ import org.apache.logging.log4j.Logger; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 import net.minecraft.core.QuartPos; #endif -#if MC_1_16_5 +#if MC_VER == MC_1_16_5 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_17 +#if MC_VER == MC_1_17_1 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_18 +#if MC_VER == MC_1_18_2 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_19 +#if MC_VER == MC_1_19_2 || MC_VER == MC_1_19_4 import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.core.SectionPos; @@ -145,7 +145,7 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getHeight() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return 255; #else return this.chunk.getHeight(); @@ -155,7 +155,7 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getMinBuildHeight() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return 0; #else return this.chunk.getMinBuildHeight(); @@ -175,13 +175,13 @@ public class ChunkWrapper implements IChunkWrapper continue; } - #if MC_1_16_5 + #if MC_VER == MC_1_16_5 if (!sections[index].isEmpty()) { // convert from an index to a block coordinate return this.chunk.getSections()[index].bottomBlockY() * 16; } - #elif MC_1_17 + #elif MC_VER == MC_1_17_1 if (!sections[index].isEmpty()) { // convert from an index to a block coordinate @@ -210,15 +210,15 @@ public class ChunkWrapper implements IChunkWrapper @Override public IBiomeWrapper getBiome(int relX, int relY, int relZ) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome( relX >> 2, relY >> 2, relZ >> 2), this.wrappedLevel); - #elif MC_1_16 || MC_1_17 + #elif MC_VER < MC_1_18_2 return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome( QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)), this.wrappedLevel); - #elif MC_1_16 || MC_1_17 + #elif MC_VER < MC_1_18_2 return BiomeWrapper.getBiomeWrapper(this.chunk.getNoiseBiome( QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)), this.wrappedLevel); @@ -264,7 +264,7 @@ public class ChunkWrapper implements IChunkWrapper } - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 return false; // MC's lighting engine doesn't work consistently enough to trust for 1.16 or 1.17 #else if (this.chunk instanceof LevelChunk) @@ -387,7 +387,7 @@ public class ChunkWrapper implements IChunkWrapper this.blockLightPosList = new ArrayList<>(); - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 this.chunk.getLights().forEach((blockPos) -> { this.blockLightPosList.add(new DhBlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ())); @@ -454,7 +454,7 @@ public class ChunkWrapper implements IChunkWrapper public static void syncedUpdateClientLightStatus() { - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 // TODO: Check what to do in 1.18.1 and older // since we don't currently handle this list, @@ -481,16 +481,16 @@ public class ChunkWrapper implements IChunkWrapper LevelChunk levelChunk = (LevelChunk) this.chunk; ClientChunkCache clientChunkCache = ((ClientLevel) levelChunk.getLevel()).getChunkSource(); this.isMcClientLightingCorrect = clientChunkCache.getChunkForLighting(this.chunk.getPos().x, this.chunk.getPos().z) != null && - #if MC_1_16_5 || MC_1_17 + #if MC_VER <= MC_1_17_1 levelChunk.isLightCorrect(); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #elif MC_VER < MC_1_20_1 levelChunk.isClientLightReady(); #else checkLightSectionsOnChunk(levelChunk, levelChunk.getLevel().getLightEngine()); #endif } } - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine) { LevelChunkSection[] sections = chunk.getSections(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 1b041665f..a7a87c7cb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -35,7 +35,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 +#if MC_VER < MC_1_20_1 import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.GuiComponent; #else @@ -49,7 +49,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.client.resources.language.I18n; // translation -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 import net.minecraft.client.gui.narration.NarratableEntry; #endif import net.minecraft.resources.ResourceLocation; @@ -379,13 +379,13 @@ public class ClassicConfigGUI } @Override - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 // 1.20.2 now enables this by default in the `this.list.render` function + #if MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function this.renderBackground(matrices); // Renders background #else super.render(matrices, mouseX, mouseY, delta); @@ -441,7 +441,7 @@ public class ClassicConfigGUI } } } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 super.render(matrices, mouseX, mouseY, delta); #endif } @@ -539,7 +539,7 @@ public class ClassicConfigGUI public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 + #if MC_VER < MC_1_20_4 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); @@ -605,7 +605,7 @@ public class ClassicConfigGUI } @Override - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) #else public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) @@ -627,7 +627,7 @@ public class ClassicConfigGUI indexButton.render(matrices, mouseX, mouseY, tickDelta); } if (text != null && (!text.getString().contains("spacer") || button != null)) - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 GuiComponent.drawString(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF); #else matrices.drawString(textRenderer, text, 12, y + 5, 0xFFFFFF); @@ -642,7 +642,7 @@ public class ClassicConfigGUI // Only for 1.17 and over // Remove in 1.16 and below - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java index 37e1cc0d9..5309e6565 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java @@ -1,7 +1,7 @@ package com.seibel.distanthorizons.common.wrappers.gui; import net.minecraft.client.gui.Font; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 +#if MC_VER < MC_1_20_1 import com.mojang.blaze3d.vertex.PoseStack; #else import net.minecraft.client.gui.GuiGraphics; @@ -24,14 +24,14 @@ public class DhScreen extends Screen // addButton in 1.16 and below protected Button addBtn(Button button) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return this.addButton(button); #else return this.addRenderableWidget(button); #endif } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 protected void DhDrawCenteredString(PoseStack guiStack, Font font, Component text, int x, int y, int color) { drawCenteredString(guiStack, font, text, x, y, color); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java index 86183b3b2..18274f77c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java @@ -5,7 +5,7 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; #endif @@ -17,7 +17,7 @@ public class GuiHelper */ public static Button MakeBtn(Component base, int a, int b, int c, int d, Button.OnPress action) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 return new Button(a, b, c, d, base, action); #else return Button.builder(base, action).bounds(a, b, c, d).build(); @@ -26,7 +26,7 @@ public class GuiHelper public static MutableComponent TextOrLiteral(String text) { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 return new TextComponent(text); #else return Component.literal(text); @@ -35,7 +35,7 @@ public class GuiHelper public static MutableComponent TextOrTranslatable(String text) { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 return new TextComponent(text); #else return Component.translatable(text); @@ -44,7 +44,7 @@ public class GuiHelper public static MutableComponent Translatable(String text, Object... args) { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 return new TranslatableComponent(text, args); #else return Component.translatable(text, args); @@ -53,7 +53,7 @@ public class GuiHelper public static void SetX(AbstractWidget w, int x) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 w.x = x; #else w.setX(x); @@ -62,7 +62,7 @@ public class GuiHelper public static void SetY(AbstractWidget w, int y) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 w.y = y; #else w.setY(y); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index 572d4ef1d..6dcc5a746 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.config.gui.AbstractScreen; import net.minecraft.client.Minecraft; -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 import net.minecraft.client.gui.GuiGraphics; #endif import net.minecraft.client.gui.components.ContainerObjectSelectionList; @@ -28,7 +28,7 @@ public class MinecraftScreen private AbstractScreen screen; - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public static net.minecraft.network.chat.TranslatableComponent translate(String str, Object... args) { return new net.minecraft.network.chat.TranslatableComponent(str, args); @@ -66,13 +66,13 @@ public class MinecraftScreen } @Override - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background @@ -133,7 +133,7 @@ public class MinecraftScreen { public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 + #if MC_VER < MC_1_20_4 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java index 037034280..c589fcf4c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java @@ -34,18 +34,17 @@ import net.minecraft.client.gui.components.ImageButton; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 import net.minecraft.client.renderer.GameRenderer; #endif - -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 +#if MC_VER < MC_1_20_1 import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; #else import net.minecraft.client.gui.GuiGraphics; #endif -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 +#if MC_VER < MC_1_20_2 public class TexturedButtonWidget extends ImageButton #else public class TexturedButtonWidget extends Button @@ -53,7 +52,7 @@ public class TexturedButtonWidget extends Button { public final boolean renderBackground; - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER >= MC_1_20_2 private final int u; private final int v; private final int hoveredVOffset; @@ -70,7 +69,7 @@ public class TexturedButtonWidget extends Button } public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, Component text, boolean renderBackground) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text); #else // We don't pass on the text option as otherwise it will render (we normally pass it for narration) @@ -90,13 +89,13 @@ public class TexturedButtonWidget extends Button this.renderBackground = renderBackground; } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_20_2 + #if MC_VER < MC_1_19_4 @Override public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { if (this.renderBackground) // Renders the background of the button { - #if MC_1_16 + #if MC_VER < MC_1_17_1 Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION); RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha); #else @@ -109,7 +108,7 @@ public class TexturedButtonWidget extends Button RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableDepthTest(); - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height); this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); #else @@ -121,7 +120,7 @@ public class TexturedButtonWidget extends Button super.renderButton(matrices, mouseX, mouseY, delta); } #else - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 @Override public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta) { @@ -139,7 +138,7 @@ public class TexturedButtonWidget extends Button if (!this.active) i = 0; else if (this.isHovered) i = 2; - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableDepthTest(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index be2c549a9..e66d7c3f8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -15,11 +15,11 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 import net.minecraft.client.gui.narration.NarratableEntry; #endif -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 +#if MC_VER < MC_1_20_1 import net.minecraft.client.gui.GuiComponent; #else import net.minecraft.client.gui.GuiGraphics; @@ -144,13 +144,13 @@ public class ChangelogScreen extends DhScreen } @Override - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background @@ -161,7 +161,7 @@ public class ChangelogScreen extends DhScreen // Set the scroll position to the mouse height relative to the screen // This is a bit of a hack as we cannot scroll on this area double scrollAmount = ((double) mouseY) / ((double) this.height) * 1.1 * this.changelogArea.getMaxScroll(); - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 this.changelogArea.setScrollAmount(scrollAmount); #else this.changelogArea.scrollAmount = scrollAmount; @@ -187,7 +187,7 @@ public class ChangelogScreen extends DhScreen public TextArea(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 + #if MC_VER < MC_1_20_4 super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); @@ -225,7 +225,7 @@ public class ChangelogScreen extends DhScreen return new ButtonEntry(text); } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 @Override public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { @@ -244,7 +244,7 @@ public class ChangelogScreen extends DhScreen { return children; } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index a03323457..6207d06ff 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -11,7 +11,7 @@ import com.seibel.distanthorizons.core.jar.JarUtils; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import net.minecraft.client.Minecraft; -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 import net.minecraft.client.gui.GuiGraphics; #else import com.mojang.blaze3d.vertex.PoseStack; @@ -146,13 +146,13 @@ public class UpdateModScreen extends DhScreen } @Override - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 public void render(PoseStack matrices, int mouseX, int mouseY, float delta) #else public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta) #endif { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 this.renderBackground(matrices); // Render background #else this.renderBackground(matrices, mouseX, mouseY, delta); // Render background diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index 4fc7d68e8..f0d3dc654 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -47,7 +47,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TextComponent; #endif import net.minecraft.server.level.ServerLevel; @@ -197,7 +197,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra @Override public DhChunkPos getPlayerChunkPos() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 ChunkPos playerPos = new ChunkPos(getPlayer().blockPosition()); #else ChunkPos playerPos = getPlayer().chunkPosition(); @@ -262,7 +262,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra { LocalPlayer p = getPlayer(); if (p == null) return; - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 p.sendMessage(new TextComponent(string), getPlayer().getUUID()); #else p.sendSystemMessage(net.minecraft.network.chat.Component.translatable(string)); @@ -282,7 +282,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra { LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception); CrashReport report = new CrashReport(errorMessage, exception); - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2 + #if MC_VER < MC_1_20_4 Minecraft.crash(report); #else Minecraft.getInstance().delayCrash(report); 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 0131998fc..6a8ae1318 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 @@ -39,12 +39,12 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.render.DhApiRenderProxy; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 +#if MC_VER < MC_1_19_4 import com.mojang.math.Vector3f; #else import org.joml.Vector3f; #endif -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER >= MC_1_20_2 import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; #endif @@ -67,7 +67,7 @@ import net.minecraft.client.renderer.FogRenderer; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.effect.MobEffects; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.FluidState; @@ -133,7 +133,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper public boolean playerHasBlindingEffect() { return MC.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null - #if MC_1_19 || MC_1_20 + #if MC_VER >= MC_1_19_2 || MC.player.getActiveEffectsMap().get(MobEffects.DARKNESS) != null // Deep dark effect #endif ; @@ -151,7 +151,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public Mat4f getDefaultProjectionMatrix(float partialTicks) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return McObjectConverter.Convert(Minecraft.getInstance().gameRenderer.getProjectionMatrix(Minecraft.getInstance().gameRenderer.getMainCamera(), partialTicks, true)); #else return McObjectConverter.Convert(MC.gameRenderer.getProjectionMatrix(MC.gameRenderer.getFov(MC.gameRenderer.getMainCamera(), partialTicks, true))); @@ -161,7 +161,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public double getGamma() { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 return MC.options.gamma; #else return MC.options.gamma().get(); @@ -171,7 +171,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public Color getFogColor(float partialTicks) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 float[] colorValues = new float[4]; GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues); #else @@ -192,7 +192,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { if (MC.level.dimensionType().hasSkyLight()) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime()); #else Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime()); @@ -213,7 +213,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public int getRenderDistance() { - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 //FIXME: How to resolve this? return MC.options.renderDistance; #else @@ -321,15 +321,15 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { try { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER < MC_1_20_2 LevelRenderer levelRenderer = MC.levelRenderer; Collection chunks = - #if MC_1_16 || MC_1_17 levelRenderer.renderChunks; + #if MC_VER < MC_1_18_2 levelRenderer.renderChunks; #else levelRenderer.renderChunkStorage.get().renderChunks; #endif return (chunks.stream().map((chunk) -> { AABB chunkBoundingBox = - #if MC_1_16 || MC_1_17 chunk.chunk.bb; + #if MC_VER < MC_1_18_2 chunk.chunk.bb; #else chunk.chunk.getBoundingBox(); #endif return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), Math.floorDiv((int) chunkBoundingBox.minZ, 16)); @@ -371,7 +371,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public boolean isFogStateSpecial() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera(); FluidState fluidState = camera.getFluidInCamera(); Entity entity = camera.getEntity(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java index eb70a535b..a9a401c04 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java @@ -33,7 +33,7 @@ public class ServerPlayerWrapper implements IServerPlayerWrapper public IServerLevelWrapper getLevel() { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 return ServerLevelWrapper.getWrapper(this.serverPlayer.getLevel()); #else return ServerLevelWrapper.getWrapper(this.serverPlayer.serverLevel()); 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 78138d85b..989d017bc 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 @@ -136,7 +136,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper @Override public int getMinHeight() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return 0; #else return this.level.getMinBuildHeight(); 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 28d7c6281..0728a01f3 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 @@ -130,7 +130,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper @Override public int getMinHeight() { - #if MC_1_16 + #if MC_VER < MC_1_17_1 return 0; #else return level.getMinBuildHeight(); 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 b0549a495..65e9c37b9 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 @@ -56,7 +56,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStruc import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStructureStart; import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepSurface; -#if MC_1_19_4 || MC_1_20 +#if MC_VER > MC_1_19_4 import net.minecraft.core.registries.Registries; #else import net.minecraft.core.Registry; @@ -365,9 +365,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv private static ProtoChunk EmptyChunk(ServerLevel level, ChunkPos chunkPos) { return new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_1_18 || MC_1_19 || MC_1_20 , level #endif - #if MC_1_18 || MC_1_19 || MC_1_20 , level.registryAccess().registryOrThrow( - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER > MC_1_17_1 , level #endif + #if MC_VER > MC_1_18_2 , level.registryAccess().registryOrThrow( + #if MC_VER < MC_1_19_4 Registry.BIOME_REGISTRY #else Registries.BIOME @@ -463,8 +463,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv if (target == null) { target = new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_1_18 || MC_1_19 || MC_1_20 , params.level #endif - #if MC_1_18 || MC_1_19 || MC_1_20 , params.biomes, null #endif + #if MC_VER > MC_1_17_1 , params.level #endif + #if MC_VER > MC_1_18_2 , params.biomes, null #endif ); } return target; @@ -507,7 +507,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv ChunkAccess target = wrappedChunk.getChunk(); if (target instanceof LevelChunk) { - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 ((LevelChunk) target).setLoaded(true); #else ((LevelChunk) target).loaded = true; @@ -520,7 +520,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk; - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 boolean isPartial = target.isOldNoiseGeneration(); #endif if (isFull) @@ -528,7 +528,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv LOAD_LOGGER.info("Detected full existing chunk at {}", target.getPos()); genEvent.resultConsumer.accept(wrappedChunk); } - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 else if (isPartial) { LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java index d3240b09a..51da9ca78 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java @@ -31,16 +31,16 @@ import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.chunk.ChunkGenerator; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.chunk.storage.ChunkScanAccess; #endif import net.minecraft.world.level.levelgen.WorldGenSettings; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; #else import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import net.minecraft.world.level.levelgen.RandomState; -#if MC_1_19_4 || MC_1_20 +#if MC_VER > MC_1_19_4 import net.minecraft.world.level.levelgen.WorldOptions; import net.minecraft.core.registries.Registries; #endif @@ -50,13 +50,13 @@ import net.minecraft.world.level.storage.WorldData; public final class GlobalParameters { public final ChunkGenerator generator; - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public final StructureManager structures; #else public final StructureTemplateManager structures; public final RandomState randomState; #endif - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 public final WorldGenSettings worldGenSettings; #else public final WorldOptions worldOptions; @@ -67,7 +67,7 @@ public final class GlobalParameters public final RegistryAccess registry; public final long worldSeed; public final DataFixer fixerUpper; - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 public final BiomeManager biomeManager; public final ChunkScanAccess chunkScanner; // FIXME: Figure out if this is actually needed #endif @@ -81,7 +81,7 @@ public final class GlobalParameters WorldData worldData = server.getWorldData(); registry = server.registryAccess(); - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 worldGenSettings = worldData.worldGenSettings(); biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY); worldSeed = worldGenSettings.seed(); @@ -90,14 +90,14 @@ public final class GlobalParameters biomes = registry.registryOrThrow(Registries.BIOME); worldSeed = worldOptions.seed(); #endif - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed)); chunkScanner = level.getChunkSource().chunkScanner(); #endif structures = server.getStructureManager(); generator = level.getChunkSource().getGenerator(); fixerUpper = server.getFixerUpper(); - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_19_2 randomState = level.getChunkSource().randomState(); #endif } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java index 3b6bb23d5..db8a70195 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java @@ -25,7 +25,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.Wo import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.WorldGenLevel; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif @@ -35,7 +35,7 @@ public final class ThreadedParameters final ServerLevel level; public WorldGenStructFeatManager structFeat = null; - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 public StructureCheck structCheck; #endif boolean isValid = true; @@ -63,9 +63,9 @@ public final class ThreadedParameters previousGlobalParameters = param; this.level = param.level; - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 this.structFeat = new WorldGenStructFeatManager(param.worldGenSettings, level); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER < MC_1_19_2 this.structCheck = this.createStructureCheck(param); #else this.structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures, @@ -80,15 +80,15 @@ public final class ThreadedParameters public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param) { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 - structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , structCheck #endif ); + #if MC_VER < MC_1_19_4 + structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_VER > MC_1_18_2 , structCheck #endif ); #else structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck); #endif } - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2 public void recreateStructureCheck() { if (previousGlobalParameters != null) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 9986c402c..bdae4bb2e 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -37,7 +37,7 @@ import java.util.Objects; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; -#if MC_1_19_4 || MC_1_20 +#if MC_VER > MC_1_19_4 import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; #endif @@ -55,24 +55,24 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.*; import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.minecraft.world.level.levelgen.Heightmap; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.levelgen.blending.BlendingData; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.feature.StructureFeature; #endif import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.ticks.LevelChunkTicks; #endif -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.core.Holder; import net.minecraft.core.RegistryAccess; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; #endif #endif -#if MC_1_16_5 || MC_1_17 +#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 import net.minecraft.world.level.material.Fluids; #endif @@ -81,9 +81,9 @@ import net.minecraft.world.level.material.Fluid; public class ChunkLoader { - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_19_2 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); - #elif MC_1_18 || MC_1_19 || MC_1_20 + #elif MC_VER > MC_1_18_2 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); #endif private static final String TAG_UPGRADE_DATA = "UpgradeData"; @@ -93,7 +93,7 @@ public class ChunkLoader private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks"; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER; - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 private static BlendingData readBlendingData(CompoundTag chunkData) { BlendingData blendingData = null; @@ -109,16 +109,16 @@ public class ChunkLoader private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData) { - #if MC_1_18 || MC_1_19 || MC_1_20 - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER > MC_1_18_2 + #if MC_VER < MC_1_19_4 Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); #else Registry biomes = level.registryAccess().registryOrThrow(Registries.BIOME); #endif - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 Codec> biomeCodec = PalettedContainer.codec( biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER < MC_1_19_2 Codec>> biomeCodec = PalettedContainer.codec( biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); #else @@ -126,7 +126,7 @@ public class ChunkLoader biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); #endif #endif - int i = #if MC_1_16 16; #else level.getSectionsCount(); #endif + int i = #if MC_VER < MC_1_17_1 16; #else level.getSectionsCount(); #endif LevelChunkSection[] chunkSections = new LevelChunkSection[i]; boolean isLightOn = chunkData.getBoolean("isLightOn"); @@ -139,7 +139,7 @@ public class ChunkLoader CompoundTag tagSection = tagSections.getCompound(j); int sectionYPos = tagSection.getByte("Y"); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12)) { LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4); @@ -147,7 +147,7 @@ public class ChunkLoader tagSection.getLongArray("BlockStates")); levelChunkSection.recalcBlockCounts(); if (!levelChunkSection.isEmpty()) - chunkSections[#if MC_1_16 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] + chunkSections[#if MC_VER < MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] = levelChunkSection; } #else @@ -155,7 +155,7 @@ public class ChunkLoader if (sectionId >= 0 && sectionId < chunkSections.length) { PalettedContainer blockStateContainer; - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 PalettedContainer biomeContainer; #else PalettedContainer> biomeContainer; @@ -165,7 +165,7 @@ public class ChunkLoader ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 biomeContainer = tagSection.contains("biomes", 10) ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); @@ -174,7 +174,7 @@ public class ChunkLoader ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error) : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); #endif - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); #else chunkSections[sectionId] = new LevelChunkSection(blockStateContainer, biomeContainer); @@ -223,7 +223,7 @@ public class ChunkLoader public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) { - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 CompoundTag tagLevel = chunkData.getCompound("Level"); #else CompoundTag tagLevel = chunkData; @@ -237,12 +237,12 @@ public class ChunkLoader } ChunkStatus.ChunkType chunkType = readChunkType(tagLevel); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK) return null; #else BlendingData blendingData = readBlendingData(tagLevel); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise())) return null; #else @@ -255,27 +255,27 @@ public class ChunkLoader //================== Read params for making the LevelChunk ================== UpgradeData upgradeData = tagLevel.contains(TAG_UPGRADE_DATA, 10) - ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ) + ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_VER > MC_1_17_1 , level #endif ) : UpgradeData.EMPTY; boolean isLightOn = tagLevel.getBoolean("isLightOn"); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer( - level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif , + level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_VER > MC_1_17_1 , level #endif , chunkPos, level.getLevel().getChunkSource().getGenerator().getBiomeSource(), tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null); TickList blockTicks = tagLevel.contains(BLOCK_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(BLOCK_TICKS_TAG_PRE18, 10), Registry.BLOCK::getKey, Registry.BLOCK::get) : new ProtoTickList(block -> (block == null || block.defaultBlockState().isAir()), chunkPos, - tagLevel.getList("ToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ); + tagLevel.getList("ToBeTicked", 9)#if MC_VER > MC_1_17_1 , level #endif ); TickList fluidTicks = tagLevel.contains(FLUID_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(FLUID_TICKS_TAG_PRE18, 10), Registry.FLUID::getKey, Registry.FLUID::get) : new ProtoTickList(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos, - tagLevel.getList("LiquidsToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ); + tagLevel.getList("LiquidsToBeTicked", 9)#if MC_VER > MC_1_17_1 , level #endif ); #else - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 LevelChunkTicks blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10), string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos); LevelChunkTicks fluidTicks = LevelChunkTicks.load(tagLevel.getList(FLUID_TICKS_TAG_18, 10), @@ -291,7 +291,7 @@ public class ChunkLoader LevelChunkSection[] levelChunkSections = readSections(level, chunkPos, tagLevel); // ====================== Make the chunk ========================= - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 LevelChunk chunk = new LevelChunk((Level) level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks, fluidTicks, inhabitedTime, levelChunkSections, null); #else 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 b384ca2bb..d287ea3f7 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 @@ -41,7 +41,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ColorResolver; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 import net.minecraft.world.level.LevelHeightAccessor; #endif import net.minecraft.world.level.LightLayer; @@ -73,11 +73,11 @@ public class DhLitWorldGenRegion extends WorldGenRegion */ ReentrantLock getChunkLock = new ReentrantLock(); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 private ChunkPos overrideCenterPos = null; public void setOverrideCenter(ChunkPos pos) { overrideCenterPos = pos; } - #if MC_1_16 + #if MC_VER < MC_1_17_1 @Override public int getCenterX() { @@ -104,7 +104,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion List chunkList, ChunkStatus chunkStatus, int writeRadius, BatchGenerationEnvironment.EmptyChunkGenerator generator) { - super(serverLevel, chunkList #if MC_1_18 || MC_1_19 || MC_1_20 , chunkStatus, writeRadius #endif ); + super(serverLevel, chunkList #if MC_VER > MC_1_17_1 , chunkStatus, writeRadius #endif ); this.firstPos = chunkList.get(0).getPos(); this.generator = generator; this.lightEngine = lightEngine; @@ -115,7 +115,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 // Bypass BCLib mixin overrides. @Override public boolean ensureCanWrite(BlockPos blockPos) @@ -130,7 +130,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion { return false; } - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 if (center.isUpgrading()) { LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration(); @@ -185,7 +185,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion BlockState blockState = this.getBlockState(blockPos); // This is a bypass for the spawner block since MC complains about not having it - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 if (blockState.getBlock() instanceof SpawnerBlock) { return ((EntityBlock) blockState.getBlock()).newBlockEntity(blockPos, blockState); @@ -269,7 +269,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl); if (chunk instanceof LevelChunk) { - chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_1_18 || MC_1_19 || MC_1_20 , true #endif ); + chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER > MC_1_18_2 , true #endif ); } return chunk; } @@ -331,7 +331,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion private Biome _getBiome(BlockPos pos) { - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 return getBiome(pos).value(); #else return getBiome(pos); @@ -340,7 +340,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver) { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 int i = (Minecraft.getInstance()).options.biomeBlendRadius; #else int i = (Minecraft.getInstance()).options.biomeBlendRadius().get(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java index ad6334ece..0be2237ff 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java @@ -39,7 +39,7 @@ public class DummyLightEngine extends LevelLightEngine } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #if MC_VER < MC_1_20_1 @Override public void onBlockEmissionIncrease(BlockPos blockPos, int i) { } @@ -63,7 +63,7 @@ public class DummyLightEngine extends LevelLightEngine #endif @Override - public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 , boolean bl #endif ) { } + public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if MC_VER < MC_1_20_1 , boolean bl #endif ) { } @Override public void checkBlock(BlockPos blockPos) { } @@ -87,7 +87,7 @@ public class DummyLightEngine extends LevelLightEngine @Override public void retainData(ChunkPos chunkPos, boolean bl) { } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public int getLightSectionCount() { throw new UnsupportedOperationException("This should never be used!"); } @Override 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 91add021d..268445fa2 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,12 +23,12 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor; import net.minecraft.world.level.BlockGetter; -#if MC_1_18 || MC_1_19 || MC_1_20 +#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_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 import net.minecraft.world.level.chunk.LightChunk; #endif @@ -50,7 +50,7 @@ public class LightGetterAdaptor implements LightChunkGetter } @Override - public #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ) + public #if MC_VER < MC_1_20_1 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ) { if (genRegion == null) throw new IllegalStateException("World Gen region has not been set!"); @@ -64,7 +64,7 @@ public class LightGetterAdaptor implements LightChunkGetter return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter); } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 public LevelHeightAccessor getLevelHeightAccessor() { return heightGetter; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index 761241c68..edbc1c89f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -70,7 +70,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable { this.getRegionFileLock.lock(); - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 rFile = this.storage.getRegionFile(pos); // keeping the region cache size low helps prevent concurrency issues @@ -90,7 +90,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable } catch (ArrayIndexOutOfBoundsException e) { - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 // the file just wasn't cached break; #else @@ -145,7 +145,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable // Otherwise, check if file exist, and if so, add it to the cache Path storageFolderPath; - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 storageFolderPath = this.storage.folder.toPath(); #else storageFolderPath = this.storage.folder; @@ -157,7 +157,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable } Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca"); - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false); #else rFile = new RegionFile(regionFilePath, storageFolderPath, false); 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 096e1ad84..69777916e 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 @@ -37,49 +37,49 @@ 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_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.StructureFeatureManager; #else -#if MC_1_19_4 || MC_1_20 +#if MC_VER > MC_1_19_4 import net.minecraft.world.level.levelgen.WorldOptions; #endif import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.StructureManager; #endif -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif import net.minecraft.world.level.levelgen.structure.StructureStart; -#if MC_1_16 || MC_1_17 +#if MC_VER < MC_1_18_2 import net.minecraft.world.level.levelgen.feature.StructureFeature; #endif -public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 StructureFeatureManager #else StructureManager #endif +public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureFeatureManager #else StructureManager #endif { final WorldGenLevel genLevel; - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 WorldGenSettings worldGenSettings; #else WorldOptions worldOptions; #endif - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 StructureCheck structureCheck; #endif - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 public WorldGenStructFeatManager( WorldGenSettings worldGenSettings, - WorldGenLevel genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , StructureCheck structureCheck #endif ) + WorldGenLevel genLevel #if MC_VER > MC_1_18_2 , StructureCheck structureCheck #endif ) { - super(genLevel, worldGenSettings #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif ); + super(genLevel, worldGenSettings #if MC_VER > MC_1_18_2 , structureCheck #endif ); this.genLevel = genLevel; this.worldGenSettings = worldGenSettings; } @@ -100,8 +100,8 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 { if (worldGenRegion == genLevel) return this; - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 - return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif ); + #if MC_VER < MC_1_19_4 + return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_VER > MC_1_18_2 , structureCheck #endif ); #else return new WorldGenStructFeatManager(worldOptions, worldGenRegion, structureCheck); #endif @@ -113,7 +113,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 return genLevel.getChunk(x, z, status, false); } - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 @Override public Stream> startsForFeature( SectionPos sectionPos2, @@ -140,7 +140,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 return chunk.hasAnyStructureReferences(); } - #if MC_1_18_1 + #if MC_VER == MC_1_18_1 @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public List> startsForFeature(SectionPos sectionPos, @@ -165,7 +165,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 return builder.build(); } #else - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 @Override public List startsForFeature(SectionPos sectionPos, Predicate> predicate) { 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 7d3571264..150b7f3bd 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,12 +27,12 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if MC_1_16 || MC_1_17 || MC_1_18 +#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_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif @@ -65,12 +65,12 @@ public final class StepBiomes for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepBiomes: "+chunk.getPos()); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 environment.params.generator.createBiomes(environment.params.biomes, chunk); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER < MC_1_19_2 chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else 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 7d36c5038..f5b7d1016 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 @@ -32,7 +32,7 @@ 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_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 #endif public final class StepFeatures @@ -65,7 +65,7 @@ public final class StepFeatures { try { - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 worldGenRegion.setOverrideCenter(chunk.getPos()); environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat); #else 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 a520c7015..f3c01a650 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,14 +28,14 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException; import net.minecraft.server.level.WorldGenRegion; -#if MC_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_17_1 #endif -#if MC_1_16 || MC_1_17 || MC_1_18 +#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_1_18 || MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif @@ -69,12 +69,12 @@ public final class StepNoise for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepNoise: "+chunk.getPos()); - #if MC_1_16 + #if MC_VER < MC_1_17_1 environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk); - #elif MC_1_16 || MC_1_17 + #elif MC_VER < MC_1_18_2 chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER < MC_1_19_2 chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else 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 1320280f5..76ee86400 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,7 +27,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import net.minecraft.server.level.WorldGenRegion; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 #endif import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; 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 e8a18e566..0a22eae65 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 @@ -77,10 +77,10 @@ public final class StepStructureStart } } - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 if (environment.params.worldGenSettings.generateFeatures()) { - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 if (environment.params.worldGenSettings.generateStructures()) { #else if (environment.params.worldOptions.generateStructures()) @@ -98,10 +98,10 @@ public final class StepStructureStart // and should prevent some concurrency issues STRUCTURE_PLACEMENT_LOCK.lock(); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures, environment.params.worldSeed); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 environment.params.generator.createStructures(environment.params.registry, environment.params.randomState, tParams.structFeat, chunk, environment.params.structures, environment.params.worldSeed); #else @@ -110,7 +110,7 @@ public final class StepStructureStart tParams.structFeat, chunk, environment.params.structures); #endif - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 try { tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts()); 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 a50adc7a4..5978651d8 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 @@ -61,9 +61,9 @@ public final class StepSurface for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepSurface: "+chunk.getPos()); - #if MC_1_16 || MC_1_17 + #if MC_VER < MC_1_18_2 environment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER < MC_1_19_2 environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk); #else environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), environment.params.randomState, chunk); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 9f23e8596..409002829 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -203,9 +203,9 @@ public class FabricClientProxy { float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta()); - #if MC_1_16_5 + #if MC_VER == MC_1_16_5 SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray)); #else renderContext.projectionMatrix().set(matrixFloatArray); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index c43b73d85..4ef561058 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -59,7 +59,7 @@ public class FabricMain if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 #endif @@ -118,7 +118,7 @@ public class FabricMain ModAccessorInjector.INSTANCE.bind(IBCLibAccessor.class, new BCLibAccessor()); } - #if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1 + #if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1 // 1.17.1 won't support this since there isn't a matching Iris version if (modChecker.isModLoaded("iris")) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java index a617a6faa..7dc45f784 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java @@ -24,7 +24,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.api.internal.SharedApi; import net.minecraft.client.multiplayer.ClientLevel; -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 #endif import net.minecraft.world.level.chunk.LevelChunk; import org.spongepowered.asm.mixin.Mixin; @@ -44,14 +44,14 @@ public class MixinClientLevel // //Moved to MixinClientPacketListener // @Inject(method = "", at = @At("TAIL")) // private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, -// #if MC_1_19 || MC_1_20 Holder holder, #else DimensionType dimensionType, #endif int i, -// #if MC_1_19 || MC_1_20 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) +// #if MC_VER > MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i, +// #if MC_VER > MC_1_18_2 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) // { // ClientApi.INSTANCE.clientLevelLoadEvent(WorldWrapper.getWorldWrapper((ClientLevel)(Object)this)); // } // Moved to overriding the enableChunkLight(...) method over at ClientPacketListener for 1.20+ - #if (MC_1_19 || MC_1_20) && (MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19) // Only the setLightReady is only available after 1.18. This ensures the light data is ready. + #if MC_VER > MC_1_18_2 && MC_VER < MC_1_20_1 // Only the setLightReady is only available after 1.18. This ensures the light data is ready. @Inject(method = "setLightReady", at = @At("HEAD")) private void onChunkLightReady(int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java index d86208188..ac6c09572 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.world.level.chunk.LevelChunk; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; @@ -31,7 +31,7 @@ public class MixinClientPacketListener @Inject(method = "handleRespawn", at = @At("RETURN")) void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 @Inject(method = "cleanup", at = @At("HEAD")) #else @Inject(method = "close", at = @At("HEAD")) @@ -45,7 +45,7 @@ public class MixinClientPacketListener ClientApi.INSTANCE.onClientOnlyDisconnected(); } - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 @Inject(method = "enableChunkLight", at = @At("TAIL")) void onEnableChunkLight(LevelChunk chunk, int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java index d01145bf5..3f24f1865 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java @@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import net.minecraft.world.level.material.FluidState; #else import net.minecraft.world.level.material.FogType; @@ -50,14 +50,14 @@ public class MixinFogRenderer private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F; @Inject(at = @At("RETURN"), method = "setupFog") - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) { #else private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float g, CallbackInfo callback) { #endif - #if MC_1_16 + #if MC_VER < MC_1_17_1 FluidState fluidState = camera.getFluidInCamera(); boolean cameraNotInFluid = fluidState.isEmpty(); #else @@ -71,7 +71,7 @@ public class MixinFogRenderer && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial() && Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get()) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE); RenderSystem.fogEnd(A_EVEN_LARGER_VALUE); #else diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java index 5da0b369e..5a11f09d8 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 8422bebf4..4d2f041a2 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.fabric.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 +#if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; @@ -67,7 +67,7 @@ public class MixinLevelRenderer // Inject rendering at first call to renderChunkLayer // HEAD or RETURN - #if MC_1_16 + #if MC_VER < MC_1_17_1 @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) { @@ -84,17 +84,17 @@ public class MixinLevelRenderer } #endif - #if MC_1_16 + #if MC_VER < MC_1_17_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #elif MC_VER < MC_1_20_2 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) @@ -113,10 +113,10 @@ public class MixinLevelRenderer } } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #elif MC_VER < MC_1_20_1 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 8c4a32972..f96c258de 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -25,8 +25,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 - #if MC_1_20_1 + #if MC_VER < MC_1_20_2 + #if MC_VER == MC_1_20_1 @Redirect( method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if MC_1_20_4 + #if MC_VER > MC_1_20_2 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 5df2f3cf8..61b805be5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; @@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) - this. #if MC_1_16 addButton #else addRenderableWidget #endif + this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif (new TexturedButtonWidget( // Where the button is on the screen this.width / 2 - 180, this.height / 6 - 12, @@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen // For now it goes to the client option by default (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the utton - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 new TranslatableComponent(ModInfo.ID + ".title"))); #else Component.translatable(ModInfo.ID + ".title"))); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinTextureUtil.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinTextureUtil.java index 91e27661c..597d5a609 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinTextureUtil.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinTextureUtil.java @@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; public class MixinTextureUtil { @Redirect(method = "Lcom/mojang/blaze3d/platform/TextureUtil;prepareImage(Lcom/mojang/blaze3d/platform/NativeImage$InternalGlFormat;IIII)V", - at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texParameter(IIF)V", #if MC_1_16_5 remap = true #else remap = false #endif)) + at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texParameter(IIF)V", #if MC_VER == MC_1_16_5 remap = true #else remap = false #endif)) private static void setLodBias(int target, int pname, float param) { float biasValue = Config.Client.Advanced.Graphics.AdvancedGraphics.lodBias.get().floatValue(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java index 765b8deac..9d02eb99d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java @@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.Mixin; @Deprecated // TODO: Not sure if this is needed anymore public class MixinServerLevel { -// #if MC_1_16 +// #if MC_VER < MC_1_17_1 // @Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V", shift = At.Shift.AFTER)) // private void saveWorldEvent(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) { // Main.client_proxy.worldSaveEvent(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java index 6b4c4d2a4..cde893175 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java @@ -2,7 +2,7 @@ package com.seibel.distanthorizons.fabric.mixins.mods.sodium; /* Removed since DH now uses Indium so we can use the Fabric rendering API instead -#if MC_1_20_2 || MC_1_20_4 +#if MC_VER > MC_1_20_1 // Sodium 0.5 import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.api.internal.ClientApi; @@ -55,7 +55,7 @@ public class MixinSodiumRenderer } -#elif MC_1_18 || MC_1_19 || MC_1_20 +#elif MC_VER > MC_1_17_1 // Sodium 0.3 to 0.4 import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java index fce9efd57..14be488cd 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; -#if MC_1_16 || MC_1_17 +#if MC_VER < MC_1_18_2 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java index 1e9711597..8544ed05e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java @@ -37,7 +37,7 @@ public class MixinChunkMap // MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks) // this logic should prevent that from happening - #if MC_1_16_5 || MC_1_17 + #if MC_1_16_5 || MC_1_17_1 if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect()) { return; @@ -55,7 +55,7 @@ public class MixinChunkMap //==================// // some chunks may be missing their biomes, which cause issues when attempting to save them - #if MC_1_16_5 || MC_1_17 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 if (chunk.getBiomes() == null) { return; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java index fe6b7b4c8..ed33bc5b0 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index 63f2e345e..7ea166ef7 100644 --- 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 @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; //FIXME: Is this still needed? -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index 3d7ddf888..93934f15e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -1,8 +1,8 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor; -#if MC_1_16_5 || MC_1_17 || MC_1_20_4 // These versions either don't have BCLib, or the implementation is different -#elif MC_1_18 +#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 // These versions either don't have BCLib, or the implementation is different +#elif MC_VER == MC_1_18_2 import ru.bclib.config.ClientConfig; import ru.bclib.config.Configs; #else @@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor public void setRenderCustomFog(boolean newValue) { - #if !(MC_1_16_5 || MC_1_17 || MC_1_20_4) // These versions either don't have BCLib, or the implementation is different + #if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4) // These versions either don't have BCLib, or the implementation is different // Change the value of CUSTOM_FOG_RENDERING in the bclib client config // This disabled fog from rendering within bclib diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java index d08de388b..53edafd5e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; -#if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1 +#if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1 import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; import net.coderbot.iris.Iris; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java index cd340c2e5..86a6909d2 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java @@ -33,7 +33,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAcce import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; import net.minecraft.client.Minecraft; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.world.entity.Entity; @@ -60,21 +60,21 @@ public class SodiumAccessor implements ISodiumAccessor return "Sodium-Fabric"; } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Override public HashSet getNormalRenderedChunks() { SodiumWorldRenderer renderer = SodiumWorldRenderer.instance(); LevelHeightAccessor height = Minecraft.getInstance().level; - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 // TODO: This is just a tmp solution, use a proper solution later return MC_RENDER.getMaximumRenderedChunks().stream().filter((DhChunkPos chunk) -> { return (renderer.isBoxVisible( chunk.getMinBlockX() + 1, height.getMinBuildHeight() + 1, chunk.getMinBlockZ() + 1, chunk.getMinBlockX() + 15, height.getMaxBuildHeight() - 1, chunk.getMinBlockZ() + 15)); }).collect(Collectors.toCollection(HashSet::new)); - #elif MC_1_19 || MC_1_20 + #elif MC_VER > MC_1_18_2 // 0b11 = Lighted chunk & loaded chunk return renderer.getChunkTracker().getChunks(0b00).filter( (long l) -> { @@ -134,7 +134,7 @@ public class SodiumAccessor implements ISodiumAccessor @Override public void setFogOcclusion(boolean b) { - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 me.jellysquid.mods.sodium.client.SodiumClientMod.options().performance.useFogOcclusion = b; #endif } 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 302475759..836cd6cf3 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -36,7 +36,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.world.level.LevelAccessor; import net.minecraft.client.multiplayer.ClientLevel; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; #else @@ -44,7 +44,7 @@ import net.minecraftforge.event.level.ChunkEvent; import net.minecraftforge.event.level.LevelEvent; #endif -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraftforge.client.event.RenderLevelStageEvent; #endif import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -79,7 +79,7 @@ public class ForgeClientProxy // private static SimpleChannel multiversePluginChannel; - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } #else private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -107,7 +107,7 @@ public class ForgeClientProxy //==============// @SubscribeEvent - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public void clientLevelLoadEvent(WorldEvent.Load event) #else public void clientLevelLoadEvent(LevelEvent.Load event) @@ -115,7 +115,7 @@ public class ForgeClientProxy { LOGGER.info("level load"); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -131,7 +131,7 @@ public class ForgeClientProxy ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper); } @SubscribeEvent - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public void clientLevelUnloadEvent(WorldEvent.Unload event) #else public void clientLevelUnloadEvent(LevelEvent.Load event) @@ -139,7 +139,7 @@ public class ForgeClientProxy { LOGGER.info("level unload"); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -165,7 +165,7 @@ public class ForgeClientProxy { LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -179,7 +179,7 @@ public class ForgeClientProxy { LOGGER.trace("break or block attack at blockPos: " + event.getPos()); - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); #else LevelAccessor level = event.getLevel(); @@ -217,7 +217,7 @@ public class ForgeClientProxy //==============// @SubscribeEvent - public void registerKeyBindings(#if MC_1_16 || MC_1_17 || MC_1_18 InputEvent.KeyInputEvent #else InputEvent.Key #endif event) + public void registerKeyBindings(#if MC_VER < MC_1_19_2 InputEvent.KeyInputEvent #else InputEvent.Key #endif event) { if (Minecraft.getInstance().player == null) { @@ -298,15 +298,15 @@ public class ForgeClientProxy //===========// @SubscribeEvent - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 public void afterLevelRenderEvent(RenderLevelStageEvent event) #else public void afterLevelRenderEvent(TickEvent.RenderTickEvent event) #endif { - #if MC_1_20_2 || MC_1_20_4 + #if MC_VER > MC_1_20_1 if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_LEVEL) - #elif MC_1_19 || MC_1_20 + #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??? diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index dbf61fcd0..d88441f92 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -39,7 +39,7 @@ import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_19_2 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; @@ -51,11 +51,11 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.*; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import net.minecraftforge.fml.ExtensionPoint; -#elif MC_1_17 +#elif MC_VER == MC_1_17_1 import net.minecraftforge.fmlclient.ConfigGuiHandler; -#elif MC_1_18 +#elif MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2 import net.minecraftforge.client.ConfigGuiHandler; #else import net.minecraftforge.client.ConfigScreenHandler; @@ -64,7 +64,7 @@ import net.minecraftforge.client.ConfigScreenHandler; import org.apache.logging.log4j.Logger; // these imports change due to forge refactoring classes in 1.19 -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraftforge.client.model.data.ModelDataMap; import java.util.Random; @@ -128,10 +128,10 @@ public class ForgeMain implements LodForgeMethodCaller ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); } - #if MC_1_16 + #if MC_VER < MC_1_17_1 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> GetConfigScreen.getScreen(parent)); - #elif MC_1_16 || MC_1_17 || MC_1_18 + #elif MC_VER >= MC_1_17_1 && MC_VER <= MC_1_19_2 ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class, () -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> GetConfigScreen.getScreen(parent))); #else @@ -169,14 +169,14 @@ public class ForgeMain implements LodForgeMethodCaller LOGGER.info("Mod Post-Initialized"); } - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 private final ModelDataMap modelData = new ModelDataMap.Builder().build(); #else private final ModelData modelData = ModelData.EMPTY; #endif @Override - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) { return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData); @@ -184,14 +184,14 @@ public class ForgeMain implements LodForgeMethodCaller #else public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_1_19 || MC_1_20 , RenderType.solid() #endif ); + return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_VER > MC_1_19_2 , RenderType.solid() #endif ); } #endif @Override //TODO: Check this if its still needed public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) { - #if MC_1_17______Still_needed + #if MC_1_17_1______Still_needed return resolver.m_130045_(biome, x, z); #else return resolver.getColor(biome, x, z); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java index b646ecb12..7b5c9b29c 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -14,7 +14,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraftforge.event.TickEvent; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; #else @@ -23,10 +23,10 @@ import net.minecraftforge.event.level.LevelEvent; #endif import net.minecraftforge.eventbus.api.SubscribeEvent; -#if MC_1_16_5 +#if MC_VER == MC_1_16_5 import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; -#elif MC_1_17 +#elif MC_VER == MC_1_17_1 import net.minecraftforge.fmlserverevents.FMLServerAboutToStartEvent; import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent; #else @@ -41,7 +41,7 @@ import java.util.function.Supplier; public class ForgeServerProxy { - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } #else private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -81,21 +81,21 @@ public class ForgeServerProxy // ServerWorldLoadEvent @SubscribeEvent - public void dedicatedWorldLoadEvent(#if MC_1_16_5 || MC_1_17 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event) + public void dedicatedWorldLoadEvent(#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event) { this.serverApi.serverLoadEvent(this.isDedicated); } // ServerWorldUnloadEvent @SubscribeEvent - public void serverWorldUnloadEvent(#if MC_1_16_5 || MC_1_17 FMLServerStoppingEvent #else ServerStoppingEvent #endif event) + public void serverWorldUnloadEvent(#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 FMLServerStoppingEvent #else ServerStoppingEvent #endif event) { this.serverApi.serverUnloadEvent(); } // ServerLevelLoadEvent @SubscribeEvent - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public void serverLevelLoadEvent(WorldEvent.Load event) #else public void serverLevelLoadEvent(LevelEvent.Load event) @@ -109,7 +109,7 @@ public class ForgeServerProxy // ServerLevelUnloadEvent @SubscribeEvent - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 public void serverLevelUnloadEvent(WorldEvent.Unload event) #else public void serverLevelUnloadEvent(LevelEvent.Unload event) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java index 21ef500a5..2726de266 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java @@ -16,7 +16,7 @@ public class MixinClientPacketListener @Inject(method = "handleLogin", at = @At("RETURN")) void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 @Inject(method = "cleanup", at = @At("HEAD")) #else @Inject(method = "close", at = @At("HEAD")) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java index a9e59c9ca..db0ed1a9f 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java @@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import net.minecraft.world.level.material.FluidState; #else import net.minecraft.world.level.material.FogType; @@ -53,10 +53,10 @@ public class MixinFogRenderer @Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V", - remap = #if MC_1_17 || MC_1_18 false #else true #endif ) // Remap messiness due to this being weird in forge + remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 FluidState fluidState = camera.getFluidInCamera(); boolean cameraNotInFluid = fluidState.isEmpty(); #else @@ -71,7 +71,7 @@ public class MixinFogRenderer && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial() && Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get()) { - #if MC_1_16 + #if MC_VER < MC_1_17_1 RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE); RenderSystem.fogEnd(A_EVEN_LARGER_VALUE); #else diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java index 64899ab54..9834b90bf 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer { private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 7e1e13eb2..f6223c099 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.forge.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; -#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 +#if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; @@ -52,7 +52,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.nio.FloatBuffer; -#if MC_1_16 +#if MC_VER < MC_1_17_1 import org.lwjgl.opengl.GL15; #endif @@ -84,7 +84,7 @@ public class MixinLevelRenderer throw new NullPointerException("Null cannot be cast to non-null type."); } - #if MC_1_16 + #if MC_VER < MC_1_17_1 @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) #else @@ -99,17 +99,17 @@ public class MixinLevelRenderer // TODO: Can we move this to forge's client proxy similarly to how fabric does it - #if MC_1_16 + #if MC_VER < MC_1_17_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 + #elif MC_VER < MC_1_20_2 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) @@ -122,7 +122,7 @@ public class MixinLevelRenderer #endif { // get MC's model view and projection matrices - #if MC_1_16_5 + #if MC_VER == MC_1_16_5 // get the matrices from the OpenGL fixed pipeline float[] mcProjMatrixRaw = new float[16]; GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw); @@ -149,9 +149,9 @@ public class MixinLevelRenderer { float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks); - #if MC_1_16_5 + #if MC_VER == MC_1_16_5 SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #elif MC_VER < MC_1_19_4 projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); #else projectionMatrix.set(matrixFloatArray); @@ -165,10 +165,10 @@ public class MixinLevelRenderer } } - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2 + #if MC_VER < MC_1_19_4 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) - #elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 + #elif MC_VER < MC_1_20_1 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index 5a1141d7f..155c30259 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -25,8 +25,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 - #if MC_1_20_1 + #if MC_VER < MC_1_20_2 + #if MC_VER == MC_1_20_1 @Redirect( method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if MC_1_20_4 + #if MC_VER > MC_1_20_2 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java index a95f9a79e..e3af8c9e8 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java @@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if MC_1_16 || MC_1_17 || MC_1_18 +#if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; @@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) - this. #if MC_1_16 addButton #else addRenderableWidget #endif + this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif (new TexturedButtonWidget( // Where the button is on the screen this.width / 2 - 180, this.height / 6 - 12, @@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen // For now it goes to the client option by default (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the button - #if MC_1_16 || MC_1_17 || MC_1_18 + #if MC_VER < MC_1_19_2 new TranslatableComponent(ModInfo.ID + ".title"))); #else Component.translatable(ModInfo.ID + ".title"))); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java index 134886824..3541cf2fb 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.forge.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; -#if MC_1_16 || MC_1_17 +#if MC_VER < MC_1_18_2 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java index 31d787a62..ab203d244 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java @@ -3,13 +3,13 @@ package com.seibel.distanthorizons.forge.mixins.server; import net.minecraft.world.level.chunk.ChunkGenerator; import org.spongepowered.asm.mixin.Mixin; -#if MC_1_16_5 +#if MC_VER == MC_1_16_5 @Mixin(ChunkGenerator.class) class MixinTFChunkGenerator { // not currently implemented, attempting to run with the mod enabled in the IDE causes the game to lock up } -#elif MC_1_16 +#elif MC_VER < MC_1_17_1 import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java index ad96fc080..900d1115c 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if MC_1_18 || MC_1_19 || MC_1_20 + #if MC_VER > MC_1_17_1 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if MC_1_19 || MC_1_20 + #if MC_VER > MC_1_18_2 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index e3d1c545d..3ce324a04 100644 --- 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 @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.forge.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; -#if MC_1_19 || MC_1_20 +#if MC_VER > MC_1_18_2 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; diff --git a/gradle.properties b/gradle.properties index b57fed3ee..fbd09c11b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -47,4 +47,4 @@ versionStr= mcVer=1.20.2 # Defines the maximum amount of memory Minecraft is allowed when run in a developement environment -minecraftMemoryJavaArg="-Xmx4G" +#minecraftMemoryJavaArg="-Xmx4G" From 0d7b0f9fe429e0f1c0e3d3563202c4265cde1dca Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 19:28:41 +1030 Subject: [PATCH 022/301] Updated to new git url --- .gitlab/issue_templates/Bug.md | 6 +++--- .gitlab/issue_templates/FeatureRequest.md | 2 +- .gitlab/issue_templates/ImprovementRequest.md | 2 +- Readme.md | 4 ++-- contributing.md | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md index a6eb95cc2..09f88a5d9 100644 --- a/.gitlab/issue_templates/Bug.md +++ b/.gitlab/issue_templates/Bug.md @@ -6,13 +6,13 @@ Or click the checkbox once the issue has been created. --> 1. [ ] Check the FAQ to see if your issue has already been reported and has a solution: - [Problems-and-solutions](https://gitlab.com/jeseibel/minecraft-lod-mod/-/wikis/2-frequently-asked-questions/2-problems-and-solutions/Problems-and-Solutions) + [Problems-and-solutions](https://gitlab.com/jeseibel/distant-horizons/-/wikis/2-frequently-asked-questions/2-problems-and-solutions/Problems-and-Solutions) 2. [ ] Make sure you are not using any mods on the incompatible list: - [Mod support FAQ](https://gitlab.com/jeseibel/minecraft-lod-mod/-/wikis/2-frequently-asked-questions/4-mod-support/Mod-Support) + [Mod support FAQ](https://gitlab.com/jeseibel/distant-horizons/-/wikis/2-frequently-asked-questions/4-mod-support/Mod-Support) 3. [ ] Check the existing issues to verify that your bug hasn't already been submitted: - [Issues](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/) + [Issues](https://gitlab.com/jeseibel/distant-horizons/-/issues/) 4. [ ] Upload Minecraft's crash report and/or log. \ Minecraft crash reports are located in: `.minecraft/crash-reports` \ diff --git a/.gitlab/issue_templates/FeatureRequest.md b/.gitlab/issue_templates/FeatureRequest.md index cc66352f2..0be5723bf 100644 --- a/.gitlab/issue_templates/FeatureRequest.md +++ b/.gitlab/issue_templates/FeatureRequest.md @@ -1,4 +1,4 @@ -- [ ] Check the existing [feature requests](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/?sort=updated_desc&state=opened&label_name%5B%5D=Feature) to verify that your feature hasn't already been suggested. +- [ ] Check the existing [feature requests](https://gitlab.com/jeseibel/distant-horizons/-/issues/?sort=updated_desc&state=opened&label_name%5B%5D=Feature) to verify that your feature hasn't already been suggested. 1. **Describe the feature**: diff --git a/.gitlab/issue_templates/ImprovementRequest.md b/.gitlab/issue_templates/ImprovementRequest.md index 735cb48a7..34153c989 100644 --- a/.gitlab/issue_templates/ImprovementRequest.md +++ b/.gitlab/issue_templates/ImprovementRequest.md @@ -1,3 +1,3 @@ -1. Check the existing [improvement requests](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/?sort=updated_desc&state=all&label_name%5B%5D=Improvement) to verify that your improvement hasn't already been suggested. +1. Check the existing [improvement requests](https://gitlab.com/jeseibel/distant-horizons/-/issues/?sort=updated_desc&state=all&label_name%5B%5D=Improvement) to verify that your improvement hasn't already been suggested. 2. **Describe the improvement**: diff --git a/Readme.md b/Readme.md index 8145a1792..92244ca27 100644 --- a/Readme.md +++ b/Readme.md @@ -115,7 +115,7 @@ To switch between different Minecraft versions, change `mcVer=1.?` in the `gradl If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle. (In IntellJ you will also need to do a gradle sync if it didn't happen automatically.) >Note: There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions. To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s). (Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`). \ > If anyone knows how to solve this issue please let us know here: \ -> https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/233 +> https://gitlab.com/jeseibel/distant-horizons/-/issues/233
@@ -134,7 +134,7 @@ From the File Explorer: 6. The compiled jar file will be in the folder `Merged` From the command line: -1. `git clone --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git` +1. `git clone --recurse-submodules https://gitlab.com/gitlab.com/jeseibel/distant-horizons.git` 2. `cd minecraft-lod-mod` 3. `./gradlew assemble` 4. `./gradlew mergeJars` diff --git a/contributing.md b/contributing.md index 13981c4cf..45e1b6118 100644 --- a/contributing.md +++ b/contributing.md @@ -14,7 +14,7 @@ By sending a merge request, you agree to abide by the Distant Horizons [Contribu Contributions to this project are under the [lesser GPL v3 license](LICENSE.txt) Copyright James Seibel, so please include the [license header](license_header.txt) at the top of any new code files. 1. Fork, then clone the repo: \ -`git clone --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git` +`git clone --recurse-submodules https://gitlab.com/jeseibel/distant-horizons.git` 2. Set up your dev environment: \ `./gradlew build` @@ -37,13 +37,13 @@ Contributions to this project are under the [lesser GPL v3 license](LICENSE.txt) `./gradlew fabric:runClient` \ When running the game, load or generate a world to confirm Distant Horizons initializes correctly. -9. Push to your fork, make sure to include the Core submodule, and submit a [new merge request](https://gitlab.com/jeseibel/minecraft-lod-mod/-/merge_requests/new). +9. Push to your fork, make sure to include the Core submodule, and submit a [new merge request](https://gitlab.com/jeseibel/distant-horizons/-/merge_requests/new). ## General Guidelines -* Check the existing issue list to verify that a given [bug](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Bug&first_page_size=100), [feature](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Feature&first_page_size=100), or [improvement](https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Improvement&first_page_size=100) hasn't already been submitted. +* Check the existing issue list to verify that a given [bug](https://gitlab.com/jeseibel/distant-horizons/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Bug&first_page_size=100), [feature](https://gitlab.com/jeseibel/distant-horizons/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Feature&first_page_size=100), or [improvement](https://gitlab.com/jeseibel/distant-horizons/-/issues/?sort=created_date&state=opened&label_name%5B%5D=Improvement&first_page_size=100) hasn't already been submitted. * Please open an issue if things aren't working as expected. * Open a merge request to: fix bugs, fix documentations, improve an existing system, or complete a feature. * When contributing: From 24520824e950ad745a92257c0b31811215b70e38 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 19:28:45 +1030 Subject: [PATCH 023/301] Updated to new git url --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 706a423c5..19d20f559 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 706a423c5f13ff82b970db4f41226facda466152 +Subproject commit 19d20f5591fbb7a72fa623fcd1831f9e6d28e713 From cf8b0329bbf8ed6aa7cce6ff5e679eae9d3c3b3f Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 12 Dec 2023 22:17:21 +1030 Subject: [PATCH 024/301] Hopefully fixed compolation with the new preprocessor --- .../common/forge/LodForgeMethodCaller.java | 2 +- .../block/TintGetterOverrideFast.java | 4 ++-- .../block/TintGetterOverrideSmooth.java | 4 ++-- .../block/TintWithoutLevelOverrider.java | 8 +++---- .../TintWithoutLevelSmoothOverrider.java | 8 +++---- .../block/cache/ClientBlockStateCache.java | 2 +- .../common/wrappers/chunk/ChunkWrapper.java | 6 ++--- .../common/wrappers/gui/ClassicConfigGUI.java | 4 ++-- .../common/wrappers/gui/MinecraftScreen.java | 2 +- .../wrappers/gui/TexturedButtonWidget.java | 2 +- .../wrappers/gui/updater/ChangelogScreen.java | 4 ++-- .../wrappers/gui/updater/UpdateModScreen.java | 2 +- .../BatchGenerationEnvironment.java | 14 ++++++------ .../worldGeneration/GlobalParameters.java | 10 ++++----- .../worldGeneration/ThreadedParameters.java | 8 +++---- .../mimicObject/ChunkLoader.java | 22 +++++++++---------- .../mimicObject/DhLitWorldGenRegion.java | 14 ++++++------ .../mimicObject/DummyLightEngine.java | 2 +- .../mimicObject/LightGetterAdaptor.java | 6 ++--- .../WorldGenStructFeatManager.java | 12 +++++----- .../worldGeneration/step/StepBiomes.java | 2 +- .../worldGeneration/step/StepFeatures.java | 2 +- .../worldGeneration/step/StepNoise.java | 4 ++-- .../step/StepStructureStart.java | 2 +- .../distanthorizons/fabric/FabricMain.java | 2 +- .../mixins/client/MixinClientLevel.java | 8 +++---- .../client/MixinClientPacketListener.java | 4 ++-- .../mixins/client/MixinGameRenderer.java | 2 +- .../fabric/mixins/client/MixinMinecraft.java | 2 +- .../mods/sodium/MixinSodiumRenderer.java | 4 ++-- .../server/MixinUtilBackgroundThread.java | 4 ++-- .../server/unsafe/MixinThreadingDetector.java | 2 +- .../wrappers/modAccessor/SodiumAccessor.java | 8 +++---- .../forge/ForgeClientProxy.java | 8 +++---- .../distanthorizons/forge/ForgeMain.java | 8 +++---- .../mixins/client/MixinGameRenderer.java | 2 +- .../forge/mixins/client/MixinMinecraft.java | 2 +- .../server/MixinUtilBackgroundThread.java | 4 ++-- .../server/unsafe/MixinThreadingDetector.java | 2 +- 39 files changed, 104 insertions(+), 104 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java index b8b2add63..afa8fa468 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.common.forge; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if MC_VER > MC_1_19_2 +#if MC_VER >= MC_1_19_2 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index 04c8c1d98..da3e8d4cf 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -50,7 +50,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -167,7 +167,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index c67d8c3e4..240c4e848 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -53,7 +53,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter private Biome _getBiome(BlockPos pos) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 return parent.getBiome(pos).value(); #else return parent.getBiome(pos); @@ -193,7 +193,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter return parent.getMaxBuildHeight(); } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { 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 ab8876e74..6f425019e 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 @@ -29,7 +29,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.core.Holder; #endif @@ -46,9 +46,9 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_VER >= MC_1_18_2 Holder #else Biome #endif biome) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 return biome.value(); #else return biome; @@ -84,7 +84,7 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter } - #if MC_VER == MC_1_17_1 || MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_17_1 @Override public int getHeight() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java index 0c293eb7f..04a9b41b1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java @@ -30,7 +30,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.core.Holder; #endif @@ -49,9 +49,9 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter { return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ()); } - private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder #else Biome #endif biome) + private Biome _unwrap(#if MC_VER >= MC_1_18_2 Holder #else Biome #endif biome) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 return biome.value(); #else return biome; @@ -116,7 +116,7 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter } - #if MC_VER >= MC_1_17_1 && MC_VER != MC_1_18_2 + #if MC_VER >= MC_1_17_1 @Override public int getHeight() { 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 629a705f3..45612b100 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 @@ -38,7 +38,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FlowerBlock; import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.RotatedPillarBlock; -#if MC_VER > MC_1_19_2 +#if MC_VER >= MC_1_19_2 import net.minecraft.util.RandomSource; #else import java.util.Random; 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 b92d0e8ce..36cb5c311 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 @@ -47,7 +47,7 @@ import org.apache.logging.log4j.Logger; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; -#if MC_VER > MC_1_17_1 +#if MC_VER >= MC_1_17_1 import net.minecraft.core.QuartPos; #endif @@ -67,7 +67,7 @@ import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.LevelChunkSection; #endif -#if MC_VER > MC_1_20_1 +#if MC_VER >= MC_1_20_1 import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.core.SectionPos; @@ -490,7 +490,7 @@ public class ChunkWrapper implements IChunkWrapper #endif } } - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine) { LevelChunkSection[] sections = chunk.getSections(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index a7a87c7cb..7577120fb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -49,7 +49,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.client.resources.language.I18n; // translation -#if MC_VER > MC_1_17_1 +#if MC_VER >= MC_1_17_1 import net.minecraft.client.gui.narration.NarratableEntry; #endif import net.minecraft.resources.ResourceLocation; @@ -642,7 +642,7 @@ public class ClassicConfigGUI // Only for 1.17 and over // Remove in 1.16 and below - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index 6dcc5a746..1b3c1298c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.config.gui.AbstractScreen; import net.minecraft.client.Minecraft; -#if MC_VER > MC_1_20_1 +#if MC_VER >= MC_1_20_1 import net.minecraft.client.gui.GuiGraphics; #endif import net.minecraft.client.gui.components.ContainerObjectSelectionList; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java index c589fcf4c..c69a9ad49 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java @@ -34,7 +34,7 @@ import net.minecraft.client.gui.components.ImageButton; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -#if MC_VER > MC_1_17_1 +#if MC_VER >= MC_1_17_1 import net.minecraft.client.renderer.GameRenderer; #endif #if MC_VER < MC_1_20_1 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index e66d7c3f8..1328a5ba9 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -15,7 +15,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -#if MC_VER > MC_1_17_1 +#if MC_VER >= MC_1_17_1 import net.minecraft.client.gui.narration.NarratableEntry; #endif @@ -244,7 +244,7 @@ public class ChangelogScreen extends DhScreen { return children; } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public List narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 6207d06ff..074e96b21 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -11,7 +11,7 @@ import com.seibel.distanthorizons.core.jar.JarUtils; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import net.minecraft.client.Minecraft; -#if MC_VER > MC_1_20_1 +#if MC_VER >= MC_1_20_1 import net.minecraft.client.gui.GuiGraphics; #else import com.mojang.blaze3d.vertex.PoseStack; 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 65e9c37b9..0ba131419 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 @@ -56,7 +56,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStruc import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStructureStart; import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepSurface; -#if MC_VER > MC_1_19_4 +#if MC_VER >= MC_1_19_4 import net.minecraft.core.registries.Registries; #else import net.minecraft.core.Registry; @@ -365,8 +365,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv private static ProtoChunk EmptyChunk(ServerLevel level, ChunkPos chunkPos) { return new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_VER > MC_1_17_1 , level #endif - #if MC_VER > MC_1_18_2 , level.registryAccess().registryOrThrow( + #if MC_VER >= MC_1_17_1 , level #endif + #if MC_VER >= MC_1_18_2 , level.registryAccess().registryOrThrow( #if MC_VER < MC_1_19_4 Registry.BIOME_REGISTRY #else @@ -463,8 +463,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv if (target == null) { target = new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_VER > MC_1_17_1 , params.level #endif - #if MC_VER > MC_1_18_2 , params.biomes, null #endif + #if MC_VER >= MC_1_17_1 , params.level #endif + #if MC_VER >= MC_1_18_2 , params.biomes, null #endif ); } return target; @@ -520,7 +520,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk; - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 boolean isPartial = target.isOldNoiseGeneration(); #endif if (isFull) @@ -528,7 +528,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv LOAD_LOGGER.info("Detected full existing chunk at {}", target.getPos()); genEvent.resultConsumer.accept(wrappedChunk); } - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 else if (isPartial) { LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java index 51da9ca78..ac7e1c639 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java @@ -31,7 +31,7 @@ import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.chunk.ChunkGenerator; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.chunk.storage.ChunkScanAccess; #endif import net.minecraft.world.level.levelgen.WorldGenSettings; @@ -40,7 +40,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana #else import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import net.minecraft.world.level.levelgen.RandomState; -#if MC_VER > MC_1_19_4 +#if MC_VER >= MC_1_19_4 import net.minecraft.world.level.levelgen.WorldOptions; import net.minecraft.core.registries.Registries; #endif @@ -67,7 +67,7 @@ public final class GlobalParameters public final RegistryAccess registry; public final long worldSeed; public final DataFixer fixerUpper; - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 public final BiomeManager biomeManager; public final ChunkScanAccess chunkScanner; // FIXME: Figure out if this is actually needed #endif @@ -90,14 +90,14 @@ public final class GlobalParameters biomes = registry.registryOrThrow(Registries.BIOME); worldSeed = worldOptions.seed(); #endif - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed)); chunkScanner = level.getChunkSource().chunkScanner(); #endif structures = server.getStructureManager(); generator = level.getChunkSource().getGenerator(); fixerUpper = server.getFixerUpper(); - #if MC_VER > MC_1_19_2 + #if MC_VER >= MC_1_19_2 randomState = level.getChunkSource().randomState(); #endif } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java index db8a70195..71cc834c3 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java @@ -25,7 +25,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.Wo import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.WorldGenLevel; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif @@ -35,7 +35,7 @@ public final class ThreadedParameters final ServerLevel level; public WorldGenStructFeatManager structFeat = null; - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 public StructureCheck structCheck; #endif boolean isValid = true; @@ -81,14 +81,14 @@ public final class ThreadedParameters public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param) { #if MC_VER < MC_1_19_4 - structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_VER > MC_1_18_2 , structCheck #endif ); + structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_VER >= MC_1_18_2 , structCheck #endif ); #else structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck); #endif } - #if MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2 + #if MC_VER >= MC_1_18_2 && MC_VER < MC_1_19_2 public void recreateStructureCheck() { if (previousGlobalParameters != null) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index bdae4bb2e..7edb2d77e 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -37,7 +37,7 @@ import java.util.Objects; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; -#if MC_VER > MC_1_19_4 +#if MC_VER >= MC_1_19_4 import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; #endif @@ -55,7 +55,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.*; import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.minecraft.world.level.levelgen.Heightmap; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.blending.BlendingData; #if MC_VER < MC_1_19_2 import net.minecraft.world.level.levelgen.feature.StructureFeature; @@ -64,7 +64,7 @@ import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; import net.minecraft.world.ticks.LevelChunkTicks; #endif -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.core.Holder; import net.minecraft.core.RegistryAccess; #if MC_VER < MC_1_19_2 @@ -81,9 +81,9 @@ import net.minecraft.world.level.material.Fluid; public class ChunkLoader { - #if MC_VER > MC_1_19_2 + #if MC_VER >= MC_1_19_2 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); - #elif MC_VER > MC_1_18_2 + #elif MC_VER >= MC_1_18_2 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); #endif private static final String TAG_UPGRADE_DATA = "UpgradeData"; @@ -93,7 +93,7 @@ public class ChunkLoader private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks"; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER; - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 private static BlendingData readBlendingData(CompoundTag chunkData) { BlendingData blendingData = null; @@ -109,7 +109,7 @@ public class ChunkLoader private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 #if MC_VER < MC_1_19_4 Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); #else @@ -255,25 +255,25 @@ public class ChunkLoader //================== Read params for making the LevelChunk ================== UpgradeData upgradeData = tagLevel.contains(TAG_UPGRADE_DATA, 10) - ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_VER > MC_1_17_1 , level #endif ) + ? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_VER >= MC_1_17_1 , level #endif ) : UpgradeData.EMPTY; boolean isLightOn = tagLevel.getBoolean("isLightOn"); #if MC_VER < MC_1_18_2 ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer( - level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_VER > MC_1_17_1 , level #endif , + level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_VER >= MC_1_17_1 , level #endif , chunkPos, level.getLevel().getChunkSource().getGenerator().getBiomeSource(), tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null); TickList blockTicks = tagLevel.contains(BLOCK_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(BLOCK_TICKS_TAG_PRE18, 10), Registry.BLOCK::getKey, Registry.BLOCK::get) : new ProtoTickList(block -> (block == null || block.defaultBlockState().isAir()), chunkPos, - tagLevel.getList("ToBeTicked", 9)#if MC_VER > MC_1_17_1 , level #endif ); + tagLevel.getList("ToBeTicked", 9)#if MC_VER >= MC_1_17_1 , level #endif ); TickList fluidTicks = tagLevel.contains(FLUID_TICKS_TAG_PRE18, 9) ? ChunkTickList.create(tagLevel.getList(FLUID_TICKS_TAG_PRE18, 10), Registry.FLUID::getKey, Registry.FLUID::get) : new ProtoTickList(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos, - tagLevel.getList("LiquidsToBeTicked", 9)#if MC_VER > MC_1_17_1 , level #endif ); + tagLevel.getList("LiquidsToBeTicked", 9)#if MC_VER >= MC_1_17_1 , level #endif ); #else #if MC_VER < MC_1_19_4 LevelChunkTicks blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10), 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 d287ea3f7..b73e18c43 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 @@ -41,7 +41,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ColorResolver; -#if MC_VER > MC_1_17_1 +#if MC_VER >= MC_1_17_1 import net.minecraft.world.level.LevelHeightAccessor; #endif import net.minecraft.world.level.LightLayer; @@ -104,7 +104,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion List chunkList, ChunkStatus chunkStatus, int writeRadius, BatchGenerationEnvironment.EmptyChunkGenerator generator) { - super(serverLevel, chunkList #if MC_VER > MC_1_17_1 , chunkStatus, writeRadius #endif ); + super(serverLevel, chunkList #if MC_VER >= MC_1_17_1 , chunkStatus, writeRadius #endif ); this.firstPos = chunkList.get(0).getPos(); this.generator = generator; this.lightEngine = lightEngine; @@ -115,7 +115,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 // Bypass BCLib mixin overrides. @Override public boolean ensureCanWrite(BlockPos blockPos) @@ -130,7 +130,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion { return false; } - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 if (center.isUpgrading()) { LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration(); @@ -185,7 +185,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion BlockState blockState = this.getBlockState(blockPos); // This is a bypass for the spawner block since MC complains about not having it - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 if (blockState.getBlock() instanceof SpawnerBlock) { return ((EntityBlock) blockState.getBlock()).newBlockEntity(blockPos, blockState); @@ -269,7 +269,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl); if (chunk instanceof LevelChunk) { - chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER > MC_1_18_2 , true #endif ); + chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER >= MC_1_18_2 , true #endif ); } return chunk; } @@ -331,7 +331,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion private Biome _getBiome(BlockPos pos) { - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 return getBiome(pos).value(); #else return getBiome(pos); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java index 0be2237ff..f46b77131 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java @@ -87,7 +87,7 @@ public class DummyLightEngine extends LevelLightEngine @Override public void retainData(ChunkPos chunkPos, boolean bl) { } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public int getLightSectionCount() { throw new UnsupportedOperationException("This should never be used!"); } @Override 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 268445fa2..097962b94 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,12 +23,12 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor; import net.minecraft.world.level.BlockGetter; -#if MC_VER > MC_1_17_1 +#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 +#if MC_VER >= MC_1_20_1 import net.minecraft.world.level.chunk.LightChunk; #endif @@ -64,7 +64,7 @@ public class LightGetterAdaptor implements LightChunkGetter return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter); } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 public LevelHeightAccessor getLevelHeightAccessor() { return 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 69777916e..05c846540 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 @@ -41,13 +41,13 @@ import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.StructureFeatureManager; #else -#if MC_VER > MC_1_19_4 +#if MC_VER >= MC_1_19_4 import net.minecraft.world.level.levelgen.WorldOptions; #endif import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.StructureManager; #endif -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.structure.StructureCheck; #endif @@ -69,17 +69,17 @@ public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureF WorldOptions worldOptions; #endif - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 StructureCheck structureCheck; #endif #if MC_VER < MC_1_19_4 public WorldGenStructFeatManager( WorldGenSettings worldGenSettings, - WorldGenLevel genLevel #if MC_VER > MC_1_18_2 , StructureCheck structureCheck #endif ) + WorldGenLevel genLevel #if MC_VER >= MC_1_18_2 , StructureCheck structureCheck #endif ) { - super(genLevel, worldGenSettings #if MC_VER > MC_1_18_2 , structureCheck #endif ); + super(genLevel, worldGenSettings #if MC_VER >= MC_1_18_2 , structureCheck #endif ); this.genLevel = genLevel; this.worldGenSettings = worldGenSettings; } @@ -101,7 +101,7 @@ public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureF if (worldGenRegion == genLevel) return this; #if MC_VER < MC_1_19_4 - return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_VER > MC_1_18_2 , structureCheck #endif ); + return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_VER >= MC_1_18_2 , structureCheck #endif ); #else return new WorldGenStructFeatManager(worldOptions, worldGenRegion, structureCheck); #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 150b7f3bd..f0ee76c04 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 @@ -32,7 +32,7 @@ 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; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif 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 f5b7d1016..65092f701 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 @@ -32,7 +32,7 @@ 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_18_2 +#if MC_VER >= MC_1_18_2 #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 f3c01a650..1974e385d 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,14 +28,14 @@ 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 +#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 +#if MC_VER >= MC_1_18_2 import net.minecraft.world.level.levelgen.blending.Blender; #endif diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java index 0a22eae65..63cc74800 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java @@ -110,7 +110,7 @@ public final class StepStructureStart tParams.structFeat, chunk, environment.params.structures); #endif - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 try { tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts()); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 4ef561058..97eb41228 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -59,7 +59,7 @@ public class FabricMain if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 #endif diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java index 7dc45f784..59c290576 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java @@ -24,7 +24,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.api.internal.SharedApi; import net.minecraft.client.multiplayer.ClientLevel; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 #endif import net.minecraft.world.level.chunk.LevelChunk; import org.spongepowered.asm.mixin.Mixin; @@ -44,14 +44,14 @@ public class MixinClientLevel // //Moved to MixinClientPacketListener // @Inject(method = "", at = @At("TAIL")) // private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, -// #if MC_VER > MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i, -// #if MC_VER > MC_1_18_2 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) +// #if MC_VER >= MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i, +// #if MC_VER >= MC_1_18_2 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) // { // ClientApi.INSTANCE.clientLevelLoadEvent(WorldWrapper.getWorldWrapper((ClientLevel)(Object)this)); // } // Moved to overriding the enableChunkLight(...) method over at ClientPacketListener for 1.20+ - #if MC_VER > MC_1_18_2 && MC_VER < MC_1_20_1 // Only the setLightReady is only available after 1.18. This ensures the light data is ready. + #if MC_VER >= MC_1_18_2 && MC_VER < MC_1_20_1 // Only the setLightReady is only available after 1.18. This ensures the light data is ready. @Inject(method = "setLightReady", at = @At("HEAD")) private void onChunkLightReady(int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java index ac6c09572..2e7716b87 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -#if MC_VER > MC_1_20_1 +#if MC_VER >= MC_1_20_1 import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import net.minecraft.world.level.chunk.LevelChunk; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; @@ -45,7 +45,7 @@ public class MixinClientPacketListener ClientApi.INSTANCE.onClientOnlyDisconnected(); } - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 @Inject(method = "enableChunkLight", at = @At("TAIL")) void onEnableChunkLight(LevelChunk chunk, int x, int z, CallbackInfo ci) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java index 5a11f09d8..4cc9c68c2 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index f96c258de..3e7e1c12b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if MC_VER > MC_1_20_2 + #if MC_VER >= MC_1_20_2 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java index cde893175..498fdf8c9 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java @@ -2,7 +2,7 @@ package com.seibel.distanthorizons.fabric.mixins.mods.sodium; /* Removed since DH now uses Indium so we can use the Fabric rendering API instead -#if MC_VER > MC_1_20_1 +#if MC_VER >= MC_1_20_1 // Sodium 0.5 import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.core.api.internal.ClientApi; @@ -55,7 +55,7 @@ public class MixinSodiumRenderer } -#elif MC_VER > MC_1_17_1 +#elif MC_VER >= MC_1_17_1 // Sodium 0.3 to 0.4 import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java index ed33bc5b0..8bfd986df 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index 7ea166ef7..24641322f 100644 --- 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 @@ -22,7 +22,7 @@ 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 +#if MC_VER >= MC_1_18_2 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java index 86a6909d2..7145d673a 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java @@ -60,21 +60,21 @@ public class SodiumAccessor implements ISodiumAccessor return "Sodium-Fabric"; } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Override public HashSet getNormalRenderedChunks() { SodiumWorldRenderer renderer = SodiumWorldRenderer.instance(); LevelHeightAccessor height = Minecraft.getInstance().level; - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 // TODO: This is just a tmp solution, use a proper solution later return MC_RENDER.getMaximumRenderedChunks().stream().filter((DhChunkPos chunk) -> { return (renderer.isBoxVisible( chunk.getMinBlockX() + 1, height.getMinBuildHeight() + 1, chunk.getMinBlockZ() + 1, chunk.getMinBlockX() + 15, height.getMaxBuildHeight() - 1, chunk.getMinBlockZ() + 15)); }).collect(Collectors.toCollection(HashSet::new)); - #elif MC_VER > MC_1_18_2 + #elif MC_VER >= MC_1_18_2 // 0b11 = Lighted chunk & loaded chunk return renderer.getChunkTracker().getChunks(0b00).filter( (long l) -> { @@ -134,7 +134,7 @@ public class SodiumAccessor implements ISodiumAccessor @Override public void setFogOcclusion(boolean b) { - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 me.jellysquid.mods.sodium.client.SodiumClientMod.options().performance.useFogOcclusion = b; #endif } 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 836cd6cf3..085d2e477 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -44,7 +44,7 @@ import net.minecraftforge.event.level.ChunkEvent; import net.minecraftforge.event.level.LevelEvent; #endif -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraftforge.client.event.RenderLevelStageEvent; #endif import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -298,15 +298,15 @@ public class ForgeClientProxy //===========// @SubscribeEvent - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 public void afterLevelRenderEvent(RenderLevelStageEvent event) #else public void afterLevelRenderEvent(TickEvent.RenderTickEvent event) #endif { - #if MC_VER > MC_1_20_1 + #if MC_VER >= MC_1_20_1 if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_LEVEL) - #elif MC_VER > MC_1_18_2 + #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??? diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index d88441f92..4195b2dea 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -39,7 +39,7 @@ import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; -#if MC_VER > MC_1_19_2 +#if MC_VER >= MC_1_19_2 import net.minecraft.util.RandomSource; #endif import net.minecraft.world.level.ColorResolver; @@ -55,7 +55,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.ExtensionPoint; #elif MC_VER == MC_1_17_1 import net.minecraftforge.fmlclient.ConfigGuiHandler; -#elif MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2 +#elif MC_VER >= MC_1_18_2 && MC_VER < MC_1_19_2 import net.minecraftforge.client.ConfigGuiHandler; #else import net.minecraftforge.client.ConfigScreenHandler; @@ -131,7 +131,7 @@ public class ForgeMain implements LodForgeMethodCaller #if MC_VER < MC_1_17_1 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> GetConfigScreen.getScreen(parent)); - #elif MC_VER >= MC_1_17_1 && MC_VER <= MC_1_19_2 + #elif MC_VER >= MC_1_17_1 && MC_VER < MC_1_19_2 ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class, () -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> GetConfigScreen.getScreen(parent))); #else @@ -184,7 +184,7 @@ public class ForgeMain implements LodForgeMethodCaller #else public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_VER > MC_1_19_2 , RenderType.solid() #endif ); + return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_VER >= MC_1_19_2 , RenderType.solid() #endif ); } #endif diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java index 9834b90bf..614054ee2 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java @@ -16,7 +16,7 @@ public class MixinGameRenderer { private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 // FIXME: This I think will dup multiple renderStartupEvent calls... @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) public void onStartupShaders(CallbackInfo ci) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index 155c30259..b8c25e6e1 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -61,7 +61,7 @@ public class MixinMinecraft } #endif - #if MC_VER > MC_1_20_2 + #if MC_VER >= MC_1_20_2 @Redirect( method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java index 900d1115c..dee12f792 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java @@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread } } - #if MC_VER > MC_1_17_1 + #if MC_VER >= MC_1_17_1 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) @@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread } } #endif - #if MC_VER > MC_1_18_2 + #if MC_VER >= MC_1_18_2 @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", at = @At("HEAD"), cancellable = true) private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) 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 index 3ce324a04..2cb73c02c 100644 --- 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 @@ -20,7 +20,7 @@ package com.seibel.distanthorizons.forge.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; -#if MC_VER > MC_1_18_2 +#if MC_VER >= MC_1_18_2 import net.minecraft.util.ThreadingDetector; import org.spongepowered.asm.mixin.Mutable; From d597634ac6e005c6b07345848c902d836b030cd7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 12 Dec 2023 07:47:22 -0600 Subject: [PATCH 025/301] Fix forge 1.20.4 crashing due to incorrect version number order --- versionProperties/1.20.4.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 3edc33c15..5cec6abec 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -2,7 +2,7 @@ java_version=17 minecraft_version=1.20.4 parchment_version=1.20.1:2023.09.03 -compatible_minecraft_versions=["1.20.4", "1.20.3"] +compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 builds_for=fabric,forge From 6044d24a4809df08fa7b0ff398feffad321b7076 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 13 Dec 2023 22:08:45 -0600 Subject: [PATCH 026/301] Fix ThreadPool null pointer before world startup --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 19d20f559..77d8f413e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 19d20f5591fbb7a72fa623fcd1831f9e6d28e713 +Subproject commit 77d8f413e6def735b3d30664a5b9fd7076a2034e From 4d8ce3b5eafb61b73b9804ae1edf04342849fa99 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 14 Dec 2023 07:50:57 -0600 Subject: [PATCH 027/301] Optimize DH lighting for chunks with populated sections Specifically improves lighting speed for BigGlobe worlds --- .../common/wrappers/chunk/ChunkWrapper.java | 89 +++++++++++++++---- coreSubProjects | 2 +- 2 files changed, 71 insertions(+), 20 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 36cb5c311..c0b0235ab 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 @@ -100,6 +100,9 @@ public class ChunkWrapper implements IChunkWrapper private boolean useDhLighting; + private int minNonEmptyHeight = Integer.MIN_VALUE; + private int maxNonEmptyHeight = Integer.MAX_VALUE; + /** * Due to vanilla `isClientLightReady()` not being designed for use by a non-render thread, it may return 'true' * before the light engine has ticked, (right after all light changes is marked by the engine to be processed). @@ -165,8 +168,18 @@ public class ChunkWrapper implements IChunkWrapper public int getMaxBuildHeight() { return this.chunk.getMaxBuildHeight(); } @Override - public int getMinFilledHeight() + public int getMinNonEmptyHeight() { + if (this.minNonEmptyHeight != Integer.MIN_VALUE) + { + return this.minNonEmptyHeight; + } + + + // default if every section is empty or missing + this.minNonEmptyHeight = this.getMinBuildHeight(); + + // determine the lowest empty section (bottom up) LevelChunkSection[] sections = this.chunk.getSections(); for (int index = 0; index < sections.length; index++) { @@ -175,27 +188,65 @@ public class ChunkWrapper implements IChunkWrapper continue; } - #if MC_VER == MC_1_16_5 - if (!sections[index].isEmpty()) + if (!isChunkSectionEmpty(sections[index])) { - // convert from an index to a block coordinate - return this.chunk.getSections()[index].bottomBlockY() * 16; + this.minNonEmptyHeight = this.getChunkSectionMinHeight(index); + break; } - #elif MC_VER == MC_1_17_1 - if (!sections[index].isEmpty()) - { - // convert from an index to a block coordinate - return this.chunk.getSections()[index].bottomBlockY() * 16; - } - #else - if (!sections[index].hasOnlyAir()) - { - // convert from an index to a block coordinate - return this.chunk.getSectionYFromSectionIndex(index) * 16; - } - #endif } - return Integer.MAX_VALUE; + + return this.minNonEmptyHeight; + } + + + @Override + public int getMaxNonEmptyHeight() + { + if (this.maxNonEmptyHeight != Integer.MAX_VALUE) + { + return this.maxNonEmptyHeight; + } + + + // default if every section is empty or missing + this.maxNonEmptyHeight = this.getMaxBuildHeight(); + + // determine the highest empty section (top down) + LevelChunkSection[] sections = this.chunk.getSections(); + for (int index = sections.length-1; index >= 0; index--) + { + if (sections[index] == null) + { + continue; + } + + if (!isChunkSectionEmpty(sections[index])) + { + this.maxNonEmptyHeight = this.getChunkSectionMinHeight(index) + 16; + break; + } + } + + return this.maxNonEmptyHeight; + } + private static boolean isChunkSectionEmpty(LevelChunkSection section) + { + #if MC_VER == MC_1_16_5 + return section.isEmpty(); + #elif MC_VER == MC_1_17_1 + return section.isEmpty(); + #else + return section.hasOnlyAir(); + #endif + } + private int getChunkSectionMinHeight(int index) + { + // convert from an index to a block coordinate + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + return this.chunk.getSections()[index].bottomBlockY() * 16; + #else + return this.chunk.getSectionYFromSectionIndex(index) * 16; + #endif } diff --git a/coreSubProjects b/coreSubProjects index 77d8f413e..ebebc5566 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 77d8f413e6def735b3d30664a5b9fd7076a2034e +Subproject commit ebebc5566e5b44e3fa86c3f1b80a91a25a218ea0 From dc8aa7624b4675706986c8a40075c8b3dbc37bcb Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Dec 2023 09:09:46 -0600 Subject: [PATCH 028/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index ebebc5566..25d51842a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit ebebc5566e5b44e3fa86c3f1b80a91a25a218ea0 +Subproject commit 25d51842a7fc7e626634437a690d2a4d64f652af From 60e4128316200130d31cd88cf478f990a371fe0c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Dec 2023 09:50:41 -0600 Subject: [PATCH 029/301] Add DhApi.isDhThread() --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 25d51842a..7c678a4a4 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 25d51842a7fc7e626634437a690d2a4d64f652af +Subproject commit 7c678a4a4127106576c8dbe2d2bab2d565e94e70 From d2acaba5c7c5e99f625cc2709c3f00d2532577a7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Dec 2023 15:49:53 -0600 Subject: [PATCH 030/301] Add IDhApiWrapperFactory --- .../common/wrappers/WrapperFactory.java | 171 +++++++++++++++++- coreSubProjects | 2 +- 2 files changed, 162 insertions(+), 11 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 8b597fbfd..a9074135f 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 @@ -19,7 +19,11 @@ package com.seibel.distanthorizons.common.wrappers; +import com.seibel.distanthorizons.api.interfaces.block.IDhApiBiomeWrapper; +import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper; import com.seibel.distanthorizons.api.interfaces.override.worldGenerator.IDhApiWorldGenerator; +import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper; +import com.seibel.distanthorizons.api.interfaces.factories.IDhApiWrapperFactory; import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper; import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; @@ -35,9 +39,12 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.Holder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; import java.io.IOException; @@ -55,6 +62,9 @@ public class WrapperFactory implements IWrapperFactory + //==============// + // core methods // + //==============// @Override public AbstractBatchGenerationEnvironmentWrapper createBatchGenerator(IDhLevel targetLevel) @@ -106,7 +116,7 @@ public class WrapperFactory implements IWrapperFactory } } - #if MC_VER // Always true + #if MC_VER <= MC_1_20_4 else if (objectArray.length == 2) { // correct number of parameters from the API @@ -155,7 +165,7 @@ public class WrapperFactory implements IWrapperFactory #else // Intentional compiler error to bring attention to the missing wrapper function. // If you need to work on an unimplemented version but don't have the ability to implement this yet - // you can comment it out, but please don't commit it. Someone will have to implement it . + // you can comment it out, but please don't commit it. Someone will have to implement it. // After implementing the new version please read this method's javadocs for instructions // on what other locations also need to be updated, the DhAPI specifically needs to @@ -169,24 +179,165 @@ public class WrapperFactory implements IWrapperFactory */ private static String createChunkWrapperErrorMessage(Object[] objectArray) { - StringBuilder message = new StringBuilder( - "Chunk wrapper creation failed. \n" + - "Expected parameters: \n"); + String[] expectedClassNames; - #if MC_VER // Always true - message.append("[" + ChunkAccess.class.getName() + "], \n"); - message.append("[" + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + "]. \n"); + #if MC_VER <= MC_1_20_4 + expectedClassNames = new String[] + { + ChunkAccess.class.getName(), + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + }; #else // See preprocessor comment in createChunkWrapper() for full documentation not implemented for this version of Minecraft! #endif + return createWrapperErrorMessage("Chunk wrapper", expectedClassNames, objectArray); + } + + + + //=============// + // api methods // + //=============// + + // documentation should be in the API interface + + public IDhApiBiomeWrapper getBiomeWrapper(Object[] objectArray, IDhApiLevelWrapper levelWrapper) + { + // confirm the API level wrapper is also a Core wrapper + if (!(levelWrapper instanceof ILevelWrapper)) + { + throw new ClassCastException("Unable to cast... only DH provided IDhApiLevelWrapper's can be used."); // TODO + } + ILevelWrapper coreLevelWrapper = (ILevelWrapper) levelWrapper; + + + + #if MC_VER < MC_1_20_4 + if (objectArray.length != 1) + { + throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); + } + #endif + + #if MC_VER < MC_1_18_2 + if (!(objectArray[0] instanceof Biome)) + { + throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); + } + + Biome biome = (Biome) objectArray[0]; + return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper); + #elif MC_VER <= MC_1_20_4 + if (!(objectArray[0] instanceof Holder) || !(((Holder) objectArray[0]).value() instanceof Biome)) + { + throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); + } + + Holder biomeHolder = (Holder) objectArray[0]; + return BiomeWrapper.getBiomeWrapper(biomeHolder, coreLevelWrapper); + #else + // See preprocessor comment in createChunkWrapper() for full documentation (not a typo, check createChunkWrapper()'s else statement for full documentation) + not implemented for this version of Minecraft! + #endif + } + /** + * Note: when this is updated for different MC versions, + * make sure you also update the documentation in {@link IDhApiWrapperFactory#getBiomeWrapper}. + */ + private static String createBiomeWrapperErrorMessage(Object[] objectArray) + { + String[] expectedClassNames; + + #if MC_VER < MC_1_18_2 + expectedClassNames = new String[] { Biome.class.getName() }; + #elif MC_VER <= MC_1_20_4 + expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; + #else + // See preprocessor comment in createChunkWrapper() for full documentation + not implemented for this version of Minecraft! + #endif + + return createWrapperErrorMessage("Biome wrapper", expectedClassNames, objectArray); + } + + public IDhApiBlockStateWrapper getBlockStateWrapper(Object[] objectArray, IDhApiLevelWrapper levelWrapper) + { + // confirm the API level wrapper is also a Core wrapper + if (!(levelWrapper instanceof ILevelWrapper)) + { + throw new ClassCastException("Unable to cast... only DH provided IDhApiLevelWrapper's can be used."); // TODO + } + ILevelWrapper coreLevelWrapper = (ILevelWrapper) levelWrapper; + + + + #if MC_VER <= MC_1_20_4 + if (objectArray.length != 1) + { + throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray)); + } + if (!(objectArray[0] instanceof BlockState)) + { + throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray)); + } + + BlockState blockState = (BlockState) objectArray[0]; + return BlockStateWrapper.fromBlockState(blockState, coreLevelWrapper); + #else + // See preprocessor comment in createChunkWrapper() for full documentation (not a typo, check createChunkWrapper()'s else statement for full documentation) + not implemented for this version of Minecraft! + #endif + } + /** + * Note: when this is updated for different MC versions, + * make sure you also update the documentation in {@link IDhApiWrapperFactory#getBlockStateWrapper}. + */ + private static String createBlockStateWrapperErrorMessage(Object[] objectArray) + { + String[] expectedClassNames; + + #if MC_VER <= MC_1_20_4 + expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; + #else + // See preprocessor comment in createChunkWrapper() for full documentation + not implemented for this version of Minecraft! + #endif + + return createWrapperErrorMessage("BlockState wrapper", expectedClassNames, objectArray); + } + + + + + //================// + // helper methods // + //================// + + private static String createWrapperErrorMessage(String wrapperName, String[] expectedClassNames, Object[] objectArray) + { + // error header + StringBuilder message = new StringBuilder( + wrapperName + " creation failed. \n" + + "Expected object array parameters: \n"); + + + // expected parameters + for (String expectedClassName : expectedClassNames) + { + message.append("[").append(expectedClassName).append("], \n"); + } + + + // given parameters if (objectArray.length != 0) { message.append("Given parameters: "); for (Object obj : objectArray) { - message.append("[").append(obj.getClass().getName()).append("], "); + String objClassName = (obj != null) ? obj.getClass().getName() : "NULL"; + message.append("[").append(objClassName).append("], "); } } else @@ -194,8 +345,8 @@ public class WrapperFactory implements IWrapperFactory message.append(" No parameters given."); } + return message.toString(); } - } diff --git a/coreSubProjects b/coreSubProjects index 7c678a4a4..c1309eb4e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7c678a4a4127106576c8dbe2d2bab2d565e94e70 +Subproject commit c1309eb4e87c9bcce02ee6f41d33a8fd60bc92a5 From 0156f03e9108ce083b4ffa36e0807fcc8f291bd8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Dec 2023 07:38:55 -0600 Subject: [PATCH 031/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index c1309eb4e..8dbeb16f3 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c1309eb4e87c9bcce02ee6f41d33a8fd60bc92a5 +Subproject commit 8dbeb16f33fd7294f85b881ae9ab6ca84077c6aa From 0504882afda76d9858627ddcd2b03692e28bb847 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 20 Dec 2023 07:45:21 -0600 Subject: [PATCH 032/301] Fix ocean lighting grid issue --- .../BatchGenerationEnvironment.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 0ba131419..59cc24b62 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 @@ -648,7 +648,19 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv int maxSkyLight = this.serverlevel.getServerLevelWrapper().hasSkyLight() ? 15 : 0; - ArrayList iChunkWrapperList = new ArrayList<>(chunksToGenerate); + // only light generated chunks, + // attempting to light un-generated chunks will cause lighting issues on bordering generated chunks + ArrayList iChunkWrapperList = new ArrayList<>(); + for (int i = 0; i < chunksToGenerate.size(); i++) // regular for loop since enhanced for loops increase GC pressure slightly + { + ChunkWrapper chunkWrapper = chunksToGenerate.get(i); + if (chunkWrapper.getChunk().getStatus() != ChunkStatus.EMPTY) + { + iChunkWrapperList.add(chunkWrapper); + } + } + + // light each chunk in the list for (int i = 0; i < iChunkWrapperList.size(); i++) { IChunkWrapper centerChunk = iChunkWrapperList.get(i); From ea0d4ba7d89e2f4c855f824367b202e33346dfcd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 20 Dec 2023 22:06:08 -0600 Subject: [PATCH 033/301] Potential fix for world gen lockup if files system fails --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 8dbeb16f3..f65b4205c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 8dbeb16f33fd7294f85b881ae9ab6ca84077c6aa +Subproject commit f65b4205c3949428b42de69de16ba6a0822d1b79 From bb6e29f254143b3d59c466769124058c74d0270f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 22 Dec 2023 07:19:26 -0600 Subject: [PATCH 034/301] Merge Builderb0y API world gen extension --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index f65b4205c..fa12443cb 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f65b4205c3949428b42de69de16ba6a0822d1b79 +Subproject commit fa12443cb11a096ab0cb11ba25cbd297ed5deaa1 From 28d4cc86a9519ccbf4e5f1e81324ff14f55f76c5 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 23 Dec 2023 04:07:44 +1030 Subject: [PATCH 035/301] Fixed 1.20.4 forge remap --- .../forge/mixins/client/MixinDynamicTexture.java | 7 ++++++- .../forge/mixins/client/MixinLevelRenderer.java | 3 +++ .../forge/mixins/client/MixinLightTexture.java | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) 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 index 3f02eb37d..4efbcd350 100644 --- 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 @@ -38,14 +38,19 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import javax.annotation.Nullable; + @Mixin(DynamicTexture.class) -public class MixinDynamicTexture implements ILightTextureMarker +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; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index f6223c099..0add4e5de 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -74,6 +74,9 @@ import org.lwjgl.opengl.GL15; public class MixinLevelRenderer { @Shadow + #if MC_VER >= MC_1_20_4 + (remap = false) + #endif private ClientLevel level; @Unique private static float previousPartialTicks = 0; 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..9bafb8a8f 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 @@ -36,6 +36,9 @@ 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; From c3bdc22e285feda6d2cd7a6124d98e340ed9bc6e Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 23 Dec 2023 05:30:05 +1030 Subject: [PATCH 036/301] NeoForged for 1.20.4! --- build.gradle | 11 +- coreSubProjects | 2 +- .../mixins/client/MixinDynamicTexture.java | 3 - .../mixins/client/MixinLevelRenderer.java | 3 - .../mixins/client/MixinLightTexture.java | 3 - neoforged/build.gradle | 149 +++++++++ neoforged/gradle.properties | 1 + .../forge/ForgeClientProxy.java | 285 ++++++++++++++++++ .../distanthorizons/forge/ForgeMain.java | 161 ++++++++++ .../forge/ForgeServerProxy.java | 125 ++++++++ .../forge/mixins/ForgeMixinPlugin.java | 71 +++++ .../client/MixinClientPacketListener.java | 29 ++ .../client/MixinDebugScreenOverlay.java | 23 ++ .../mixins/client/MixinDynamicTexture.java | 77 +++++ .../forge/mixins/client/MixinFogRenderer.java | 84 ++++++ .../mixins/client/MixinGameRenderer.java | 58 ++++ .../mixins/client/MixinLevelRenderer.java | 185 ++++++++++++ .../mixins/client/MixinLightTexture.java | 48 +++ .../forge/mixins/client/MixinMinecraft.java | 95 ++++++ .../mixins/client/MixinOptionsScreen.java | 81 +++++ .../forge/mixins/client/MixinTextureUtil.java | 31 ++ .../mixins/client/MixinWorldUpgrader.java | 156 ++++++++++ .../mixins/server/MixinChunkGenerator.java | 62 ++++ .../mixins/server/MixinTFChunkGenerator.java | 61 ++++ .../server/MixinUtilBackgroundThread.java | 78 +++++ .../server/unsafe/MixinThreadingDetector.java | 59 ++++ .../forge/wrappers/ForgeDependencySetup.java | 48 +++ .../wrappers/modAccessor/ModChecker.java | 35 +++ .../modAccessor/OptifineAccessor.java | 43 +++ .../resources/DistantHorizons.mixins.json | 24 ++ .../src/main/resources/META-INF/mods.toml | 34 +++ neoforged/src/main/resources/pack.mcmeta | 10 + settings.gradle | 6 +- versionProperties/1.20.4.properties | 12 +- 34 files changed, 2135 insertions(+), 18 deletions(-) create mode 100644 neoforged/build.gradle create mode 100644 neoforged/gradle.properties create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java create mode 100644 neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java create mode 100644 neoforged/src/main/resources/DistantHorizons.mixins.json create mode 100644 neoforged/src/main/resources/META-INF/mods.toml create mode 100644 neoforged/src/main/resources/pack.mcmeta diff --git a/build.gradle b/build.gradle index 2656dd32f..9a8144508 100644 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,12 @@ forgix { forge { jarLocation = "build/libs/DistantHorizons-forge-${rootProject.versionStr}.jar" } + + if (findProject(":neoforged")) + custom { + projectName = "neoforged" + jarLocation = "build/libs/DistantHorizons-neoforged-${rootProject.versionStr}.jar" + } if (findProject(":fabric")) fabric { @@ -105,7 +111,10 @@ subprojects { p -> // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries // Apply forge's loom - if (findProject(":forge") && p == project(":forge")) + if ( + (findProject(":forge") && p == project(":forge")) || + (findProject(":neoforged") && p == project(":neoforged")) + ) apply plugin: "dev.architectury.loom" diff --git a/coreSubProjects b/coreSubProjects index fa12443cb..1b8ee5cd4 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit fa12443cb11a096ab0cb11ba25cbd297ed5deaa1 +Subproject commit 1b8ee5cd48f8abc18bbdfe23fe160d17dc5d6cef 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 index 4efbcd350..7117e7063 100644 --- 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 @@ -48,9 +48,6 @@ public abstract class MixinDynamicTexture implements ILightTextureMarker private boolean isLightTexture = false; @Shadow - #if MC_VER >= MC_1_20_4 - (remap = false) - #endif @Final private NativeImage pixels; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 0add4e5de..f6223c099 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -74,9 +74,6 @@ import org.lwjgl.opengl.GL15; public class MixinLevelRenderer { @Shadow - #if MC_VER >= MC_1_20_4 - (remap = false) - #endif private ClientLevel level; @Unique private static float previousPartialTicks = 0; 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 9bafb8a8f..f350a1754 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 @@ -36,9 +36,6 @@ 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; diff --git a/neoforged/build.gradle b/neoforged/build.gradle new file mode 100644 index 000000000..eb49e83bb --- /dev/null +++ b/neoforged/build.gradle @@ -0,0 +1,149 @@ +plugins { + // Note: This is only needed for multi-loader projects + // The main architectury loom version is set at the start of the root build.gradle + id "architectury-plugin" version "3.4-SNAPSHOT" +} + +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 + +architectury { + platformSetupLoomIde() + forge() +} + +repositories { + maven { + name "Neoforged" + url "https://maven.neoforged.net/releases/" + } +} + +//loom { +// forge { +// convertAccessWideners.set(true) +// extraAccessWideners.add("lod.accesswidener") +// mixinConfigs("DistantHorizons.mixins.json") +// } +//} + +loom { + silentMojangMappingsLicense() // Shut the licencing warning + accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") + + neoForge { + // Access wideners are now defined in the `remapJar.atAccessWideners` +// convertAccessWideners = true +// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name + + // Mixins are now defined in the `mods.toml` +// mixinConfigs = [ +// "DistantHorizons.mixins.json" +// ] + } + mixin { + useLegacyMixinAp = true + + // Mixins are now defined in the `mods.toml` +// mixinConfigs = [ +// "DistantHorizons.mixins.json" +// ] + } + + // "runs" isn't required, but when we do need it then it can be useful + runs { + client { + client() + setConfigName("Neoforged Client") + ideConfigGenerated(true) + runDir("../run") +// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) + } + server { + server() + setConfigName("Neoforged Server") + ideConfigGenerated(true) + runDir("../run") + } + } +} + +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null + + atAccessWideners.add("distanthorizons.accesswidener") +} + + +def addMod(path, enabled) { + if (enabled == "2") + dependencies { implementation(path) } + else if (enabled == "1") + dependencies { modCompileOnly(path) } +} +dependencies { + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" + mappings loom.layered() { + // Mojmap mappings + officialMojangMappings() + // Parchment mappings (it adds parameter mappings & javadoc) + parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") + + // Architectury hackishness +// it.mappings "dev.architectury:yarn-mappings-patch-forge:${rootProject.mappings_patch}" + } + + // Neoforged + neoForge "net.neoforged:neoforge:${rootProject.neoforged_version}" + + // Architectury API +// if (minecraft_version == "1.16.5") { +// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") +// } else { +// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") +// } + + // Starlight + addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge) +// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" + + addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) + + addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) + +// if (System.getProperty("idea.sync.active") != "true") { +// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" +// } +} + +task deleteResources(type: Delete) { + delete file("build/resources/main") +} + +tasks.register('copyAllResources') { + dependsOn(copyCoreResources) + dependsOn(copyCommonLoaderResources) +} + +processResources { + dependsOn(tasks.named('copyAllResources')) +} + +tasks.named('runClient') { + dependsOn(tasks.named('copyAllResources')) + finalizedBy(deleteResources) +} + + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +//components.java { +// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { +// skip() +// } +//} \ No newline at end of file diff --git a/neoforged/gradle.properties b/neoforged/gradle.properties new file mode 100644 index 000000000..85e1db4b7 --- /dev/null +++ b/neoforged/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoForge \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java new file mode 100644 index 000000000..f03766596 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -0,0 +1,285 @@ +/* + * 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; + +import com.seibel.distanthorizons.common.util.ProxyUtil; +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; +import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; +import com.seibel.distanthorizons.core.api.internal.ClientApi; +import com.seibel.distanthorizons.core.api.internal.SharedApi; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; + +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; +import com.seibel.distanthorizons.coreapi.ModInfo; +//import io.netty.buffer.ByteBuf; +import net.minecraft.world.level.LevelAccessor; + +import net.minecraft.client.multiplayer.ClientLevel; +import net.neoforged.neoforge.client.event.RenderLevelStageEvent; +import net.neoforged.neoforge.event.level.ChunkEvent; +import net.neoforged.neoforge.event.level.LevelEvent; + +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import net.minecraft.world.level.chunk.ChunkAccess; + +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +//import net.neoforged.network.NetworkRegistry; +//import net.neoforged.network.simple.SimpleChannel; +import org.apache.logging.log4j.Logger; +import org.lwjgl.glfw.GLFW; + +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; + +import net.minecraft.client.Minecraft; +import net.neoforged.neoforge.client.event.InputEvent; +import net.neoforged.neoforge.event.TickEvent; +import net.neoforged.bus.api.SubscribeEvent; +import org.lwjgl.opengl.GL32; + +/** + * This handles all events sent to the client, + * and is the starting point for most of the mod. + * + * @author James_Seibel + * @version 2023-7-27 + */ +public class ForgeClientProxy +{ + private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + +// private static SimpleChannel multiversePluginChannel; + + + private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } + + + + //=============// + // tick events // + //=============// + + @SubscribeEvent + public void clientTickEvent(TickEvent.ClientTickEvent event) + { + if (event.phase == TickEvent.Phase.START) + { + ClientApi.INSTANCE.clientTickEvent(); + } + } + + + + //==============// + // world events // + //==============// + + @SubscribeEvent + public void clientLevelLoadEvent(LevelEvent.Load event) + { + LOGGER.info("level load"); + + LevelAccessor level = event.getLevel(); + if (!(level instanceof ClientLevel)) + { + return; + } + + ClientLevel clientLevel = (ClientLevel) level; + IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel); + // TODO this causes a crash due to level being set to null somewhere + ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper); + } + @SubscribeEvent + public void clientLevelUnloadEvent(LevelEvent.Load event) + { + LOGGER.info("level unload"); + + LevelAccessor level = event.getLevel(); + if (!(level instanceof ClientLevel)) + { + return; + } + + ClientLevel clientLevel = (ClientLevel) level; + IClientLevelWrapper clientLevelWrapper = ClientLevelWrapper.getWrapper(clientLevel); + ClientApi.INSTANCE.clientLevelUnloadEvent(clientLevelWrapper); + } + + + + //==============// + // chunk events // + //==============// + + @SubscribeEvent + public void rightClickBlockEvent(PlayerInteractEvent.RightClickBlock event) + { + LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); + + LevelAccessor level = event.getLevel(); + + ChunkAccess chunk = level.getChunk(event.getPos()); + this.onBlockChangeEvent(level, chunk); + } + @SubscribeEvent + public void leftClickBlockEvent(PlayerInteractEvent.LeftClickBlock event) + { + LOGGER.trace("break or block attack at blockPos: " + event.getPos()); + + LevelAccessor level = event.getLevel(); + + ChunkAccess chunk = level.getChunk(event.getPos()); + this.onBlockChangeEvent(level, chunk); + } + private void onBlockChangeEvent(LevelAccessor level, ChunkAccess chunk) + { + ILevelWrapper wrappedLevel = ProxyUtil.getLevelWrapper(level); + SharedApi.INSTANCE.chunkBlockChangedEvent(new ChunkWrapper(chunk, level, wrappedLevel), wrappedLevel); + } + + + @SubscribeEvent + public void clientChunkLoadEvent(ChunkEvent.Load event) + { + ILevelWrapper wrappedLevel = ProxyUtil.getLevelWrapper(GetEventLevel(event)); + IChunkWrapper chunk = new ChunkWrapper(event.getChunk(), GetEventLevel(event), wrappedLevel); + SharedApi.INSTANCE.chunkLoadEvent(chunk, wrappedLevel); + } + @SubscribeEvent + public void clientChunkUnloadEvent(ChunkEvent.Unload event) + { + ILevelWrapper wrappedLevel = ProxyUtil.getLevelWrapper(GetEventLevel(event)); + IChunkWrapper chunk = new ChunkWrapper(event.getChunk(), GetEventLevel(event), wrappedLevel); + SharedApi.INSTANCE.chunkUnloadEvent(chunk, wrappedLevel); + } + + + + //==============// + // key bindings // + //==============// + + @SubscribeEvent + public void registerKeyBindings(InputEvent.Key event) + { + if (Minecraft.getInstance().player == null) + { + return; + } + if (event.getAction() != GLFW.GLFW_PRESS) + { + return; + } + + ClientApi.INSTANCE.keyPressedEvent(event.getKey()); + } + + + + //============// + // networking // + //============// + + /** @param event this is just to ensure the event is called at the right time, if it is called outside the {@link FMLClientSetupEvent} event, the binding may fail */ + public static void setupNetworkingListeners(FMLClientSetupEvent event) + { +// multiversePluginChannel = NetworkRegistry.newSimpleChannel( +// new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), +// // network protocol version +// () -> ModInfo.MULTIVERSE_PLUGIN_PROTOCOL_VERSION +"", +// // client accepted versions +// ForgeClientProxy::isReceivedProtocolVersionAcceptable, +// // server accepted versions +// ForgeClientProxy::isReceivedProtocolVersionAcceptable +// ); +// +// multiversePluginChannel.registerMessage(0/*should be incremented for each simple channel we listen to*/, ByteBuf.class, +// // encoder +// (pack, friendlyByteBuf) -> { }, +// // decoder +// (friendlyByteBuf) -> friendlyByteBuf.asByteBuf(), +// // message consumer +// (nettyByteBuf, contextRef) -> +// { +// ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf); +// contextRef.get().setPacketHandled(true); +// } +// ); + } + + public static boolean isReceivedProtocolVersionAcceptable(String versionString) + { + if (versionString.toLowerCase().contains("allowvanilla")) + { + // allow using networking on vanilla servers + return true; + } + else if (versionString.toLowerCase().contains("absent")) + { + // allow using networking even if DH isn't installed on the server + return true; + } + else + { + // DH is installed on the server, check if the version is valid to use + try + { + int version = Integer.parseInt(versionString); + return ModInfo.MULTIVERSE_PLUGIN_PROTOCOL_VERSION == version; + } + catch (NumberFormatException ignored) + { + return false; + } + } + } + + + + //===========// + // rendering // + //===========// + + @SubscribeEvent + public void afterLevelRenderEvent(RenderLevelStageEvent event) + { + if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_LEVEL) + { + try + { + // should generally only need to be set once per game session + // allows DH to render directly to Optifine's level frame buffer, + // allowing better shader support + MinecraftRenderWrapper.INSTANCE.finalLevelFrameBufferId = GL32.glGetInteger(GL32.GL_FRAMEBUFFER_BINDING); + } + catch (Exception | Error e) + { + LOGGER.error("Unexpected error in afterLevelRenderEvent: "+e.getMessage(), e); + } + } + } + + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java new file mode 100644 index 000000000..49219e57c --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -0,0 +1,161 @@ +/* + * 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; + +import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; +import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; +import com.seibel.distanthorizons.common.LodCommonMain; +import com.seibel.distanthorizons.common.forge.LodForgeMethodCaller; +import com.seibel.distanthorizons.common.wrappers.DependencySetup; +import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; +import com.seibel.distanthorizons.core.jar.ModJarInfo; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor; +import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; +import com.seibel.distanthorizons.coreapi.ModInfo; +import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; +import com.seibel.distanthorizons.forge.wrappers.ForgeDependencySetup; + +import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.ColorResolver; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.lifecycle.*; +import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; +import net.neoforged.neoforge.client.ConfigScreenHandler; + +import net.neoforged.neoforge.common.NeoForge; +import org.apache.logging.log4j.Logger; + +import net.minecraft.client.renderer.RenderType; +import net.neoforged.neoforge.client.model.data.ModelData; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +/** + * Initialize and setup the Mod.
+ * If you are looking for the real start of the mod + * check out the ClientProxy. + * + * @author coolGi + * @author Ran + * @author James Seibel + * @version 8-15-2022 + */ +@Mod(ModInfo.ID) +public class ForgeMain implements LodForgeMethodCaller +{ + private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); + public static ForgeClientProxy client_proxy = null; + public static ForgeServerProxy server_proxy = null; + + public ForgeMain() + { + DependencySetup.createClientBindings(); + +// initDedicated(null); +// initDedicated(null); + // Register the mod initializer (Actual event registration is done in the different proxies) + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initClient); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initDedicated); + } + + private void initClient(final FMLClientSetupEvent event) + { + ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); + + LOGGER.info("Initializing Mod"); + LodCommonMain.startup(this); + ForgeDependencySetup.createInitialBindings(); + LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); + + // Print git info (Useful for dev builds) + LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); + LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); + LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); + + client_proxy = new ForgeClientProxy(); + NeoForge.EVENT_BUS.register(client_proxy); + server_proxy = new ForgeServerProxy(false); + NeoForge.EVENT_BUS.register(server_proxy); + + if (AbstractOptifineAccessor.optifinePresent()) + { + ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); + } + + ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, + () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); + + ForgeClientProxy.setupNetworkingListeners(event); + + LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); + + ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); + + // Init config + // The reason im initialising in this rather than the post init process is cus im using this for the auto updater + LodCommonMain.initConfig(); + } + + private void initDedicated(final FMLDedicatedServerSetupEvent event) + { +// DependencySetup.createServerBindings(); +// initCommon(); + +// server_proxy = new ForgeServerProxy(true); +// MinecraftForge.EVENT_BUS.register(server_proxy); +// + postInitCommon(); + } + + private void postInitCommon() + { + LOGGER.info("Post-Initializing Mod"); + ForgeDependencySetup.runDelayedSetup(); + + LOGGER.info("Mod Post-Initialized"); + } + + private final ModelData modelData = ModelData.EMPTY; + + @Override + public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) + { + return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData, RenderType.solid() ); + } + + @Override //TODO: Check this if its still needed + public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) + { + return resolver.getColor(biome, x, z); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java new file mode 100644 index 000000000..a55530613 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -0,0 +1,125 @@ +package com.seibel.distanthorizons.forge; + +import com.seibel.distanthorizons.common.util.ProxyUtil; +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; +import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; +import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; +import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; +import com.seibel.distanthorizons.core.api.internal.ServerApi; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.neoforged.neoforge.event.TickEvent; +import net.neoforged.neoforge.event.level.ChunkEvent; +import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.bus.api.SubscribeEvent; + +import net.neoforged.neoforge.event.server.ServerAboutToStartEvent; +import net.neoforged.neoforge.event.server.ServerStoppingEvent; + + +import org.apache.logging.log4j.Logger; + +import java.util.function.Supplier; + +public class ForgeServerProxy +{ + private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } + + private final ServerApi serverApi = ServerApi.INSTANCE; + private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + private final boolean isDedicated; + public static Supplier isGenerationThreadChecker = null; + + + //=============// + // constructor // + //=============// + + public ForgeServerProxy(boolean isDedicated) + { + this.isDedicated = isDedicated; + isGenerationThreadChecker = BatchGenerationEnvironment::isCurrentThreadDistantGeneratorThread; + } + + + + //========// + // events // + //========// + + // ServerTickEvent (at end) + @SubscribeEvent + public void serverTickEvent(TickEvent.ServerTickEvent event) + { + if (event.phase == TickEvent.Phase.END) + { + this.serverApi.serverTickEvent(); + } + } + + // ServerWorldLoadEvent + @SubscribeEvent + public void dedicatedWorldLoadEvent(ServerAboutToStartEvent event) + { + this.serverApi.serverLoadEvent(this.isDedicated); + } + + // ServerWorldUnloadEvent + @SubscribeEvent + public void serverWorldUnloadEvent(ServerStoppingEvent event) + { + this.serverApi.serverUnloadEvent(); + } + + // ServerLevelLoadEvent + @SubscribeEvent + public void serverLevelLoadEvent(LevelEvent.Load event) + { + if (GetEventLevel(event) instanceof ServerLevel) + { + this.serverApi.serverLevelLoadEvent(this.getServerLevelWrapper((ServerLevel) GetEventLevel(event))); + } + } + + // ServerLevelUnloadEvent + @SubscribeEvent + public void serverLevelUnloadEvent(LevelEvent.Unload event) + { + if (GetEventLevel(event) instanceof ServerLevel) + { + this.serverApi.serverLevelUnloadEvent(this.getServerLevelWrapper((ServerLevel) GetEventLevel(event))); + } + } + + @SubscribeEvent + public void serverChunkLoadEvent(ChunkEvent.Load event) + { + ILevelWrapper levelWrapper = ProxyUtil.getLevelWrapper(GetEventLevel(event)); + + IChunkWrapper chunk = new ChunkWrapper(event.getChunk(), GetEventLevel(event), levelWrapper); + this.serverApi.serverChunkLoadEvent(chunk, levelWrapper); + } + @SubscribeEvent + public void serverChunkSaveEvent(ChunkEvent.Unload event) + { + ILevelWrapper levelWrapper = ProxyUtil.getLevelWrapper(GetEventLevel(event)); + + IChunkWrapper chunk = new ChunkWrapper(event.getChunk(), GetEventLevel(event), levelWrapper); + this.serverApi.serverChunkSaveEvent(chunk, levelWrapper); + } + + + + //================// + // helper methods // + //================// + + private static ServerLevelWrapper getServerLevelWrapper(ServerLevel level) { return ServerLevelWrapper.getWrapper(level); } + + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java new file mode 100644 index 000000000..734adf4ac --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java @@ -0,0 +1,71 @@ +package com.seibel.distanthorizons.forge.mixins; + +import net.neoforged.fml.ModList; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +/** + * @author coolGi + * @author cortex + */ +public class ForgeMixinPlugin implements IMixinConfigPlugin +{ + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) + { + if (mixinClassName.contains(".mods.")) + { // If the mixin wants to go into a mod then we check if that mod is loaded or not + return ModList.get().isLoaded( + mixinClassName + // What these 2 regex's do is get the mod name that we are checking out of the mixinClassName + // Eg. "com.seibel.distanthorizons.mixins.mods.sodium.MixinSodiumChunkRenderer" turns into "sodium" + .replaceAll("^.*mods.", "") // Replaces everything before the mods + .replaceAll("\\..*$", "") // Replaces everything after the mod name + ); + } + return true; + } + + + @Override + public void onLoad(String mixinPackage) + { + + } + + @Override + public String getRefMapperConfig() + { + return null; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) + { + + } + + @Override + public List getMixins() + { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) + { + + } + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) + { + + } + +} \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java new file mode 100644 index 000000000..2726de266 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java @@ -0,0 +1,29 @@ +package com.seibel.distanthorizons.forge.mixins.client; + +import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; +import com.seibel.distanthorizons.core.api.internal.ClientApi; +import net.minecraft.client.multiplayer.ClientPacketListener; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientPacketListener.class) +public class MixinClientPacketListener +{ + // TODO update fabric version as well + + @Inject(method = "handleLogin", at = @At("RETURN")) + void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); } + + #if MC_VER < MC_1_19_4 + @Inject(method = "cleanup", at = @At("HEAD")) + #else + @Inject(method = "close", at = @At("HEAD")) + #endif + void onCleanupStart(CallbackInfo ci) + { + ClientApi.INSTANCE.onClientOnlyDisconnected(); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java new file mode 100644 index 000000000..b2ea4d17a --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java @@ -0,0 +1,23 @@ +package com.seibel.distanthorizons.forge.mixins.client; + +import com.seibel.distanthorizons.core.logging.f3.F3Screen; +import net.minecraft.client.gui.components.DebugScreenOverlay; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +@Mixin(DebugScreenOverlay.class) +public class MixinDebugScreenOverlay +{ + + @Inject(method = "getSystemInformation", at = @At("RETURN")) + private void addCustomF3(CallbackInfoReturnable> cir) + { + List messages = cir.getReturnValue(); + F3Screen.addStringToDisplay(messages); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java new file mode 100644 index 000000000..4efbcd350 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java @@ -0,0 +1,77 @@ +/* + * 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 javax.annotation.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 + #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/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java new file mode 100644 index 000000000..db0ed1a9f --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java @@ -0,0 +1,84 @@ +/* + * 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.seibel.distanthorizons.core.config.Config; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.FogRenderer; +import net.minecraft.client.renderer.FogRenderer.FogMode; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +#if MC_VER < MC_1_17_1 +import net.minecraft.world.level.material.FluidState; +#else +import net.minecraft.world.level.material.FogType; +#endif + + + +@Mixin(FogRenderer.class) +public class MixinFogRenderer +{ + + // Using this instead of Float.MAX_VALUE because Sodium don't like it. + private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F; + private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F; + + @Inject(at = @At("RETURN"), + method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V", + remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge + private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) + { + #if MC_VER < MC_1_17_1 + FluidState fluidState = camera.getFluidInCamera(); + boolean cameraNotInFluid = fluidState.isEmpty(); + #else + FogType fogTypes = camera.getFluidInCamera(); + boolean cameraNotInFluid = fogTypes == FogType.NONE; + #endif + + + Entity entity = camera.getEntity(); + boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS); + if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN + && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial() + && Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get()) + { + #if MC_VER < MC_1_17_1 + RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE); + RenderSystem.fogEnd(A_EVEN_LARGER_VALUE); + #else + RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE); + RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE); + #endif + } + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java new file mode 100644 index 000000000..614054ee2 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java @@ -0,0 +1,58 @@ +package com.seibel.distanthorizons.forge.mixins.client; + +import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck; +import com.seibel.distanthorizons.core.api.internal.ClientApi; +import net.minecraft.client.renderer.GameRenderer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// TODO: Check if this port from fabric works +@Mixin(GameRenderer.class) +public class MixinGameRenderer +{ + private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName()); + + #if MC_VER >= MC_1_17_1 + // FIXME: This I think will dup multiple renderStartupEvent calls... + @Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL")) + public void onStartupShaders(CallbackInfo ci) + { + LOGGER.info("Starting up renderer (forge)"); + if (!DependencySetupDoneCheck.isDone) + { + LOGGER.warn("Dependency setup is not done yet, skipping renderer this startup event!"); + return; + } + ClientApi.INSTANCE.rendererStartupEvent(); + } + + @Inject(method = "shutdownShaders", at = @At("HEAD")) + public void onShutdownShaders(CallbackInfo ci) + { + LOGGER.info("Shutting down renderer (forge)"); + if (!DependencySetupDoneCheck.isDone) + { + LOGGER.warn("Dependency setup is not done yet, skipping renderer this shutdown event!"); + return; + } + ClientApi.INSTANCE.rendererShutdownEvent(); + } + #else + + + @Inject(method = {"loadEffect"}, at = @At("TAIL")) + public void onStartupShaders(CallbackInfo ci) { + ClientApi.INSTANCE.rendererStartupEvent(); + } + + @Inject(method = "shutdownEffect", at = @At("HEAD")) + public void onShutdownShaders(CallbackInfo ci) { + ClientApi.INSTANCE.rendererShutdownEvent(); + } + #endif + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java new file mode 100644 index 000000000..0add4e5de --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -0,0 +1,185 @@ +/* + * 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.vertex.PoseStack; +#if MC_VER < MC_1_19_4 +import com.mojang.math.Matrix4f; +#else +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LightTexture; +import org.joml.Matrix4f; +#endif +import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; +import com.seibel.distanthorizons.common.wrappers.McObjectConverter; +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; +import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; +import com.seibel.distanthorizons.core.config.Config; +import com.seibel.distanthorizons.core.api.internal.ClientApi; +import com.seibel.distanthorizons.coreapi.util.math.Mat4f; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.level.lighting.LevelLightEngine; +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.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.nio.FloatBuffer; + +#if MC_VER < MC_1_17_1 +import org.lwjgl.opengl.GL15; +#endif + + +/** + * This class is used to mix in my rendering code + * before Minecraft starts rendering blocks. + * If this wasn't done, and we used Forge's + * render last event, the LODs would render on top + * of the normal terrain.

+ * + * This is also the mixin for rendering the clouds + * + * @author coolGi + * @author James Seibel + * @version 12-31-2021 + */ +@Mixin(LevelRenderer.class) +public class MixinLevelRenderer +{ + @Shadow + #if MC_VER >= MC_1_20_4 + (remap = false) + #endif + private ClientLevel level; + @Unique + private static float previousPartialTicks = 0; + + // TODO: Is there any reason why this is here? Can it be deleted? + public MixinLevelRenderer() + { + throw new NullPointerException("Null cannot be cast to non-null type."); + } + + #if MC_VER < MC_1_17_1 + @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") + private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) + #else + @Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true) + public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTicks, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) + #endif + { + // get the partial ticks since renderBlockLayer doesn't + // have access to them + previousPartialTicks = partialTicks; + } + + + // TODO: Can we move this to forge's client proxy similarly to how fabric does it + #if MC_VER < MC_1_17_1 + @Inject(at = @At("HEAD"), + method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) + #elif MC_VER < MC_1_19_4 + @Inject(at = @At("HEAD"), + method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) + #elif MC_VER < MC_1_20_2 + @Inject(at = @At("HEAD"), + method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) + #else + @Inject(at = @At("HEAD"), + method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) + #endif + { + // get MC's model view and projection matrices + #if MC_VER == MC_1_16_5 + // get the matrices from the OpenGL fixed pipeline + float[] mcProjMatrixRaw = new float[16]; + GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw); + Mat4f mcProjectionMatrix = new Mat4f(mcProjMatrixRaw); + mcProjectionMatrix.transpose(); + + Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose()); + + #else + // get the matrices directly from MC + Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose()); + Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix); + #endif + + + + // only render before solid blocks + if (renderType.equals(RenderType.solid())) + { + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + + // experimental proof-of-concept option + if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) + { + float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks); + + #if MC_VER == MC_1_16_5 + SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); + #elif MC_VER < MC_1_19_4 + projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); + #else + projectionMatrix.set(matrixFloatArray); + #endif + } + } + + if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) + { + callback.cancel(); + } + } + + #if MC_VER < MC_1_19_4 + @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") + public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + #elif MC_VER < MC_1_20_1 + @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") + public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + #else + @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") + private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + #endif + { + ChunkWrapper.syncedUpdateClientLightStatus(); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java new file mode 100644 index 000000000..9bafb8a8f --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java @@ -0,0 +1,48 @@ +/* + * 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.seibel.distanthorizons.common.util.ILightTextureMarker; + +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; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(LightTexture.class) +public class MixinLightTexture +{ + @Shadow + #if MC_VER >= MC_1_20_4 + (remap = false) + #endif + @Final + private DynamicTexture lightTexture; + + @Inject(method = "", at = @At("RETURN")) + public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java new file mode 100644 index 000000000..b8c25e6e1 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -0,0 +1,95 @@ +package com.seibel.distanthorizons.forge.mixins.client; + +import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; +import com.seibel.distanthorizons.core.config.Config; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.jar.installer.GitlabGetter; +import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; +import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; +import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.TitleScreen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * At the moment this is only used for the auto updater + * + * @author coolGi + */ +@Mixin(Minecraft.class) +public class MixinMinecraft +{ + #if MC_VER < MC_1_20_2 + #if MC_VER == MC_1_20_1 + @Redirect( + method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") + ) + public void onOpenScreen(Minecraft instance, Screen guiScreen) + { + #else + @Redirect( + method = "(Lnet/minecraft/client/main/GameConfig;)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") + ) + public void onOpenScreen(Minecraft instance, Screen guiScreen) + { + #endif + if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it + { + instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened + return; + } + + if (SelfUpdater.onStart()) + { + instance.setScreen(new UpdateModScreen( + new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + )); + } + else + { + instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened + } + } + #endif + + #if MC_VER >= MC_1_20_2 + @Redirect( + method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V", + at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V") + ) + private void buildInitialScreens(Runnable runnable) + { + if ( + Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it + && SelfUpdater.onStart() + ) + { + runnable = () -> { + Minecraft.getInstance().setScreen(new UpdateModScreen( + // TODO: Change to runnable, instead of tittle screen + new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + )); + }; + } + + runnable.run(); + } + #endif + + @Inject(at = @At("HEAD"), method = "close()V", remap = false) + public void close(CallbackInfo ci) + { + SelfUpdater.onClose(); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java new file mode 100644 index 000000000..e3af8c9e8 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java @@ -0,0 +1,81 @@ +/* + * 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.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; +import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; +import com.seibel.distanthorizons.coreapi.ModInfo; +import com.seibel.distanthorizons.core.config.Config; +import net.minecraft.client.gui.screens.OptionsScreen; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +#if MC_VER < MC_1_19_2 +import net.minecraft.network.chat.TranslatableComponent; +#endif +import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +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.Objects; + +/** + * Adds a button to the menu to goto the config + * + * @author coolGi + * @version 12-02-2021 + */ +@Mixin(OptionsScreen.class) +public class MixinOptionsScreen extends Screen +{ + // Get the texture for the button + private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); + protected MixinOptionsScreen(Component title) + { + super(title); + } + + @Inject(at = @At("HEAD"), method = "init") + private void lodconfig$init(CallbackInfo ci) + { + if (Config.Client.optionsButton.get()) + this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif + (new TexturedButtonWidget( + // Where the button is on the screen + this.width / 2 - 180, this.height / 6 - 12, + // Width and height of the button + 20, 20, + // Offset + 0, 0, + // Some textuary stuff + 20, ICON_TEXTURE, 20, 40, + // Create the button and tell it where to go + // For now it goes to the client option by default + (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), + // Add a title to the button + #if MC_VER < MC_1_19_2 + new TranslatableComponent(ModInfo.ID + ".title"))); + #else + Component.translatable(ModInfo.ID + ".title"))); + #endif + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java new file mode 100644 index 000000000..a9da8632b --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java @@ -0,0 +1,31 @@ +package com.seibel.distanthorizons.forge.mixins.client; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.TextureUtil; +import com.seibel.distanthorizons.core.config.Config; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * Sets Minecraft's LOD Bias (looks similar to mipmaps) + * + * @author coolGi + */ +@Mixin(TextureUtil.class) +public class MixinTextureUtil +{ + @Redirect(method = "prepareImage(Lcom/mojang/blaze3d/platform/NativeImage$InternalGlFormat;IIII)V", + at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texParameter(IIF)V"), remap = false) + private static void setLodBias(int target, int pname, float param) + { + float biasValue = Config.Client.Advanced.Graphics.AdvancedGraphics.lodBias.get().floatValue(); + if (biasValue != 0) + { + // The target is GL11.GL_TEXTURE_2D + // And the pname is GL14.GL_TEXTURE_LOD_BIAS + GlStateManager._texParameter(target, pname, biasValue); + } + } + +} \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java new file mode 100644 index 000000000..9e2f76cda --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java @@ -0,0 +1,156 @@ +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/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java new file mode 100644 index 000000000..3541cf2fb --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java @@ -0,0 +1,62 @@ +/* + * 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; + +import org.spongepowered.asm.mixin.Mixin; +import net.minecraft.world.level.chunk.ChunkGenerator; + +#if MC_VER < MC_1_18_2 +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.WorldGenRegion; +import net.minecraft.world.level.StructureFeatureManager; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.WorldgenRandom; + +@Mixin(ChunkGenerator.class) +public class MixinChunkGenerator +{ + @Redirect(method = "applyBiomeDecoration", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/biome/Biome;generate(Lnet/minecraft/world/level/StructureFeatureManager;" + + "Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/server/level/WorldGenRegion;J" + + "Lnet/minecraft/world/level/levelgen/WorldgenRandom;Lnet/minecraft/core/BlockPos;)V" + + )) + private void wrapBiomeGenerateCall( + Biome biome, StructureFeatureManager structFeatManager, ChunkGenerator generator, + WorldGenRegion genRegion, long l, WorldgenRandom random, BlockPos pos) + { + synchronized (ChunkGenerator.class) + { + //ApiShared.LOGGER.info("Generating Biome {} and acquired lock.", biome.getRegistryName()); + biome.generate(structFeatManager, (ChunkGenerator) (Object) this, genRegion, l, random, pos); + } + //ApiShared.LOGGER.info("Released lock. Biome {} generated.", biome.getRegistryName()); + } + +} + +#else +@Mixin(ChunkGenerator.class) +public class MixinChunkGenerator { } +#endif \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java new file mode 100644 index 000000000..ab203d244 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java @@ -0,0 +1,61 @@ +package com.seibel.distanthorizons.forge.mixins.server; + +import net.minecraft.world.level.chunk.ChunkGenerator; +import org.spongepowered.asm.mixin.Mixin; + +#if MC_VER == MC_1_16_5 +@Mixin(ChunkGenerator.class) +class MixinTFChunkGenerator +{ + // not currently implemented, attempting to run with the mod enabled in the IDE causes the game to lock up +} +#elif MC_VER < MC_1_17_1 + +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import com.terraforged.mod.chunk.generator.FeatureGenerator; + +import java.util.Random; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; + +@Mixin(FeatureGenerator.class) +public class MixinTFChunkGenerator +{ + + @Redirect(method = "decorate(" + + "Lnet/minecraft/world/level/StructureFeatureManager;" + + "Lnet/minecraft/world/level/WorldGenLevel;" + + "Lnet/minecraft/world/level/chunk/ChunkAccess;" + + "Lnet/minecraft/world/level/biome/Biome;" + + "Lnet/minecraft/core/BlockPos;" + + "Lcom/terraforged/mod/profiler/watchdog/WatchdogContext;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/levelgen/feature/ConfiguredFeature;place(" + + "Lnet/minecraft/world/level/WorldGenLevel;" + + "Lnet/minecraft/world/level/chunk/ChunkGenerator;" + + "Ljava/util/Random;Lnet/minecraft/core/BlockPos;)Z" + )) + private boolean wrapDecorate$FeaturePlace(ConfiguredFeature feature, WorldGenLevel arg, + ChunkGenerator arg2, Random random, BlockPos arg3) { + synchronized(FeatureGenerator.class) { + //ClientApi.LOGGER.info("wrapDecorate FeaturePlace triggered"); + return feature.place(arg, arg2, random, arg3); + } + } + + //METHOD: com.terraforged.mod.chunk.generator.FeatureGenerator.decorate(StructureFeatureManager manager, + // WorldGenLevel region, ChunkAccess chunk, Biome biome, BlockPos pos, WatchdogContext context) + + //TARGET: boolean net.minecraft.world.level.levelgen.feature.ConfiguredFeature.place + // (WorldGenLevel arg, ChunkGenerator arg2, Random random, BlockPos arg3) +} + +#else +@Mixin(ChunkGenerator.class) +class MixinTFChunkGenerator { } +#endif \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java new file mode 100644 index 000000000..dee12f792 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java @@ -0,0 +1,78 @@ +/* + * 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; + +import java.util.concurrent.ExecutorService; +import java.util.function.Supplier; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck; +import com.seibel.distanthorizons.core.util.objects.DummyRunExecutorService; + +import net.minecraft.Util; + +@Mixin(Util.class) +public class MixinUtilBackgroundThread +{ + private static boolean shouldApplyOverride() + { + return DependencySetupDoneCheck.isDone && DependencySetupDoneCheck.getIsCurrentThreadDistantGeneratorThread.get(); + } + + @Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true) + private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable ci) + { + if (shouldApplyOverride()) + { + //ApiShared.LOGGER.info("util backgroundExecutor triggered"); + ci.setReturnValue(new DummyRunExecutorService()); + } + } + + #if MC_VER >= MC_1_17_1 + @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", + at = @At("HEAD"), cancellable = true) + private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable ci) + { + if (shouldApplyOverride()) + { + //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered"); + ci.setReturnValue(r); + } + } + #endif + #if MC_VER >= MC_1_18_2 + @Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;", + at = @At("HEAD"), cancellable = true) + private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier r, CallbackInfoReturnable> ci) + { + if (shouldApplyOverride()) + { + //ApiShared.LOGGER.info("util wrapThreadWithTaskName(Supplier) triggered"); + ci.setReturnValue(r); + } + } + #endif + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java new file mode 100644 index 000000000..2cb73c02c --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java @@ -0,0 +1,59 @@ +/* + * 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/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java new file mode 100644 index 000000000..5008ee6c0 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java @@ -0,0 +1,48 @@ +/* + * 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.wrappers; + +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; +import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker; + +/** + * Binds all necessary dependencies so we + * can access them in Core.
+ * This needs to be called before any Core classes + * are loaded. + * + * @author James Seibel + * @author Ran + * @version 12-1-2021 + */ +public class ForgeDependencySetup +{ + public static void createInitialBindings() + { + SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); + } + + public static void runDelayedSetup() + { + SingletonInjector.INSTANCE.runDelayedSetup(); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java new file mode 100644 index 000000000..4e8b11d69 --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java @@ -0,0 +1,35 @@ +/* + * 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.wrappers.modAccessor; + +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; +import net.neoforged.fml.ModList; + +public class ModChecker implements IModChecker +{ + public static final ModChecker INSTANCE = new ModChecker(); + + @Override + public boolean isModLoaded(String modid) + { + return ModList.get().isLoaded(modid); + } + +} diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java new file mode 100644 index 000000000..13b6688be --- /dev/null +++ b/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java @@ -0,0 +1,43 @@ +/* + * 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.wrappers.modAccessor; + +import java.util.HashSet; + +import com.seibel.distanthorizons.core.pos.DhChunkPos; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor; + +public class OptifineAccessor extends AbstractOptifineAccessor +{ + + @Override + public String getModName() + { + return "Optifine-Forge-1.18.X"; + } + + @Override + public HashSet getNormalRenderedChunks() + { + // TODO: Impl proper methods here + return null; + } + +} diff --git a/neoforged/src/main/resources/DistantHorizons.mixins.json b/neoforged/src/main/resources/DistantHorizons.mixins.json new file mode 100644 index 000000000..b30ef91ed --- /dev/null +++ b/neoforged/src/main/resources/DistantHorizons.mixins.json @@ -0,0 +1,24 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.seibel.distanthorizons.forge.mixins", + "mixins": [ + "server.unsafe.MixinThreadingDetector", + "server.MixinUtilBackgroundThread", + "server.MixinChunkGenerator", + "server.MixinTFChunkGenerator" + ], + "client": [ + "client.MixinClientPacketListener", + "client.MixinDebugScreenOverlay", + "client.MixinFogRenderer", + "client.MixinGameRenderer", + "client.MixinLevelRenderer", + "client.MixinDynamicTexture", + "client.MixinLightTexture", + "client.MixinOptionsScreen", + "client.MixinTextureUtil" + ], + "server": [], + "plugin": "com.seibel.distanthorizons.forge.mixins.ForgeMixinPlugin" +} diff --git a/neoforged/src/main/resources/META-INF/mods.toml b/neoforged/src/main/resources/META-INF/mods.toml new file mode 100644 index 000000000..c7e5b0193 --- /dev/null +++ b/neoforged/src/main/resources/META-INF/mods.toml @@ -0,0 +1,34 @@ +modLoader = "javafml" #//mandatory +loaderVersion = "*" # // mandatory. Allow all forge versions as we are definding what Minecraft versions we requre later on +license = "LGPL" +issueTrackerURL = "${issues}" + + +[[mods]] #//mandatory + modId = "distanthorizons" #//mandatory + version = "${version}" #//mandatory, gets the version number from jar populated by the build.gradle script + displayName = "${mod_name}" #//mandatory + authors = ["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"] # Should be done with `$authors`, but architectury complains + #//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ + displayURL = "${homepage}" + description = "${description}" #//mandatory. The description text for the mod + logoFile = "logo.png" + catalogueImageIcon = "icon.png" + credits = "Massive thanks to: Leonardo, Cola, Ran, CoolGi, and Leetom. For their hard work to bring Distant Horizons to where it is today. - James" + #// if not set defaults to "false" + clientSideOnly = "true" + #// if not set side defaults to "BOTH" + #// TODO change to "BOTH" when we add server support + side = "CLIENT" + #// Allow any version to be present (or not) on the server + acceptableRemoteVersions = "*" + +[[mixins]] +config = "DistantHorizons.mixins.json" + +[[dependencies.distanthorizons]] + modId = "minecraft" + type = "required" + versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for + ordering = "NONE" + side = "BOTH" \ No newline at end of file diff --git a/neoforged/src/main/resources/pack.mcmeta b/neoforged/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..37621f6f9 --- /dev/null +++ b/neoforged/src/main/resources/pack.mcmeta @@ -0,0 +1,10 @@ +{ + "pack": { + "pack_format": 7, + "supported_formats": { + "min_inclusive": 16, + "max_inclusive": 90000 + }, + "description": "Distant Horizons" + } +} diff --git a/settings.gradle b/settings.gradle index 7a873a6bb..393a31af1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,11 +4,15 @@ pluginManagement { name "Fabric" url "https://maven.fabricmc.net/" } - // TODO: Stop using Forge for versions with NeoForge + // TODO: Stop using Forge for versions with NeoForged maven { name "Forge" url "https://maven.minecraftforge.net/" } + maven { + name "Neoforged" + url "https://maven.neoforged.net/releases/" + } maven { name "Architectury (Better Forge because regular Forge is annoying)" // TODO: Once we switch to NeoForge, would it's gradle work better? or will it have Forge's problems in it url "https://maven.architectury.dev/" diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 5cec6abec..7c58a8fc8 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -1,10 +1,10 @@ # 1.20.4 version java_version=17 minecraft_version=1.20.4 -parchment_version=1.20.1:2023.09.03 +parchment_version=1.20.2:2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,forge +builds_for=fabric,neoforged # Fabric loader fabric_loader_version=0.15.1 @@ -36,13 +36,13 @@ fabric_api_version=0.91.2+1.20.4 enable_immersive_portals=0 enable_canvas=0 -# Forge loader -forge_version=49.0.3 - # Forge mod versions +# Neoforged loader +neoforged_version=20.4.49-beta + # Neoforged mod versions starlight_version_forge= terraforged_version= - # Forge mod run + # Neoforged 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 From 091b115aada5db9da3eb5171ae952dcf47fca7ac Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 23 Dec 2023 15:31:41 +1030 Subject: [PATCH 037/301] Added neoforged to the ci --- .gitlab-ci.yml | 9 ++++++--- build.gradle | 7 ++++--- settings.gradle | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8097c0218..86f1e2fb7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,17 +40,20 @@ build: name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" paths: - Merged/*.jar + - quilt/build/libs/*.jar - fabric/build/libs/*.jar - forge/build/libs/*.jar - - quilt/build/libs/*.jar + - neoforged/build/libs/*.jar exclude: # TODO: There is a lot of duplicate stuff here, try to maybe make it smaller - fabric/build/libs/*-all.jar - fabric/build/libs/*-sources.jar - - forge/build/libs/*-all.jar - - forge/build/libs/*-sources.jar - quilt/build/libs/*-all.jar - quilt/build/libs/*-sources.jar + - forge/build/libs/*-all.jar + - forge/build/libs/*-sources.jar + - neoforged/build/libs/*-all.jar + - neoforged/build/libs/*-sources.jar expire_in: 14 days when: always extends: .build_java diff --git a/build.gradle b/build.gradle index 9a8144508..e9470acbb 100644 --- a/build.gradle +++ b/build.gradle @@ -327,7 +327,7 @@ subprojects { p -> def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder // Fix forge version numbering system as it is weird - // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] which make more sense + // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)") // println compatible_forgemc_versions @@ -409,7 +409,7 @@ subprojects { p -> //// include "${accessWidenerVersion}.distanthorizons.accesswidener" // Jank solution to remove all unused accesswideners - // The line above would work..., except forge requires the original accesswidener file, meaning we require this jank solution to keep it + // The line above would work..., except that (neo)forge (well, mainly architectury) requires the original accesswidener file, meaning we require this jank solution to keep it exclude { file -> if (file.name.contains(".distanthorizons.accesswidener") && file.name != "${accessWidenerVersion}.distanthorizons.accesswidener") { return true @@ -455,7 +455,7 @@ subprojects { p -> } allprojects { p -> - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverWeAddLaterOn")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") @@ -536,6 +536,7 @@ allprojects { p -> includeGroup "forge-mod" } } + // TODO: If neoforged is ever needed, should we use that, or call it a forge mod? } // Adds some dependencies that are in vanilla but not in core diff --git a/settings.gradle b/settings.gradle index 393a31af1..69a4656fc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -88,7 +88,9 @@ project(":api").projectDir = file('coreSubProjects/api') include("common") // Enables or disables the subprojects depending on whats in the versionProperties/mcVer.properties for (loader in ((String) gradle.builds_for).split(",")) { - include(loader.strip()) // Strip it in case a space is added before or after the comma + def l = loader.strip() // Strip it in case a space is added before or after the comma + println "Adding loader " + l + include(l) } //if (gradle.builds_for.contains("fabric") || gradle.builds_for.contains("quilt")) // include("fabricLike") From ffc9771b1779b8096c4f9ccce03780fd96e14fa3 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 24 Dec 2023 19:20:35 +1030 Subject: [PATCH 038/301] Renamed forge stuff in neoforged to neoforged --- .../{forge => neoforged}/ForgeClientProxy.java | 2 +- .../distanthorizons/{forge => neoforged}/ForgeMain.java | 6 +++--- .../{forge => neoforged}/ForgeServerProxy.java | 2 +- .../{forge => neoforged}/mixins/ForgeMixinPlugin.java | 2 +- .../mixins/client/MixinClientPacketListener.java | 2 +- .../mixins/client/MixinDebugScreenOverlay.java | 2 +- .../mixins/client/MixinDynamicTexture.java | 2 +- .../mixins/client/MixinFogRenderer.java | 2 +- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 2 +- .../mixins/client/MixinLightTexture.java | 2 +- .../{forge => neoforged}/mixins/client/MixinMinecraft.java | 2 +- .../mixins/client/MixinOptionsScreen.java | 2 +- .../mixins/client/MixinTextureUtil.java | 2 +- .../mixins/client/MixinWorldUpgrader.java | 2 +- .../mixins/server/MixinChunkGenerator.java | 2 +- .../mixins/server/MixinTFChunkGenerator.java | 2 +- .../mixins/server/MixinUtilBackgroundThread.java | 2 +- .../mixins/server/unsafe/MixinThreadingDetector.java | 2 +- .../{forge => neoforged}/wrappers/ForgeDependencySetup.java | 4 ++-- .../wrappers/modAccessor/ModChecker.java | 2 +- .../wrappers/modAccessor/OptifineAccessor.java | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/ForgeClientProxy.java (99%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/ForgeMain.java (96%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/ForgeServerProxy.java (98%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/ForgeMixinPlugin.java (96%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinClientPacketListener.java (93%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinDebugScreenOverlay.java (91%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinDynamicTexture.java (97%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinFogRenderer.java (98%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinGameRenderer.java (96%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinLevelRenderer.java (99%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinLightTexture.java (96%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinMinecraft.java (98%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinOptionsScreen.java (97%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinTextureUtil.java (94%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/client/MixinWorldUpgrader.java (98%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/server/MixinChunkGenerator.java (97%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/server/MixinTFChunkGenerator.java (97%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/server/MixinUtilBackgroundThread.java (97%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/mixins/server/unsafe/MixinThreadingDetector.java (96%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/wrappers/ForgeDependencySetup.java (91%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/wrappers/modAccessor/ModChecker.java (94%) rename neoforged/src/main/java/com/seibel/distanthorizons/{forge => neoforged}/wrappers/modAccessor/OptifineAccessor.java (94%) diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java similarity index 99% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java index f03766596..449714877 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge; +package com.seibel.distanthorizons.neoforged; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java index 49219e57c..c60f364e8 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge; +package com.seibel.distanthorizons.neoforged; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; @@ -33,9 +33,9 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; -import com.seibel.distanthorizons.forge.wrappers.ForgeDependencySetup; +import com.seibel.distanthorizons.neoforged.wrappers.ForgeDependencySetup; -import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; +import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.OptifineAccessor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java index a55530613..83f6d644e 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge; +package com.seibel.distanthorizons.neoforged; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java index 734adf4ac..d2d467754 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins; +package com.seibel.distanthorizons.neoforged.mixins; import net.neoforged.fml.ModList; import org.objectweb.asm.tree.ClassNode; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java similarity index 93% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java index 2726de266..07f7b65d1 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java similarity index 91% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java index b2ea4d17a..b9f0d1ce6 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDebugScreenOverlay.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.core.logging.f3.F3Screen; import net.minecraft.client.gui.components.DebugScreenOverlay; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java index 4efbcd350..f58783e6b 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinDynamicTexture.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.mojang.blaze3d.platform.NativeImage; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java index db0ed1a9f..480fad3e8 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java index 614054ee2..56b2e4698 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck; import com.seibel.distanthorizons.core.api.internal.ClientApi; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java similarity index 99% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java index 0add4e5de..0054ab483 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; #if MC_VER < MC_1_19_4 diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java index 9bafb8a8f..6cea85ebd 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLightTexture.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.common.util.ILightTextureMarker; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java index b8c25e6e1..4b5b174c8 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java index e3af8c9e8..1049d0559 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java index a9da8632b..2502b116c 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinTextureUtil.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.TextureUtil; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java index 9e2f76cda..5b46ae32e 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinWorldUpgrader.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.client; +package com.seibel.distanthorizons.neoforged.mixins.client; import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType; import com.seibel.distanthorizons.api.interfaces.world.IDhApiDimensionTypeWrapper; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java index 3541cf2fb..1b492c5d3 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.server; +package com.seibel.distanthorizons.neoforged.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java index ab203d244..d1cdc6a5d 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.forge.mixins.server; +package com.seibel.distanthorizons.neoforged.mixins.server; import net.minecraft.world.level.chunk.ChunkGenerator; import org.spongepowered.asm.mixin.Mixin; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java index dee12f792..fdb9742d8 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.server; +package com.seibel.distanthorizons.neoforged.mixins.server; import java.util.concurrent.ExecutorService; import java.util.function.Supplier; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java index 2cb73c02c..1d62f4785 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.mixins.server.unsafe; +package com.seibel.distanthorizons.neoforged.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; #if MC_VER >= MC_1_18_2 diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java similarity index 91% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java index 5008ee6c0..b1e73a77d 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.wrappers; +package com.seibel.distanthorizons.neoforged.wrappers; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; -import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker; +import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.ModChecker; /** * Binds all necessary dependencies so we diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java index 4e8b11d69..8dfff8710 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.wrappers.modAccessor; +package com.seibel.distanthorizons.neoforged.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import net.neoforged.fml.ModList; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java index 13b6688be..6e157485d 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OptifineAccessor.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.forge.wrappers.modAccessor; +package com.seibel.distanthorizons.neoforged.wrappers.modAccessor; import java.util.HashSet; From 10bbcc79d35aa461db047fbae0b787866888b127 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 24 Dec 2023 19:27:36 +1030 Subject: [PATCH 039/301] Re-added forge to 1.20.4 build properties --- versionProperties/1.20.4.properties | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 7c58a8fc8..479aaa056 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,neoforged +builds_for=fabric,forge,neoforged # Fabric loader fabric_loader_version=0.15.1 @@ -36,13 +36,14 @@ fabric_api_version=0.91.2+1.20.4 enable_immersive_portals=0 enable_canvas=0 -# Neoforged loader +# (Neo)Forge loader +forge_version=49.0.3 neoforged_version=20.4.49-beta - # Neoforged mod versions + # (Neo)Forge mod versions starlight_version_forge= terraforged_version= - # Neoforged mod run + # (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 From 5f16f81d58c0b66ec5566d2e593353d94c5c7dd5 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 24 Dec 2023 21:16:10 +1030 Subject: [PATCH 040/301] Merged jar, now for fabric (works on quilt as well), forge and neoforged --- forge/build.gradle | 2 +- .../distanthorizons/forge/mixins/ForgeMixinPlugin.java | 4 ++++ ...izons.mixins.json => DistantHorizons.forge.mixins.json} | 0 forge/src/main/resources/META-INF/mods.toml | 3 ++- .../{ForgeMixinPlugin.java => NeoforgedMixinPlugin.java} | 6 +++++- ...s.mixins.json => DistantHorizons.neoforged.mixins.json} | 4 ++-- neoforged/src/main/resources/META-INF/mods.toml | 7 +++++-- 7 files changed, 19 insertions(+), 7 deletions(-) rename forge/src/main/resources/{DistantHorizons.mixins.json => DistantHorizons.forge.mixins.json} (100%) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/{ForgeMixinPlugin.java => NeoforgedMixinPlugin.java} (88%) rename neoforged/src/main/resources/{DistantHorizons.mixins.json => DistantHorizons.neoforged.mixins.json} (81%) diff --git a/forge/build.gradle b/forge/build.gradle index 0e34fa028..9c159a519 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -28,7 +28,7 @@ loom { extraAccessWideners.add loom.accessWidenerPath.get().asFile.name mixinConfigs = [ - "DistantHorizons.mixins.json" + "DistantHorizons.forge.mixins.json" ] } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java index 78f4fd7e5..9d2d7aa3c 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java @@ -1,5 +1,6 @@ package com.seibel.distanthorizons.forge.mixins; +import net.minecraft.client.ClientBrandRetriever; import net.minecraftforge.fml.ModList; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; @@ -18,6 +19,9 @@ public class ForgeMixinPlugin implements IMixinConfigPlugin @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (!ClientBrandRetriever.getClientModName().equals("forge")) + return false; + if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not return ModList.get().isLoaded( diff --git a/forge/src/main/resources/DistantHorizons.mixins.json b/forge/src/main/resources/DistantHorizons.forge.mixins.json similarity index 100% rename from forge/src/main/resources/DistantHorizons.mixins.json rename to forge/src/main/resources/DistantHorizons.forge.mixins.json diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 43a8eb78d..2a984312e 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -26,7 +26,8 @@ issueTrackerURL = "${issues}" [[dependencies.distanthorizons]] modId = "minecraft" - mandatory = true + mandatory = true # Forge syntax + type = "required" # Neoforged syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "NONE" side = "BOTH" \ No newline at end of file diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java similarity index 88% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java index d2d467754..68566e4f3 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/ForgeMixinPlugin.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java @@ -1,5 +1,6 @@ package com.seibel.distanthorizons.neoforged.mixins; +import net.minecraft.client.ClientBrandRetriever; import net.neoforged.fml.ModList; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; @@ -12,12 +13,15 @@ import java.util.Set; * @author coolGi * @author cortex */ -public class ForgeMixinPlugin implements IMixinConfigPlugin +public class NeoforgedMixinPlugin implements IMixinConfigPlugin { @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (!ClientBrandRetriever.getClientModName().equals("neoforge")) + return false; + if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not return ModList.get().isLoaded( diff --git a/neoforged/src/main/resources/DistantHorizons.mixins.json b/neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json similarity index 81% rename from neoforged/src/main/resources/DistantHorizons.mixins.json rename to neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json index b30ef91ed..c8d168b6c 100644 --- a/neoforged/src/main/resources/DistantHorizons.mixins.json +++ b/neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json @@ -1,7 +1,7 @@ { "required": true, "minVersion": "0.8", - "package": "com.seibel.distanthorizons.forge.mixins", + "package": "com.seibel.distanthorizons.neoforged.mixins", "mixins": [ "server.unsafe.MixinThreadingDetector", "server.MixinUtilBackgroundThread", @@ -20,5 +20,5 @@ "client.MixinTextureUtil" ], "server": [], - "plugin": "com.seibel.distanthorizons.forge.mixins.ForgeMixinPlugin" + "plugin": "com.seibel.distanthorizons.neoforged.mixins.NeoforgedMixinPlugin" } diff --git a/neoforged/src/main/resources/META-INF/mods.toml b/neoforged/src/main/resources/META-INF/mods.toml index c7e5b0193..2904583d0 100644 --- a/neoforged/src/main/resources/META-INF/mods.toml +++ b/neoforged/src/main/resources/META-INF/mods.toml @@ -23,12 +23,15 @@ issueTrackerURL = "${issues}" #// Allow any version to be present (or not) on the server acceptableRemoteVersions = "*" +# TODO: Once there is a way to move this to the `META-INF/MANIFEST.MF` with architectury, DO SO! +# (currently, this only works cus neoforge's mods.toml is added to the jar after forge's mods.toml, so this can work [[mixins]] -config = "DistantHorizons.mixins.json" + config = "DistantHorizons.neoforged.mixins.json" [[dependencies.distanthorizons]] modId = "minecraft" - type = "required" + mandatory = true # Forge syntax + type = "required" # Neoforged syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "NONE" side = "BOTH" \ No newline at end of file From 7f89a1a2cc86ccbd5fb8841cea55ef18a73669d4 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 24 Dec 2023 21:32:21 +1030 Subject: [PATCH 041/301] Fixed 1.16.5 & 1.17.1 compilation --- .../common/wrappers/WrapperFactory.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 a9074135f..2f922e3d8 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 @@ -39,7 +39,9 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper; import net.minecraft.client.multiplayer.ClientLevel; +#if MC_VER > MC_1_17_1 import net.minecraft.core.Holder; +#endif import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; @@ -298,11 +300,13 @@ public class WrapperFactory implements IWrapperFactory { String[] expectedClassNames; - #if MC_VER <= MC_1_20_4 + #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 expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #else - // See preprocessor comment in createChunkWrapper() for full documentation - not implemented for this version of Minecraft! + // See preprocessor comment in createChunkWrapper() for full documentation + not implemented for this version of Minecraft! #endif return createWrapperErrorMessage("BlockState wrapper", expectedClassNames, objectArray); From 0c8717a0da087835c47e640fdf1f9d50b3fab382 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 24 Dec 2023 21:42:17 +1030 Subject: [PATCH 042/301] Fixed implNote in JavaDocs (as it "technically" part of the official Java standard) --- build.gradle | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index e9470acbb..2f9653378 100644 --- a/build.gradle +++ b/build.gradle @@ -470,8 +470,21 @@ allprojects { p -> // this is the text that appears at the top of the overview (home) page // and is used when bookmarking a page javadoc.title = rootProject.mod_name + "-" + project.name - - + + // Some annotations arent "technically" part of the official java standard, + // so we define it ourself here + javadoc { + configure( options ) { + tags( + 'todo:X"', + 'apiNote:a:API Note:', + 'implSpec:a:Implementation Requirements:', + 'implNote:a:Implementation Note:' + ) + } + } + + repositories { // The central repo mavenCentral() From 39b77c783b260fa7c0fc3e88095fe0605cb67b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3zsa=20P=C3=A9ter?= Date: Sun, 24 Dec 2023 13:47:11 +0000 Subject: [PATCH 043/301] Fix clone URL --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 92244ca27..625bf6edd 100644 --- a/Readme.md +++ b/Readme.md @@ -134,7 +134,7 @@ From the File Explorer: 6. The compiled jar file will be in the folder `Merged` From the command line: -1. `git clone --recurse-submodules https://gitlab.com/gitlab.com/jeseibel/distant-horizons.git` +1. `git clone --recurse-submodules https://gitlab.com/jeseibel/distant-horizons.git` 2. `cd minecraft-lod-mod` 3. `./gradlew assemble` 4. `./gradlew mergeJars` From 92f0703723a74912267d7478697ca8793fea14a6 Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 25 Dec 2023 18:48:18 +1030 Subject: [PATCH 044/301] Removed depricated neoforged code --- .../com/seibel/distanthorizons/neoforged/ForgeMain.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java index c60f364e8..aab9d0d72 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java @@ -44,10 +44,10 @@ import net.minecraft.world.level.ColorResolver; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.*; -import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; import net.neoforged.neoforge.client.ConfigScreenHandler; import net.neoforged.neoforge.common.NeoForge; @@ -76,15 +76,15 @@ public class ForgeMain implements LodForgeMethodCaller public static ForgeClientProxy client_proxy = null; public static ForgeServerProxy server_proxy = null; - public ForgeMain() + public ForgeMain(IEventBus eventBus) { DependencySetup.createClientBindings(); // initDedicated(null); // initDedicated(null); // Register the mod initializer (Actual event registration is done in the different proxies) - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initClient); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initDedicated); + eventBus.addListener(this::initClient); + eventBus.addListener(this::initDedicated); } private void initClient(final FMLClientSetupEvent event) From aa6cbd1b7d62171c2fa0c77294c9b4c32c04494a Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 25 Dec 2023 18:50:24 +1030 Subject: [PATCH 045/301] Renamed forge classes to neoforge --- ...entProxy.java => NeoforgeClientProxy.java} | 2 +- .../{ForgeMain.java => NeoforgeMain.java} | 20 +++++++++---------- ...verProxy.java => NeoforgeServerProxy.java} | 7 ++----- ...etup.java => NeoforgeDependencySetup.java} | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/{ForgeClientProxy.java => NeoforgeClientProxy.java} (99%) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/{ForgeMain.java => NeoforgeMain.java} (91%) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/{ForgeServerProxy.java => NeoforgeServerProxy.java} (93%) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/{ForgeDependencySetup.java => NeoforgeDependencySetup.java} (97%) diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java similarity index 99% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java index 449714877..1390e2337 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeClientProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java @@ -64,7 +64,7 @@ import org.lwjgl.opengl.GL32; * @author James_Seibel * @version 2023-7-27 */ -public class ForgeClientProxy +public class NeoforgeClientProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java similarity index 91% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java index aab9d0d72..88facc284 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeMain.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java @@ -33,7 +33,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; -import com.seibel.distanthorizons.neoforged.wrappers.ForgeDependencySetup; +import com.seibel.distanthorizons.neoforged.wrappers.NeoforgeDependencySetup; import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.OptifineAccessor; @@ -70,13 +70,13 @@ import java.util.List; * @version 8-15-2022 */ @Mod(ModInfo.ID) -public class ForgeMain implements LodForgeMethodCaller +public class NeoforgeMain implements LodForgeMethodCaller { private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); - public static ForgeClientProxy client_proxy = null; - public static ForgeServerProxy server_proxy = null; + public static NeoforgeClientProxy client_proxy = null; + public static NeoforgeServerProxy server_proxy = null; - public ForgeMain(IEventBus eventBus) + public NeoforgeMain(IEventBus eventBus) { DependencySetup.createClientBindings(); @@ -93,7 +93,7 @@ public class ForgeMain implements LodForgeMethodCaller LOGGER.info("Initializing Mod"); LodCommonMain.startup(this); - ForgeDependencySetup.createInitialBindings(); + NeoforgeDependencySetup.createInitialBindings(); LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); // Print git info (Useful for dev builds) @@ -101,9 +101,9 @@ public class ForgeMain implements LodForgeMethodCaller LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); - client_proxy = new ForgeClientProxy(); + client_proxy = new NeoforgeClientProxy(); NeoForge.EVENT_BUS.register(client_proxy); - server_proxy = new ForgeServerProxy(false); + server_proxy = new NeoforgeServerProxy(false); NeoForge.EVENT_BUS.register(server_proxy); if (AbstractOptifineAccessor.optifinePresent()) @@ -114,7 +114,7 @@ public class ForgeMain implements LodForgeMethodCaller ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); - ForgeClientProxy.setupNetworkingListeners(event); + NeoforgeClientProxy.setupNetworkingListeners(event); LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); @@ -139,7 +139,7 @@ public class ForgeMain implements LodForgeMethodCaller private void postInitCommon() { LOGGER.info("Post-Initializing Mod"); - ForgeDependencySetup.runDelayedSetup(); + NeoforgeDependencySetup.runDelayedSetup(); LOGGER.info("Mod Post-Initialized"); } diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java similarity index 93% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java index 83f6d644e..bbeb5c009 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/ForgeServerProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java @@ -2,16 +2,13 @@ package com.seibel.distanthorizons.neoforged; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; -import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.api.internal.ServerApi; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.event.level.ChunkEvent; @@ -26,7 +23,7 @@ import org.apache.logging.log4j.Logger; import java.util.function.Supplier; -public class ForgeServerProxy +public class NeoforgeServerProxy { private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -40,7 +37,7 @@ public class ForgeServerProxy // constructor // //=============// - public ForgeServerProxy(boolean isDedicated) + public NeoforgeServerProxy(boolean isDedicated) { this.isDedicated = isDedicated; isGenerationThreadChecker = BatchGenerationEnvironment::isCurrentThreadDistantGeneratorThread; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java rename to neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java index b1e73a77d..264261dc7 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/ForgeDependencySetup.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java @@ -33,7 +33,7 @@ import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.ModChecker; * @author Ran * @version 12-1-2021 */ -public class ForgeDependencySetup +public class NeoforgeDependencySetup { public static void createInitialBindings() { From 526df4f1844091b004aef965c116e934443babd8 Mon Sep 17 00:00:00 2001 From: s809 <11816467-s809@users.noreply.gitlab.com> Date: Sun, 7 Jan 2024 20:25:34 +0500 Subject: [PATCH 046/301] Refactor initializer code --- .../common/AbstractModInitializer.java | 178 ++++++++++++++++++ .../distanthorizons/common/IEventProxy.java | 6 + .../distanthorizons/common/LodCommonMain.java | 64 ------- .../common/forge/LodForgeMethodCaller.java | 52 ----- .../block/TintGetterOverrideFast.java | 19 +- .../block/TintGetterOverrideSmooth.java | 19 +- coreSubProjects | 2 +- .../fabric/FabricClientMain.java | 35 ---- .../fabric/FabricClientProxy.java | 3 +- .../fabric/FabricDedicatedServerMain.java | 56 ------ .../distanthorizons/fabric/FabricMain.java | 141 +++++++------- .../fabric/FabricServerProxy.java | 3 +- fabric/src/main/resources/fabric.mod.json | 4 +- .../forge/ForgeClientProxy.java | 16 +- .../distanthorizons/forge/ForgeMain.java | 170 ++++++----------- .../forge/ForgeServerProxy.java | 13 +- .../neoforged/NeoforgeClientProxy.java | 16 +- .../neoforged/NeoforgeMain.java | 167 ++++++---------- .../neoforged/NeoforgeServerProxy.java | 11 +- 19 files changed, 457 insertions(+), 518 deletions(-) create mode 100644 common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java create mode 100644 common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/LodCommonMain.java delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java delete mode 100644 fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientMain.java delete mode 100644 fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricDedicatedServerMain.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java new file mode 100644 index 000000000..c811a78c4 --- /dev/null +++ b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java @@ -0,0 +1,178 @@ +package com.seibel.distanthorizons.common; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.ArgumentType; +import com.mojang.brigadier.arguments.BoolArgumentType; +import com.mojang.brigadier.arguments.DoubleArgumentType; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.context.CommandContext; +import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; +import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; +import com.seibel.distanthorizons.common.wrappers.DependencySetup; +import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftDedicatedServerWrapper; +import com.seibel.distanthorizons.core.api.internal.SharedApi; +import com.seibel.distanthorizons.core.config.Config; +import com.seibel.distanthorizons.core.config.ConfigBase; +import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler; +import com.seibel.distanthorizons.core.config.types.AbstractConfigType; +import com.seibel.distanthorizons.core.config.types.ConfigEntry; +import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.jar.ModJarInfo; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.util.objects.Pair; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModAccessor; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; +import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; +import com.seibel.distanthorizons.coreapi.ModInfo; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import org.apache.logging.log4j.Logger; + +#if MC_VER >= MC_1_19_2 +import net.minecraft.network.chat.Component; +#else // < 1.19.2 +import net.minecraft.network.chat.TranslatableComponent; +#endif + +import java.lang.invoke.MethodHandles; +import java.util.HashMap; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +import static com.mojang.brigadier.arguments.DoubleArgumentType.doubleArg; +import static com.mojang.brigadier.arguments.IntegerArgumentType.integer; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; + +public abstract class AbstractModInitializer +{ + protected static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); + + protected abstract void createInitialBindings(); + protected abstract IEventProxy createClientProxy(); + protected abstract IEventProxy createServerProxy(boolean isDedicated); + protected abstract void initializeModCompat(); + + protected abstract void subscribeRegisterCommandsEvent(Consumer> eventHandler); + private CommandDispatcher commandDispatcher; + + protected abstract void subscribeClientStartedEvent(Runnable eventHandler); + protected abstract void subscribeServerStartingEvent(Consumer eventHandler); + protected abstract void runDelayedSetup(); + + + + private void startup() + { + DependencySetup.createSharedBindings(); + SharedApi.init(); + this.createInitialBindings(); + } + + private void printModInfo(boolean printGitInfo) + { + LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); + + if (printGitInfo) + { + // Useful for dev builds + LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); + LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); + LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); + } + } + + protected void tryCreateModCompatAccessor(String modId, Class accessorClass, Supplier accessorConstructor) + { + IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class); + if (modChecker.isModLoaded(modId)) + { + //noinspection unchecked + ModAccessorInjector.INSTANCE.bind((Class) accessorClass, accessorConstructor.get()); + } + } + + private void initConfig() + { + ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2); + Config.completeDelayedSetup(); + } + + public void onInitializeClient() + { + DependencySetup.createClientBindings(); + + LOGGER.info("Initializing " + ModInfo.READABLE_NAME); + ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); + + this.startup(); + this.printModInfo(true); + + this.createClientProxy().registerEvents(); + this.createServerProxy(false).registerEvents(); + + this.initializeModCompat(); + + LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); + ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); + + // Client uses config for auto-updater, so it's initialized here instead of post-init stage + this.initConfig(); + + this.subscribeClientStartedEvent(this::postInit); + } + + public void onInitializeServer() + { + DependencySetup.createServerBindings(); + + LOGGER.info("Initializing " + ModInfo.READABLE_NAME); + ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); + + this.startup(); + this.printModInfo(false); + + // This prevents returning uninitialized Config values, + // resulting from a circular reference mid-initialization in a static class + // noinspection ResultOfMethodCallIgnored + ThreadPresetConfigEventHandler.INSTANCE.toString(); + + this.createServerProxy(true).registerEvents(); + + LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); + ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); + + this.subscribeRegisterCommandsEvent(dispatcher -> { + this.commandDispatcher = dispatcher; + }); + + this.subscribeServerStartingEvent(server -> { + MinecraftDedicatedServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer)server; + + this.initConfig(); + this.postInit(); + this.initCommands(); + + LOGGER.info("Dedicated server initialized at " + server.getServerDirectory()); + }); + } + + private void postInit() + { + LOGGER.info("Post-Initializing Mod"); + this.runDelayedSetup(); + LOGGER.info("Mod Post-Initialized"); + } + + private void initCommands() + { + // TODO + } + +} diff --git a/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java b/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java new file mode 100644 index 000000000..0f2e6b896 --- /dev/null +++ b/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java @@ -0,0 +1,6 @@ +package com.seibel.distanthorizons.common; + +public interface IEventProxy +{ + void registerEvents(); +} diff --git a/common/src/main/java/com/seibel/distanthorizons/common/LodCommonMain.java b/common/src/main/java/com/seibel/distanthorizons/common/LodCommonMain.java deleted file mode 100644 index 922e519e4..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/LodCommonMain.java +++ /dev/null @@ -1,64 +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.common; - -import com.seibel.distanthorizons.common.forge.LodForgeMethodCaller; -import com.seibel.distanthorizons.common.wrappers.DependencySetup; -import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.core.api.internal.SharedApi; -import com.seibel.distanthorizons.core.config.Config; -import com.seibel.distanthorizons.core.config.ConfigBase; - -/** - * This is the common main class - * - * @author Ran - */ -public class LodCommonMain -{ - public static boolean forge = false; - public static LodForgeMethodCaller forgeMethodCaller; - - - - public static void startup(LodForgeMethodCaller forgeMethodCaller) - { - if (forgeMethodCaller != null) - { - LodCommonMain.forge = true; - LodCommonMain.forgeMethodCaller = forgeMethodCaller; - } - - DependencySetup.createSharedBindings(); - SharedApi.init(); -// if (!serverSided) { -// new NetworkReceiver().register_Client(); -// } else { -// new NetworkReceiver().register_Server(); -// } - } - - public static void initConfig() - { - ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2); - Config.completeDelayedSetup(); - } - -} diff --git a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java deleted file mode 100644 index afa8fa468..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java +++ /dev/null @@ -1,52 +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.common.forge; - -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.core.Direction; -#if MC_VER >= MC_1_19_2 -import net.minecraft.util.RandomSource; -#endif -import net.minecraft.world.level.ColorResolver; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; - -import java.util.List; -import java.util.Random; - -/** - * used for calling methods that forge modified - * (forge modifies vanilla methods for some reason) - * - * @author Ran - */ -public interface LodForgeMethodCaller -{ - #if MC_VER < MC_1_19_2 - List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19 - #else - List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19 - #endif - - int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z); - -} diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index da3e8d4cf..543747c2c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -19,7 +19,6 @@ package com.seibel.distanthorizons.common.wrappers.block; -import com.seibel.distanthorizons.common.LodCommonMain; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.*; @@ -60,15 +59,15 @@ public class TintGetterOverrideFast implements BlockAndTintGetter @Override public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { - if (LodCommonMain.forgeMethodCaller != null) - { - return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos), - blockPos.getX(), blockPos.getZ()); - } - else - { - return colorResolver.getColor(_getBiome(blockPos), blockPos.getX(), blockPos.getZ()); - } + //if (LodCommonMain.forgeMethodCaller != null) + //{ + // return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos), + // blockPos.getX(), blockPos.getZ()); + //} + //else + //{ + return colorResolver.getColor(this._getBiome(blockPos), blockPos.getX(), blockPos.getZ()); + //} } @Override diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index 240c4e848..4e8ff00c5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -19,7 +19,6 @@ package com.seibel.distanthorizons.common.wrappers.block; -import com.seibel.distanthorizons.common.LodCommonMain; import net.minecraft.core.BlockPos; import net.minecraft.core.Cursor3D; import net.minecraft.core.Direction; @@ -75,15 +74,15 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter { mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ()); int n; - if (LodCommonMain.forgeMethodCaller != null) - { - n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos), - mutableBlockPos.getX(), mutableBlockPos.getZ()); - } - else - { - n = colorResolver.getColor(_getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ()); - } + //if (LodCommonMain.forgeMethodCaller != null) + //{ + // n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos), + // mutableBlockPos.getX(), mutableBlockPos.getZ()); + //} + //else + //{ + n = colorResolver.getColor(this._getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ()); + //} k += (n & 0xFF0000) >> 16; l += (n & 0xFF00) >> 8; diff --git a/coreSubProjects b/coreSubProjects index 1b8ee5cd4..51190efc6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1b8ee5cd48f8abc18bbdfe23fe160d17dc5d6cef +Subproject commit 51190efc66e6993647eb6c2d5d129c661a874308 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientMain.java deleted file mode 100644 index 2990b3ffd..000000000 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientMain.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.seibel.distanthorizons.fabric; - -import com.seibel.distanthorizons.common.LodCommonMain; -import com.seibel.distanthorizons.common.wrappers.DependencySetup; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; - -@Environment(EnvType.CLIENT) -public class FabricClientMain implements ClientModInitializer -{ - public static FabricClientProxy client_proxy; - public static FabricServerProxy server_proxy; - - - // Do if implements ClientModInitializer - // This loads the mod before minecraft loads which causes a lot of issues - @Override - public void onInitializeClient() - { - DependencySetup.createClientBindings(); - FabricMain.init(); - LodCommonMain.initConfig(); - - server_proxy = new FabricServerProxy(false); - server_proxy.registerEvents(); - - client_proxy = new FabricClientProxy(); - client_proxy.registerEvents(); - - ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> FabricMain.postInit()); - } - -} diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 409002829..9a5920656 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -19,6 +19,7 @@ package com.seibel.distanthorizons.fabric; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -72,7 +73,7 @@ import org.lwjgl.opengl.GL15; * @version 2023-7-27 */ @Environment(EnvType.CLIENT) -public class FabricClientProxy +public class FabricClientProxy implements IEventProxy { private final ClientApi clientApi = ClientApi.INSTANCE; private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricDedicatedServerMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricDedicatedServerMain.java deleted file mode 100644 index 88c4bfc59..000000000 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricDedicatedServerMain.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.seibel.distanthorizons.fabric; - -import com.seibel.distanthorizons.common.LodCommonMain; -import com.seibel.distanthorizons.common.wrappers.DependencySetup; -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftDedicatedServerWrapper; -import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler; -import com.seibel.distanthorizons.core.util.LodUtil; -import net.fabricmc.api.DedicatedServerModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.minecraft.server.dedicated.DedicatedServer; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Environment(EnvType.SERVER) -public class FabricDedicatedServerMain implements DedicatedServerModInitializer -{ - private static final Logger LOGGER = LogManager.getLogger(FabricDedicatedServerMain.class.getSimpleName()); - - public static FabricServerProxy server_proxy; - public boolean hasPostSetupDone = false; - - @Override - public void onInitializeServer() - { - DependencySetup.createServerBindings(); - FabricMain.init(); - - // FIXME this prevents returning uninitialized Config values - // resulting from a circular reference mid-initialization in a static class - // ThreadPresetConfigEventHandler <-> Config - ThreadPresetConfigEventHandler.INSTANCE.toString(); - - server_proxy = new FabricServerProxy(true); - server_proxy.registerEvents(); - - ServerLifecycleEvents.SERVER_STARTING.register((server) -> - { - if (this.hasPostSetupDone) - { - return; - } - - this.hasPostSetupDone = true; - LodUtil.assertTrue(server instanceof DedicatedServer); - - MinecraftDedicatedServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer) server; - LodCommonMain.initConfig(); - FabricMain.postInit(); - - LOGGER.info("Dedicated server initialized at " + server.getServerDirectory()); - }); - } - -} diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 97eb41228..b047bbfdd 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -19,25 +19,29 @@ package com.seibel.distanthorizons.fabric; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; -import com.seibel.distanthorizons.core.config.ConfigBase; -import com.seibel.distanthorizons.core.jar.ModJarInfo; -import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*; -import com.seibel.distanthorizons.common.LodCommonMain; -import com.seibel.distanthorizons.coreapi.ModInfo; +import com.mojang.brigadier.CommandDispatcher; +import com.seibel.distanthorizons.common.AbstractModInitializer; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.core.config.Config; -import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; +import com.seibel.distanthorizons.core.config.ConfigBase; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*; +import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.fabric.wrappers.FabricDependencySetup; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.*; - -import org.apache.logging.log4j.Logger; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.api.DedicatedServerModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; import javax.swing.*; +import java.util.function.Consumer; /** * Initialize and setup the Mod.
@@ -48,44 +52,33 @@ import javax.swing.*; * @author Ran * @version 9-2-2022 */ -public class FabricMain +public class FabricMain extends AbstractModInitializer implements ClientModInitializer, DedicatedServerModInitializer { - private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + private static final ResourceLocation INITIAL_PHASE = ResourceLocation.tryParse("distanthorizons:dedicated_server_initial"); - public static void postInit() + + + @Override + protected void createInitialBindings() { - LOGGER.info("Post-Initializing Mod"); - FabricDependencySetup.runDelayedSetup(); - - if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) - ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog - #if MC_VER >= MC_1_20_1 - if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) - ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 - #endif - - if (ConfigBase.INSTANCE == null) - throw new IllegalStateException("Config was not initialized. Make sure to call LodCommonMain.initConfig() before calling this method."); - - LOGGER.info("Mod Post-Initialized"); + FabricDependencySetup.createInitialBindings(); } - - // This loads the mod after minecraft loads which doesn't causes a lot of issues - public static void init() + @Override + protected IEventProxy createClientProxy() + { + return new FabricClientProxy(); + } + + @Override + protected IEventProxy createServerProxy(boolean isDedicated) + { + return new FabricServerProxy(isDedicated); + } + + @Override + protected void initializeModCompat() { - ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); - - LOGGER.info("Initializing Mod"); - LodCommonMain.startup(null); - FabricDependencySetup.createInitialBindings(); - LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); - - // Print git info (Useful for dev builds) - LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); - LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); - LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); - IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class); if (modChecker.isModLoaded("sodium")) { @@ -105,30 +98,52 @@ public class FabricMain mc.crashMinecraft(errorMessage, new Exception(exceptionError)); } } - if (modChecker.isModLoaded("starlight")) - { - ModAccessorInjector.INSTANCE.bind(IStarlightAccessor.class, new StarlightAccessor()); - } - if (modChecker.isModLoaded("optifine")) - { - ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); - } - if (modChecker.isModLoaded("bclib")) - { - ModAccessorInjector.INSTANCE.bind(IBCLibAccessor.class, new BCLibAccessor()); - } + this.tryCreateModCompatAccessor("starlight", IStarlightAccessor.class, StarlightAccessor::new); + this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); + this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new); #if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1 // 1.17.1 won't support this since there isn't a matching Iris version - if (modChecker.isModLoaded("iris")) - { - ModAccessorInjector.INSTANCE.bind(IIrisAccessor.class, new IrisAccessor()); - } + this.tryCreateModCompatAccessor("iris", IIrisAccessor.class, IrisAccessor::new); + #endif + } + + @Override + protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) + { + // fabric-command-api-v1/v2 + //CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess #if MC_VER >= MC_1_19_2 , environment #endif ) -> { + // eventHandler.accept(dispatcher); + //}); + } + + @Override + protected void subscribeClientStartedEvent(Runnable eventHandler) + { + ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> eventHandler.run()); + } + + @Override + protected void subscribeServerStartingEvent(Consumer eventHandler) + { + ServerLifecycleEvents.SERVER_STARTING.addPhaseOrdering(INITIAL_PHASE, Event.DEFAULT_PHASE); + ServerLifecycleEvents.SERVER_STARTING.register(INITIAL_PHASE, eventHandler::accept); + } + + @Override + protected void runDelayedSetup() + { + FabricDependencySetup.runDelayedSetup(); + + if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) + ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog + #if MC_VER >= MC_1_20_1 + if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) + ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 #endif - LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); - - ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); + if (ConfigBase.INSTANCE == null) + throw new IllegalStateException("Config was not initialized. Make sure to call LodCommonMain.initConfig() before calling this method."); } } diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java index 98f780d7b..7754f5bfb 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java @@ -1,5 +1,6 @@ package com.seibel.distanthorizons.fabric; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.misc.ServerPlayerWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -32,7 +33,7 @@ import java.util.function.Supplier; * @author Tomlee * @version 5-11-2022 */ -public class FabricServerProxy +public class FabricServerProxy implements IEventProxy { private static final ServerApi SERVER_API = ServerApi.INSTANCE; private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 2ffe2d3cc..c14865e15 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -24,10 +24,10 @@ "environment": "*", "entrypoints": { "client": [ - "com.seibel.distanthorizons.fabric.FabricClientMain" + "com.seibel.distanthorizons.fabric.FabricMain" ], "server": [ - "com.seibel.distanthorizons.fabric.FabricDedicatedServerMain" + "com.seibel.distanthorizons.fabric.FabricMain" ], "modmenu": [ "com.seibel.distanthorizons.fabric.wrappers.config.ModMenuIntegration" 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 085d2e477..6b225b68f 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -19,6 +19,7 @@ package com.seibel.distanthorizons.forge; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -50,6 +51,7 @@ import net.minecraftforge.client.event.RenderLevelStageEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; //import net.minecraftforge.network.NetworkRegistry; //import net.minecraftforge.network.simple.SimpleChannel; @@ -71,7 +73,7 @@ import org.lwjgl.opengl.GL32; * @author James_Seibel * @version 2023-7-27 */ -public class ForgeClientProxy +public class ForgeClientProxy implements IEventProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); @@ -87,6 +89,15 @@ public class ForgeClientProxy + @Override + public void registerEvents() + { + MinecraftForge.EVENT_BUS.register(this); + this.setupNetworkingListeners(); + } + + + //=============// // tick events // //=============// @@ -237,8 +248,7 @@ public class ForgeClientProxy // networking // //============// - /** @param event this is just to ensure the event is called at the right time, if it is called outside the {@link FMLClientSetupEvent} event, the binding may fail */ - public static void setupNetworkingListeners(FMLClientSetupEvent event) + public void setupNetworkingListeners() { // multiversePluginChannel = NetworkRegistry.newSimpleChannel( // new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index 4195b2dea..bd928126d 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -19,37 +19,30 @@ package com.seibel.distanthorizons.forge; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; -import com.seibel.distanthorizons.common.LodCommonMain; -import com.seibel.distanthorizons.common.forge.LodForgeMethodCaller; -import com.seibel.distanthorizons.common.wrappers.DependencySetup; +import com.mojang.brigadier.CommandDispatcher; +import com.seibel.distanthorizons.common.AbstractModInitializer; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; -import com.seibel.distanthorizons.core.jar.ModJarInfo; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor; -import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; -import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; import com.seibel.distanthorizons.forge.wrappers.ForgeDependencySetup; import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.core.Direction; -#if MC_VER >= MC_1_19_2 -import net.minecraft.util.RandomSource; -#endif -import net.minecraft.world.level.ColorResolver; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.*; +#if MC_VER == MC_1_16_5 +import net.minecraftforge.fml.event.server.FMLServerStartingEvent; +#elif MC_VER == MC_1_17_1 +import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; +#else +import net.minecraftforge.event.server.ServerStartingEvent; +#endif import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; #if MC_VER < MC_1_17_1 import net.minecraftforge.fml.ExtensionPoint; @@ -61,20 +54,15 @@ import net.minecraftforge.client.ConfigGuiHandler; import net.minecraftforge.client.ConfigScreenHandler; #endif -import org.apache.logging.log4j.Logger; - // these imports change due to forge refactoring classes in 1.19 #if MC_VER < MC_1_19_2 import net.minecraftforge.client.model.data.ModelDataMap; import java.util.Random; #else -import net.minecraft.client.renderer.RenderType; -import net.minecraftforge.client.model.data.ModelData; #endif -import java.lang.invoke.MethodHandles; -import java.util.List; +import java.util.function.Consumer; /** * Initialize and setup the Mod.
@@ -87,47 +75,38 @@ import java.util.List; * @version 8-15-2022 */ @Mod(ModInfo.ID) -public class ForgeMain implements LodForgeMethodCaller +public class ForgeMain extends AbstractModInitializer { - private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); - public static ForgeClientProxy client_proxy = null; - public static ForgeServerProxy server_proxy = null; - public ForgeMain() { - DependencySetup.createClientBindings(); - -// initDedicated(null); -// initDedicated(null); // Register the mod initializer (Actual event registration is done in the different proxies) - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initClient); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initDedicated); + FMLJavaModLoadingContext.get().getModEventBus().addListener((FMLClientSetupEvent e) -> this.onInitializeClient()); + FMLJavaModLoadingContext.get().getModEventBus().addListener((FMLDedicatedServerSetupEvent e) -> this.onInitializeServer()); } - private void initClient(final FMLClientSetupEvent event) + @Override + protected void createInitialBindings() { - ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); - - LOGGER.info("Initializing Mod"); - LodCommonMain.startup(this); ForgeDependencySetup.createInitialBindings(); - LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); + } + + @Override + protected IEventProxy createClientProxy() + { + return new ForgeClientProxy(); + } + + @Override + protected IEventProxy createServerProxy(boolean isDedicated) + { + return new ForgeServerProxy(isDedicated); + } + + @Override + protected void initializeModCompat() + { + this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); - // Print git info (Useful for dev builds) - LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); - LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); - LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); - - client_proxy = new ForgeClientProxy(); - MinecraftForge.EVENT_BUS.register(client_proxy); - server_proxy = new ForgeServerProxy(false); - MinecraftForge.EVENT_BUS.register(server_proxy); - - if (AbstractOptifineAccessor.optifinePresent()) - { - ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); - } - #if MC_VER < MC_1_17_1 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> GetConfigScreen.getScreen(parent)); @@ -138,65 +117,36 @@ public class ForgeMain implements LodForgeMethodCaller ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); #endif - - ForgeClientProxy.setupNetworkingListeners(event); - - LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); - - ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); - - // Init config - // The reason im initialising in this rather than the post init process is cus im using this for the auto updater - LodCommonMain.initConfig(); } - private void initDedicated(final FMLDedicatedServerSetupEvent event) - { -// DependencySetup.createServerBindings(); -// initCommon(); - -// server_proxy = new ForgeServerProxy(true); -// MinecraftForge.EVENT_BUS.register(server_proxy); -// - postInitCommon(); - } - - private void postInitCommon() - { - LOGGER.info("Post-Initializing Mod"); - ForgeDependencySetup.runDelayedSetup(); - - LOGGER.info("Mod Post-Initialized"); - } - - #if MC_VER < MC_1_19_2 - private final ModelDataMap modelData = new ModelDataMap.Builder().build(); - #else - private final ModelData modelData = ModelData.EMPTY; - #endif - @Override - #if MC_VER < MC_1_19_2 - public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) + protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData); + MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> + { + eventHandler.accept(e.getDispatcher()); + }); } - #else - public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) - { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_VER >= MC_1_19_2 , RenderType.solid() #endif ); - } - #endif - @Override //TODO: Check this if its still needed - public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) + @Override + protected void subscribeClientStartedEvent(Runnable eventHandler) { - #if MC_1_17_1______Still_needed - return resolver.m_130045_(biome, x, z); - #else - return resolver.getColor(biome, x, z); - #endif - + // FIXME What event is this? + } + + @Override + protected void subscribeServerStartingEvent(Consumer eventHandler) + { + MinecraftForge.EVENT_BUS.addListener((#if MC_VER >= MC_1_18_2 ServerStartingEvent #else FMLServerStartingEvent #endif e) -> + { + eventHandler.accept(e.getServer()); + }); + } + + @Override + protected void runDelayedSetup() + { + ForgeDependencySetup.runDelayedSetup(); } } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java index 7b5c9b29c..0d92d8188 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -1,5 +1,6 @@ package com.seibel.distanthorizons.forge; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -13,6 +14,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; #if MC_VER < MC_1_19_2 import net.minecraftforge.event.world.ChunkEvent; @@ -39,7 +41,7 @@ import org.apache.logging.log4j.Logger; import java.util.function.Supplier; -public class ForgeServerProxy +public class ForgeServerProxy implements IEventProxy { #if MC_VER < MC_1_19_2 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } @@ -53,6 +55,15 @@ public class ForgeServerProxy public static Supplier isGenerationThreadChecker = null; + + @Override + public void registerEvents() + { + MinecraftForge.EVENT_BUS.register(this); + } + + + //=============// // constructor // //=============// diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java index 1390e2337..34aef5d89 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java @@ -19,6 +19,7 @@ package com.seibel.distanthorizons.neoforged; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -37,6 +38,7 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.client.multiplayer.ClientLevel; import net.neoforged.neoforge.client.event.RenderLevelStageEvent; +import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.level.ChunkEvent; import net.neoforged.neoforge.event.level.LevelEvent; @@ -64,7 +66,7 @@ import org.lwjgl.opengl.GL32; * @author James_Seibel * @version 2023-7-27 */ -public class NeoforgeClientProxy +public class NeoforgeClientProxy implements IEventProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); @@ -76,6 +78,15 @@ public class NeoforgeClientProxy + @Override + public void registerEvents() + { + NeoForge.EVENT_BUS.register(this); + setupNetworkingListeners(); + } + + + //=============// // tick events // //=============// @@ -202,8 +213,7 @@ public class NeoforgeClientProxy // networking // //============// - /** @param event this is just to ensure the event is called at the right time, if it is called outside the {@link FMLClientSetupEvent} event, the binding may fail */ - public static void setupNetworkingListeners(FMLClientSetupEvent event) + public static void setupNetworkingListeners() { // multiversePluginChannel = NetworkRegistry.newSimpleChannel( // new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java index 88facc284..fbb0fec8f 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java @@ -19,45 +19,27 @@ package com.seibel.distanthorizons.neoforged; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; -import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; -import com.seibel.distanthorizons.common.LodCommonMain; -import com.seibel.distanthorizons.common.forge.LodForgeMethodCaller; -import com.seibel.distanthorizons.common.wrappers.DependencySetup; +import com.mojang.brigadier.CommandDispatcher; +import com.seibel.distanthorizons.common.AbstractModInitializer; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; -import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper; -import com.seibel.distanthorizons.core.jar.ModJarInfo; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor; -import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; -import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; -import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; +import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.neoforged.wrappers.NeoforgeDependencySetup; - import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.OptifineAccessor; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.core.Direction; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.ColorResolver; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.MinecraftServer; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.lifecycle.*; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent; import net.neoforged.neoforge.client.ConfigScreenHandler; - import net.neoforged.neoforge.common.NeoForge; -import org.apache.logging.log4j.Logger; +import net.neoforged.neoforge.event.RegisterCommandsEvent; +import net.neoforged.neoforge.event.server.ServerStartingEvent; -import net.minecraft.client.renderer.RenderType; -import net.neoforged.neoforge.client.model.data.ModelData; - -import java.lang.invoke.MethodHandles; -import java.util.List; +import java.util.function.Consumer; /** * Initialize and setup the Mod.
@@ -70,92 +52,67 @@ import java.util.List; * @version 8-15-2022 */ @Mod(ModInfo.ID) -public class NeoforgeMain implements LodForgeMethodCaller +public class NeoforgeMain extends AbstractModInitializer { - private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); - public static NeoforgeClientProxy client_proxy = null; - public static NeoforgeServerProxy server_proxy = null; - public NeoforgeMain(IEventBus eventBus) { - DependencySetup.createClientBindings(); - -// initDedicated(null); -// initDedicated(null); - // Register the mod initializer (Actual event registration is done in the different proxies) - eventBus.addListener(this::initClient); - eventBus.addListener(this::initDedicated); + eventBus.addListener((FMLClientSetupEvent e) -> this.onInitializeClient()); + eventBus.addListener((FMLDedicatedServerSetupEvent e) -> this.onInitializeServer()); } - private void initClient(final FMLClientSetupEvent event) - { - ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeDhInitEvent.class, null); - - LOGGER.info("Initializing Mod"); - LodCommonMain.startup(this); - NeoforgeDependencySetup.createInitialBindings(); - LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); - - // Print git info (Useful for dev builds) - LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); - LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); - LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); - - client_proxy = new NeoforgeClientProxy(); - NeoForge.EVENT_BUS.register(client_proxy); - server_proxy = new NeoforgeServerProxy(false); - NeoForge.EVENT_BUS.register(server_proxy); - - if (AbstractOptifineAccessor.optifinePresent()) - { - ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor()); - } - - ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, - () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); - - NeoforgeClientProxy.setupNetworkingListeners(event); - - LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); - - ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); - - // Init config - // The reason im initialising in this rather than the post init process is cus im using this for the auto updater - LodCommonMain.initConfig(); - } - - private void initDedicated(final FMLDedicatedServerSetupEvent event) - { -// DependencySetup.createServerBindings(); -// initCommon(); - -// server_proxy = new ForgeServerProxy(true); -// MinecraftForge.EVENT_BUS.register(server_proxy); -// - postInitCommon(); - } - - private void postInitCommon() - { - LOGGER.info("Post-Initializing Mod"); - NeoforgeDependencySetup.runDelayedSetup(); - - LOGGER.info("Mod Post-Initialized"); - } - - private final ModelData modelData = ModelData.EMPTY; - @Override - public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random) + protected void createInitialBindings() { - return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData, RenderType.solid() ); + NeoforgeDependencySetup.createInitialBindings(); } - @Override //TODO: Check this if its still needed - public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) + @Override + protected IEventProxy createClientProxy() { - return resolver.getColor(biome, x, z); + return new NeoforgeClientProxy(); + } + + @Override + protected IEventProxy createServerProxy(boolean isDedicated) + { + return new NeoforgeServerProxy(isDedicated); + } + + @Override + protected void initializeModCompat() + { + this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); + + ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, + () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); + } + + @Override + protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) + { + NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { + eventHandler.accept(e.getDispatcher()); + }); + } + + @Override + protected void subscribeClientStartedEvent(Runnable eventHandler) + { + // FIXME What event is this? + } + + @Override + protected void subscribeServerStartingEvent(Consumer eventHandler) + { + NeoForge.EVENT_BUS.addListener((ServerStartingEvent e) -> { + eventHandler.accept(e.getServer()); + }); + } + + @Override + protected void runDelayedSetup() + { + NeoforgeDependencySetup.runDelayedSetup(); } } diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java index bbeb5c009..f5e786880 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java +++ b/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java @@ -1,5 +1,6 @@ package com.seibel.distanthorizons.neoforged; +import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; @@ -10,6 +11,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.LevelAccessor; +import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.event.level.ChunkEvent; import net.neoforged.neoforge.event.level.LevelEvent; @@ -23,7 +25,7 @@ import org.apache.logging.log4j.Logger; import java.util.function.Supplier; -public class NeoforgeServerProxy +public class NeoforgeServerProxy implements IEventProxy { private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -43,6 +45,13 @@ public class NeoforgeServerProxy isGenerationThreadChecker = BatchGenerationEnvironment::isCurrentThreadDistantGeneratorThread; } + @Override + public void registerEvents() + { + NeoForge.EVENT_BUS.register(this); + } + + //========// From 0d65578e6a0c742d747cfd3173ef86b243ce6df7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 7 Jan 2024 15:00:53 -0600 Subject: [PATCH 047/301] Fix chunk break/place events not triggering fabric updates post MC 1.17 --- .../distanthorizons/fabric/mixins/server/MixinChunkMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java index 8544ed05e..617a8aaf0 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java @@ -37,7 +37,7 @@ public class MixinChunkMap // MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks) // this logic should prevent that from happening - #if MC_1_16_5 || MC_1_17_1 + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect()) { return; From d2ad35ad059e0284c3702f314c437633e9d64e23 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 7 Jan 2024 16:06:09 -0600 Subject: [PATCH 048/301] Overhaul file handlers --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 1b8ee5cd4..19aedc14c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1b8ee5cd48f8abc18bbdfe23fe160d17dc5d6cef +Subproject commit 19aedc14cda316128669f196c197a71331c05a4a From 841e5ba492d4d8ded9c67f3306e1fa1238223c21 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 9 Jan 2024 19:12:26 +1030 Subject: [PATCH 049/301] Fixed neoforge and updated some dependencies --- build.gradle | 11 ++++++++--- coreSubProjects | 2 +- gradle.properties | 4 ++-- neoforged/build.gradle | 4 +--- versionProperties/1.20.4.properties | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 2f9653378..af6676516 100644 --- a/build.gradle +++ b/build.gradle @@ -152,10 +152,16 @@ subprojects { p -> shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. compileClasspath.extendsFrom common runtimeClasspath.extendsFrom common - developmentForge.extendsFrom common + if (findProject(":forge")) + developmentForge.extendsFrom common + if (findProject(":neoforged")) + developmentNeoForge.extendsFrom common compileClasspath.extendsFrom coreProjects runtimeClasspath.extendsFrom coreProjects - developmentForge.extendsFrom coreProjects + if (findProject(":forge")) + developmentForge.extendsFrom coreProjects + if (findProject(":neoforged")) + developmentNeoForge.extendsFrom coreProjects if (findProject(":fabricLike") && p != project(":fabricLike")) { // Shadow fabricLike @@ -163,7 +169,6 @@ subprojects { p -> shadowFabricLike compileClasspath.extendsFrom fabricLike runtimeClasspath.extendsFrom fabricLike - developmentForge.extendsFrom fabricLike } } } diff --git a/coreSubProjects b/coreSubProjects index 19aedc14c..43366e1f6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 19aedc14cda316128669f196c197a71331c05a4a +Subproject commit 43366e1f6e07f2c13019489162f295d7625f9a13 diff --git a/gradle.properties b/gradle.properties index fbd09c11b..ac5579831 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=2023.1.31 +manifold_version=2024.1.0 nightconfig_version=3.6.6 lz4_version=1.8.0 sqlite_jdbc_version=3.43.0.0 @@ -44,7 +44,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.2 +mcVer=1.20.4 # Defines the maximum amount of memory Minecraft is allowed when run in a developement environment #minecraftMemoryJavaArg="-Xmx4G" diff --git a/neoforged/build.gradle b/neoforged/build.gradle index eb49e83bb..665966cd9 100644 --- a/neoforged/build.gradle +++ b/neoforged/build.gradle @@ -8,7 +8,7 @@ sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 architectury { platformSetupLoomIde() - forge() + neoForge() } repositories { @@ -41,8 +41,6 @@ loom { // ] } mixin { - useLegacyMixinAp = true - // Mixins are now defined in the `mods.toml` // mixinConfigs = [ // "DistantHorizons.mixins.json" diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 479aaa056..637f5c1dc 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -37,8 +37,8 @@ fabric_api_version=0.91.2+1.20.4 enable_canvas=0 # (Neo)Forge loader -forge_version=49.0.3 -neoforged_version=20.4.49-beta +forge_version=49.0.16 +neoforged_version=20.4.83-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From 17f274a7b4e68e7a1be7455c3437ad238f6408a3 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 9 Jan 2024 19:26:00 +1030 Subject: [PATCH 050/301] Renamed many neoforged stuff to neoforge (removed "d" at the end) --- .gitlab-ci.yml | 6 ++-- build.gradle | 12 +++---- forge/src/main/resources/META-INF/mods.toml | 2 +- {neoforged => neoforge}/build.gradle | 10 +++--- {neoforged => neoforge}/gradle.properties | 0 .../neoforge}/NeoforgeClientProxy.java | 2 +- .../neoforge}/NeoforgeMain.java | 6 ++-- .../neoforge}/NeoforgeServerProxy.java | 2 +- .../neoforge/mixins/NeoforgeMixinPlugin.java | 4 +-- .../client/MixinClientPacketListener.java | 3 +- .../client/MixinDebugScreenOverlay.java | 2 +- .../mixins/client/MixinDynamicTexture.java | 4 +-- .../mixins/client/MixinFogRenderer.java | 2 +- .../mixins/client/MixinGameRenderer.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 9 +----- .../mixins/client/MixinLightTexture.java | 2 +- .../mixins/client/MixinMinecraft.java | 3 +- .../mixins/client/MixinOptionsScreen.java | 2 +- .../mixins/client/MixinTextureUtil.java | 2 +- .../mixins/client/MixinWorldUpgrader.java | 32 +------------------ .../mixins/server/MixinChunkGenerator.java | 2 +- .../mixins/server/MixinTFChunkGenerator.java | 2 +- .../server/MixinUtilBackgroundThread.java | 2 +- .../server/unsafe/MixinThreadingDetector.java | 2 +- .../wrappers/NeoforgeDependencySetup.java | 4 +-- .../wrappers/modAccessor/ModChecker.java | 2 +- .../modAccessor/OptifineAccessor.java | 2 +- .../DistantHorizons.neoforge.mixins.json | 4 +-- .../src/main/resources/META-INF/mods.toml | 4 +-- .../src/main/resources/pack.mcmeta | 0 settings.gradle | 2 +- versionProperties/1.20.4.properties | 4 +-- 32 files changed, 48 insertions(+), 89 deletions(-) rename {neoforged => neoforge}/build.gradle (95%) rename {neoforged => neoforge}/gradle.properties (100%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/NeoforgeClientProxy.java (99%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/NeoforgeMain.java (96%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/NeoforgeServerProxy.java (98%) rename neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java => neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java (93%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinClientPacketListener.java (85%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinDebugScreenOverlay.java (91%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinDynamicTexture.java (96%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinFogRenderer.java (98%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinGameRenderer.java (96%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinLevelRenderer.java (95%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinLightTexture.java (96%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinMinecraft.java (97%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinOptionsScreen.java (97%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinTextureUtil.java (94%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/client/MixinWorldUpgrader.java (67%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/server/MixinChunkGenerator.java (97%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/server/MixinTFChunkGenerator.java (97%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/server/MixinUtilBackgroundThread.java (97%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/mixins/server/unsafe/MixinThreadingDetector.java (96%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/wrappers/NeoforgeDependencySetup.java (91%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/wrappers/modAccessor/ModChecker.java (94%) rename {neoforged/src/main/java/com/seibel/distanthorizons/neoforged => neoforge/src/main/java/com/seibel/distanthorizons/neoforge}/wrappers/modAccessor/OptifineAccessor.java (94%) rename neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json => neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json (81%) rename {neoforged => neoforge}/src/main/resources/META-INF/mods.toml (95%) rename {neoforged => neoforge}/src/main/resources/pack.mcmeta (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 86f1e2fb7..ef07d29c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ build: - quilt/build/libs/*.jar - fabric/build/libs/*.jar - forge/build/libs/*.jar - - neoforged/build/libs/*.jar + - neoforge/build/libs/*.jar exclude: # TODO: There is a lot of duplicate stuff here, try to maybe make it smaller - fabric/build/libs/*-all.jar @@ -52,8 +52,8 @@ build: - quilt/build/libs/*-sources.jar - forge/build/libs/*-all.jar - forge/build/libs/*-sources.jar - - neoforged/build/libs/*-all.jar - - neoforged/build/libs/*-sources.jar + - neoforge/build/libs/*-all.jar + - neoforge/build/libs/*-sources.jar expire_in: 14 days when: always extends: .build_java diff --git a/build.gradle b/build.gradle index af6676516..f6a938675 100644 --- a/build.gradle +++ b/build.gradle @@ -76,10 +76,10 @@ forgix { jarLocation = "build/libs/DistantHorizons-forge-${rootProject.versionStr}.jar" } - if (findProject(":neoforged")) + if (findProject(":neoforge")) custom { - projectName = "neoforged" - jarLocation = "build/libs/DistantHorizons-neoforged-${rootProject.versionStr}.jar" + projectName = "neoforge" + jarLocation = "build/libs/DistantHorizons-neoforge-${rootProject.versionStr}.jar" } if (findProject(":fabric")) @@ -113,7 +113,7 @@ subprojects { p -> // Apply forge's loom if ( (findProject(":forge") && p == project(":forge")) || - (findProject(":neoforged") && p == project(":neoforged")) + (findProject(":neoforge") && p == project(":neoforge")) ) apply plugin: "dev.architectury.loom" @@ -154,13 +154,13 @@ subprojects { p -> runtimeClasspath.extendsFrom common if (findProject(":forge")) developmentForge.extendsFrom common - if (findProject(":neoforged")) + if (findProject(":neoforge")) developmentNeoForge.extendsFrom common compileClasspath.extendsFrom coreProjects runtimeClasspath.extendsFrom coreProjects if (findProject(":forge")) developmentForge.extendsFrom coreProjects - if (findProject(":neoforged")) + if (findProject(":neoforge")) developmentNeoForge.extendsFrom coreProjects if (findProject(":fabricLike") && p != project(":fabricLike")) { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 2a984312e..3f199093b 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -27,7 +27,7 @@ issueTrackerURL = "${issues}" [[dependencies.distanthorizons]] modId = "minecraft" mandatory = true # Forge syntax - type = "required" # Neoforged syntax + type = "required" # Neoforge syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "NONE" side = "BOTH" \ No newline at end of file diff --git a/neoforged/build.gradle b/neoforge/build.gradle similarity index 95% rename from neoforged/build.gradle rename to neoforge/build.gradle index 665966cd9..dd98c015a 100644 --- a/neoforged/build.gradle +++ b/neoforge/build.gradle @@ -13,7 +13,7 @@ architectury { repositories { maven { - name "Neoforged" + name "Neoforge" url "https://maven.neoforged.net/releases/" } } @@ -51,14 +51,14 @@ loom { runs { client { client() - setConfigName("Neoforged Client") + setConfigName("NeoForge Client") ideConfigGenerated(true) runDir("../run") // vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) } server { server() - setConfigName("Neoforged Server") + setConfigName("NeoForge Server") ideConfigGenerated(true) runDir("../run") } @@ -92,8 +92,8 @@ dependencies { // it.mappings "dev.architectury:yarn-mappings-patch-forge:${rootProject.mappings_patch}" } - // Neoforged - neoForge "net.neoforged:neoforge:${rootProject.neoforged_version}" + // Neoforge + neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" // Architectury API // if (minecraft_version == "1.16.5") { diff --git a/neoforged/gradle.properties b/neoforge/gradle.properties similarity index 100% rename from neoforged/gradle.properties rename to neoforge/gradle.properties diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java similarity index 99% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index 1390e2337..0ccc54346 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged; +package com.seibel.distanthorizons.neoforge; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java index 88facc284..b149417b3 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeMain.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged; +package com.seibel.distanthorizons.neoforge; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; @@ -33,9 +33,9 @@ import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; -import com.seibel.distanthorizons.neoforged.wrappers.NeoforgeDependencySetup; +import com.seibel.distanthorizons.neoforge.wrappers.NeoforgeDependencySetup; -import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.OptifineAccessor; +import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java index bbeb5c009..7dc755672 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/NeoforgeServerProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged; +package com.seibel.distanthorizons.neoforge; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java similarity index 93% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java index 68566e4f3..4ac78213f 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/NeoforgedMixinPlugin.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins; +package com.seibel.distanthorizons.neoforge.mixins; import net.minecraft.client.ClientBrandRetriever; import net.neoforged.fml.ModList; @@ -13,7 +13,7 @@ import java.util.Set; * @author coolGi * @author cortex */ -public class NeoforgedMixinPlugin implements IMixinConfigPlugin +public class NeoforgeMixinPlugin implements IMixinConfigPlugin { @Override diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinClientPacketListener.java similarity index 85% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinClientPacketListener.java index 07f7b65d1..2439e0233 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinClientPacketListener.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinClientPacketListener.java @@ -1,6 +1,5 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; -import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; import net.minecraft.client.multiplayer.ClientPacketListener; import org.spongepowered.asm.mixin.Mixin; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDebugScreenOverlay.java similarity index 91% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDebugScreenOverlay.java index b9f0d1ce6..2b8cddded 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDebugScreenOverlay.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDebugScreenOverlay.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.core.logging.f3.F3Screen; import net.minecraft.client.gui.components.DebugScreenOverlay; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java index f58783e6b..7151fe912 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinDynamicTexture.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinDynamicTexture.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.mojang.blaze3d.platform.NativeImage; @@ -38,8 +38,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import javax.annotation.Nullable; - @Mixin(DynamicTexture.class) public abstract class MixinDynamicTexture implements ILightTextureMarker { diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinFogRenderer.java similarity index 98% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinFogRenderer.java index 480fad3e8..0468a72da 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinFogRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinFogRenderer.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinGameRenderer.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinGameRenderer.java index 56b2e4698..071983ab9 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinGameRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinGameRenderer.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck; import com.seibel.distanthorizons.core.api.internal.ClientApi; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java similarity index 95% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index 0054ab483..6c54ed6db 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.mojang.blaze3d.vertex.PoseStack; #if MC_VER < MC_1_19_4 @@ -35,23 +35,16 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.coreapi.util.math.Mat4f; -import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.level.lighting.LevelLightEngine; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.nio.FloatBuffer; - #if MC_VER < MC_1_17_1 import org.lwjgl.opengl.GL15; #endif diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java index 6cea85ebd..0d59818d2 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinLightTexture.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLightTexture.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.common.util.ILightTextureMarker; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java index 4b5b174c8..9ad50c0dd 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinMinecraft.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; @@ -9,7 +9,6 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java index 1049d0559..657b521f0 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinOptionsScreen.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinTextureUtil.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinTextureUtil.java index 2502b116c..57b40bc72 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinTextureUtil.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinTextureUtil.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.mixins.client; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.TextureUtil; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java similarity index 67% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java index 5b46ae32e..dfba682ae 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/client/MixinWorldUpgrader.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinWorldUpgrader.java @@ -1,36 +1,6 @@ -package com.seibel.distanthorizons.neoforged.mixins.client; +package com.seibel.distanthorizons.neoforge.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) diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinChunkGenerator.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinChunkGenerator.java index 1b492c5d3..5d70347c3 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinChunkGenerator.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinChunkGenerator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.server; +package com.seibel.distanthorizons.neoforge.mixins.server; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.world.level.chunk.ChunkGenerator; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinTFChunkGenerator.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinTFChunkGenerator.java index d1cdc6a5d..42f0ec9f2 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinTFChunkGenerator.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinTFChunkGenerator.java @@ -1,4 +1,4 @@ -package com.seibel.distanthorizons.neoforged.mixins.server; +package com.seibel.distanthorizons.neoforge.mixins.server; import net.minecraft.world.level.chunk.ChunkGenerator; import org.spongepowered.asm.mixin.Mixin; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinUtilBackgroundThread.java similarity index 97% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinUtilBackgroundThread.java index fdb9742d8..cbe606d49 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/MixinUtilBackgroundThread.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/MixinUtilBackgroundThread.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.server; +package com.seibel.distanthorizons.neoforge.mixins.server; import java.util.concurrent.ExecutorService; import java.util.function.Supplier; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java similarity index 96% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java index 1d62f4785..d65854393 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/mixins/server/unsafe/MixinThreadingDetector.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/server/unsafe/MixinThreadingDetector.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.mixins.server.unsafe; +package com.seibel.distanthorizons.neoforge.mixins.server.unsafe; import org.spongepowered.asm.mixin.Mixin; #if MC_VER >= MC_1_18_2 diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java similarity index 91% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java index 264261dc7..0679bc769 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/NeoforgeDependencySetup.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.wrappers; +package com.seibel.distanthorizons.neoforge.wrappers; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; -import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.ModChecker; +import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker; /** * Binds all necessary dependencies so we diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java index 8dfff8710..775869e49 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/ModChecker.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.wrappers.modAccessor; +package com.seibel.distanthorizons.neoforge.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import net.neoforged.fml.ModList; diff --git a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/OptifineAccessor.java similarity index 94% rename from neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java rename to neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/OptifineAccessor.java index 6e157485d..ceb05847c 100644 --- a/neoforged/src/main/java/com/seibel/distanthorizons/neoforged/wrappers/modAccessor/OptifineAccessor.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/OptifineAccessor.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged.wrappers.modAccessor; +package com.seibel.distanthorizons.neoforge.wrappers.modAccessor; import java.util.HashSet; diff --git a/neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json similarity index 81% rename from neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json rename to neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json index c8d168b6c..cb6ae0a35 100644 --- a/neoforged/src/main/resources/DistantHorizons.neoforged.mixins.json +++ b/neoforge/src/main/resources/DistantHorizons.neoforge.mixins.json @@ -1,7 +1,7 @@ { "required": true, "minVersion": "0.8", - "package": "com.seibel.distanthorizons.neoforged.mixins", + "package": "com.seibel.distanthorizons.neoforge.mixins", "mixins": [ "server.unsafe.MixinThreadingDetector", "server.MixinUtilBackgroundThread", @@ -20,5 +20,5 @@ "client.MixinTextureUtil" ], "server": [], - "plugin": "com.seibel.distanthorizons.neoforged.mixins.NeoforgedMixinPlugin" + "plugin": "com.seibel.distanthorizons.neoforge.mixins.NeoforgeMixinPlugin" } diff --git a/neoforged/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml similarity index 95% rename from neoforged/src/main/resources/META-INF/mods.toml rename to neoforge/src/main/resources/META-INF/mods.toml index 2904583d0..e8abb9812 100644 --- a/neoforged/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -26,12 +26,12 @@ issueTrackerURL = "${issues}" # TODO: Once there is a way to move this to the `META-INF/MANIFEST.MF` with architectury, DO SO! # (currently, this only works cus neoforge's mods.toml is added to the jar after forge's mods.toml, so this can work [[mixins]] - config = "DistantHorizons.neoforged.mixins.json" + config = "DistantHorizons.neoforge.mixins.json" [[dependencies.distanthorizons]] modId = "minecraft" mandatory = true # Forge syntax - type = "required" # Neoforged syntax + type = "required" # Neoforge syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "NONE" side = "BOTH" \ No newline at end of file diff --git a/neoforged/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta similarity index 100% rename from neoforged/src/main/resources/pack.mcmeta rename to neoforge/src/main/resources/pack.mcmeta diff --git a/settings.gradle b/settings.gradle index 69a4656fc..5e8900e42 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,7 +10,7 @@ pluginManagement { url "https://maven.minecraftforge.net/" } maven { - name "Neoforged" + name "NeoForge" url "https://maven.neoforged.net/releases/" } maven { diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 637f5c1dc..1f588d1db 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,forge,neoforged +builds_for=fabric,forge,neoforge # Fabric loader fabric_loader_version=0.15.1 @@ -38,7 +38,7 @@ fabric_api_version=0.91.2+1.20.4 # (Neo)Forge loader forge_version=49.0.16 -neoforged_version=20.4.83-beta +neoforge_version=20.4.83-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From dab5373231ec28befa1cefa675363e34c313cb6d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 11 Jan 2024 22:13:11 -0600 Subject: [PATCH 051/301] Fix Bclib sometimes refusing to download in 1.20.1 --- versionProperties/1.20.1.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index 5eb7c4c78..ba4d8188b 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -16,7 +16,7 @@ fabric_api_version=0.90.4+1.20.1 lithium_version= sodium_version=mc1.20.1-0.5.3 iris_version=1.6.10+1.20.1 - bclib_version=3.0.12 + bclib_version=3.0.13 immersive_portals_version= canvas_version= From 51b543a23ef6422dce54c4683ba954dc07235bea Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 12 Jan 2024 07:50:49 -0600 Subject: [PATCH 052/301] Fix Optifine not running in dev environment For some reason loading the net.minecraft.client.ClientBrandRetriever class causes mixin issues --- .../forge/mixins/ForgeMixinPlugin.java | 37 +++++++------------ .../neoforge/mixins/NeoforgeMixinPlugin.java | 37 +++++++------------ 2 files changed, 28 insertions(+), 46 deletions(-) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java index 9d2d7aa3c..d37c8b087 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java @@ -1,6 +1,5 @@ package com.seibel.distanthorizons.forge.mixins; -import net.minecraft.client.ClientBrandRetriever; import net.minecraftforge.fml.ModList; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; @@ -15,12 +14,16 @@ import java.util.Set; */ public class ForgeMixinPlugin implements IMixinConfigPlugin { + private boolean isForgeMixinFile = false; + @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - if (!ClientBrandRetriever.getClientModName().equals("forge")) + if (!this.isForgeMixinFile) + { return false; + } if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not @@ -32,6 +35,7 @@ public class ForgeMixinPlugin implements IMixinConfigPlugin .replaceAll("\\..*$", "") // Replaces everything after the mod name ); } + return true; } @@ -39,37 +43,24 @@ public class ForgeMixinPlugin implements IMixinConfigPlugin @Override public void onLoad(String mixinPackage) { - + // prevents running neoforge mixins + // com.seibel.distanthorizons.forge.mixins + this.isForgeMixinFile = mixinPackage.contains(".forge."); } @Override - public String getRefMapperConfig() - { - return null; - } + public String getRefMapperConfig() { return null; } @Override - public void acceptTargets(Set myTargets, Set otherTargets) - { - - } + public void acceptTargets(Set myTargets, Set otherTargets) { } @Override - public List getMixins() - { - return null; - } + public List getMixins() { return null; } @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) - { - - } + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) - { - - } + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } } \ No newline at end of file diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java index 4ac78213f..d977e7765 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java @@ -1,6 +1,5 @@ package com.seibel.distanthorizons.neoforge.mixins; -import net.minecraft.client.ClientBrandRetriever; import net.neoforged.fml.ModList; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; @@ -15,12 +14,16 @@ import java.util.Set; */ public class NeoforgeMixinPlugin implements IMixinConfigPlugin { + private boolean isNeoforgeMixinFile = false; + @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - if (!ClientBrandRetriever.getClientModName().equals("neoforge")) + if (!this.isNeoforgeMixinFile) + { return false; + } if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not @@ -32,6 +35,7 @@ public class NeoforgeMixinPlugin implements IMixinConfigPlugin .replaceAll("\\..*$", "") // Replaces everything after the mod name ); } + return true; } @@ -39,37 +43,24 @@ public class NeoforgeMixinPlugin implements IMixinConfigPlugin @Override public void onLoad(String mixinPackage) { - + // prevents running forge mixins + // example string: com.seibel.distanthorizons.neoforge.mixins + this.isNeoforgeMixinFile = mixinPackage.contains("neo"); } @Override - public String getRefMapperConfig() - { - return null; - } + public String getRefMapperConfig() { return null; } @Override - public void acceptTargets(Set myTargets, Set otherTargets) - { - - } + public void acceptTargets(Set myTargets, Set otherTargets) { } @Override - public List getMixins() - { - return null; - } + public List getMixins() { return null; } @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) - { - - } + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) - { - - } + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } } \ No newline at end of file From 93c2bf530f32082b8866fde4c7742da1828180e7 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 13 Jan 2024 16:19:10 +1030 Subject: [PATCH 053/301] Fixed neoforge crash with merged jar --- .../forge/mixins/ForgeMixinPlugin.java | 22 ++++++++++--------- .../neoforge/mixins/NeoforgeMixinPlugin.java | 22 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java index d37c8b087..78481bf26 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/ForgeMixinPlugin.java @@ -14,16 +14,23 @@ import java.util.Set; */ public class ForgeMixinPlugin implements IMixinConfigPlugin { - private boolean isForgeMixinFile = false; + private boolean firstRun = false; + private boolean isForgeMixinFile; @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - if (!this.isForgeMixinFile) - { - return false; + if (!this.firstRun) { + try { + Class cls = Class.forName("net.neoforged.fml.common.Mod"); // Check if a NeoForge exclusive class exists + this.isForgeMixinFile = false; + } catch (ClassNotFoundException e) { + this.isForgeMixinFile = true; + } } + if (!this.isForgeMixinFile) + return false; if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not @@ -41,12 +48,7 @@ public class ForgeMixinPlugin implements IMixinConfigPlugin @Override - public void onLoad(String mixinPackage) - { - // prevents running neoforge mixins - // com.seibel.distanthorizons.forge.mixins - this.isForgeMixinFile = mixinPackage.contains(".forge."); - } + public void onLoad(String mixinPackage) { } @Override public String getRefMapperConfig() { return null; } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java index d977e7765..ba48ebaea 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/NeoforgeMixinPlugin.java @@ -14,16 +14,23 @@ import java.util.Set; */ public class NeoforgeMixinPlugin implements IMixinConfigPlugin { - private boolean isNeoforgeMixinFile = false; + private boolean firstRun = false; + private boolean isNeoforgeMixinFile; @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - if (!this.isNeoforgeMixinFile) - { - return false; + if (!this.firstRun) { + try { + Class cls = Class.forName("net.neoforged.fml.common.Mod"); // Check if a NeoForge exclusive class exists + this.isNeoforgeMixinFile = true; + } catch (ClassNotFoundException e) { + this.isNeoforgeMixinFile = false; + } } + if (!this.isNeoforgeMixinFile) + return false; if (mixinClassName.contains(".mods.")) { // If the mixin wants to go into a mod then we check if that mod is loaded or not @@ -41,12 +48,7 @@ public class NeoforgeMixinPlugin implements IMixinConfigPlugin @Override - public void onLoad(String mixinPackage) - { - // prevents running forge mixins - // example string: com.seibel.distanthorizons.neoforge.mixins - this.isNeoforgeMixinFile = mixinPackage.contains("neo"); - } + public void onLoad(String mixinPackage) { } @Override public String getRefMapperConfig() { return null; } From fc62c781360085d6d8c3a0dd11a2e60132447a02 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 13 Jan 2024 16:19:54 +1030 Subject: [PATCH 054/301] Updated core sub-module --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 43366e1f6..754954326 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 43366e1f6e07f2c13019489162f295d7625f9a13 +Subproject commit 7549543268149eb5f93d44bf1b4651e10734247f From 46bf8d018890a4eda1745caf53aab11afdf78335 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Jan 2024 23:12:19 -0600 Subject: [PATCH 055/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 754954326..d878e464f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7549543268149eb5f93d44bf1b4651e10734247f +Subproject commit d878e464f660fed791af60db56a5b1ab182868f2 From af04c6d99513fbf8716c8c40fdf6c9b9beb23b18 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Jan 2024 13:27:14 -0600 Subject: [PATCH 056/301] Fix light engine out of bounds for MC 1.16 and 1.17 --- .../distanthorizons/common/wrappers/chunk/ChunkWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c0b0235ab..55471663a 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 @@ -243,7 +243,7 @@ public class ChunkWrapper implements IChunkWrapper { // convert from an index to a block coordinate #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 - return this.chunk.getSections()[index].bottomBlockY() * 16; + return this.chunk.getSections()[index].bottomBlockY(); #else return this.chunk.getSectionYFromSectionIndex(index) * 16; #endif From f866243d5cd32fdca2eac18b517bfec71c510001 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Jan 2024 15:07:35 -0600 Subject: [PATCH 057/301] Attempt to fix File handler repo closed issues --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index d878e464f..45c47533c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit d878e464f660fed791af60db56a5b1ab182868f2 +Subproject commit 45c47533c27c41476f721abb989fae17e8268446 From 1e19dfd6e82e9bafb0c6072b29d55b0e2eddceac Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Jan 2024 15:08:29 -0600 Subject: [PATCH 058/301] minor lightMapWrapper reformat --- .../common/wrappers/misc/LightMapWrapper.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java index 39d1f3e4a..b6ed1265c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java @@ -25,35 +25,39 @@ import org.lwjgl.opengl.GL32; import java.nio.ByteBuffer; -/** - * @author James Seibel - * @version 11-21-2021 - */ public class LightMapWrapper implements ILightMapWrapper { private int textureId = 0; - public LightMapWrapper() - { - } + + //==============// + // constructors // + //==============// + + public LightMapWrapper() { } private void createLightmap(NativeImage image) { - textureId = GL32.glGenTextures(); - GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId); + this.textureId = GL32.glGenTextures(); + GL32.glBindTexture(GL32.GL_TEXTURE_2D, this.textureId); GL32.glTexImage2D(GL32.GL_TEXTURE_2D, 0, image.format().glFormat(), image.getWidth(), image.getHeight(), 0, image.format().glFormat(), GL32.GL_UNSIGNED_BYTE, (ByteBuffer) null); } + + + //=========// + // methods // + //=========// + public void uploadLightmap(NativeImage image) { int currentBind = GL32.glGetInteger(GL32.GL_TEXTURE_BINDING_2D); - GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId); - if (textureId == 0) + GL32.glBindTexture(GL32.GL_TEXTURE_2D, this.textureId); + if (this.textureId == 0) { - createLightmap(image); + this.createLightmap(image); } - // NativeImage::upload(int levelOfDetail, int xOffset, int yOffset, bool shouldCleanup?) image.upload(0, 0, 0, false); GL32.glBindTexture(GL32.GL_TEXTURE_2D, currentBind); } @@ -66,9 +70,6 @@ public class LightMapWrapper implements ILightMapWrapper } @Override - public void unbind() - { - GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0); - } + public void unbind() { GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0); } } From 6130c65c4889b91c39af971adb9968d2ebdc18f3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Jan 2024 15:53:21 -0600 Subject: [PATCH 059/301] Add messages to chunk loading about world optimization --- .../BatchGenerationEnvironment.java | 10 +++++-- .../mimicObject/ChunkLoader.java | 26 +++++++++++++++++-- coreSubProjects | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) 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 59cc24b62..bed2582a3 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 @@ -405,12 +405,18 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv { try { - LOAD_LOGGER.info("DistantHorizons: Loading chunk " + chunkPos + " from disk."); + LOAD_LOGGER.info("DistantHorizons: Loading chunk [" + chunkPos + "] from disk."); return ChunkLoader.read(level, chunkPos, chunkData); } catch (Exception e) { - LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Returning an empty chunk. Error: " + e.getMessage(), e); + LOAD_LOGGER.error( + "DistantHorizons: couldn't load or make chunk at ["+chunkPos+"]." + + "Please try optimizing your world to fix this issue. \n" + + "World optimization can be done from the singleplayer world selection screen.\n" + + "Error: ["+e.getMessage()+"]." + , e); + return EmptyChunk(level, chunkPos); } } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 7edb2d77e..97828775d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -81,6 +81,8 @@ import net.minecraft.world.level.material.Fluid; public class ChunkLoader { + private static boolean zeroChunkPosErrorLogged = false; + #if MC_VER >= MC_1_19_2 private static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); #elif MC_VER >= MC_1_18_2 @@ -232,8 +234,28 @@ public class ChunkLoader ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos")); if (!Objects.equals(chunkPos, actualPos)) { - LOGGER.error("Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", chunkPos, chunkPos, actualPos); - return null; + if (actualPos.equals(ChunkPos.ZERO)) + { + if (!zeroChunkPosErrorLogged) + { + zeroChunkPosErrorLogged = true; + + // explicit chunkPos toString is necessary otherwise the JDK 17 compiler breaks + LOGGER.warn("Chunk file at ["+chunkPos.toString()+"] doesn't have a chunk pos. \n" + + "This might happen if the world was created using an external program. \n" + + "DH will attempt to parse the chunk anyway and won't log this message again.\n" + + "If issues arise please try optimizing your world to fix this issue. \n" + + "World optimization can be done from the singleplayer world selection screen."+ + ""); + } + } + else + { + // everything is on one line to fix a JDK 17 compiler issue + // if the issue is ever resolved, feel free to make this multi-line for readability + LOGGER.error("Chunk file at ["+chunkPos.toString()+"] is in the wrong location. \nPlease try optimizing your world to fix this issue. \nWorld optimization can be done from the singleplayer world selection screen. \n(Expected pos: ["+chunkPos.toString()+"], actual ["+actualPos.toString()+"])"); + return null; + } } ChunkStatus.ChunkType chunkType = readChunkType(tagLevel); diff --git a/coreSubProjects b/coreSubProjects index 45c47533c..163c0bf1f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 45c47533c27c41476f721abb989fae17e8268446 +Subproject commit 163c0bf1fac5eb3f17406a6bcc0ed8ba5d5b041f From 1fbc37f8e7a55eed588f6e8afd2a16ddab1b7d92 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Jan 2024 16:55:55 -0600 Subject: [PATCH 060/301] Initializer code reduction and reformatting --- .../common/AbstractModInitializer.java | 135 ++++++++-------- .../distanthorizons/common/IEventProxy.java | 6 - .../block/TintGetterOverrideFast.java | 13 +- .../block/TintGetterOverrideSmooth.java | 148 ++++-------------- .../fabric/FabricClientProxy.java | 12 +- .../distanthorizons/fabric/FabricMain.java | 37 +---- .../fabric/FabricServerProxy.java | 5 +- .../wrappers/FabricDependencySetup.java | 48 ------ .../forge/ForgeClientProxy.java | 5 +- .../distanthorizons/forge/ForgeMain.java | 35 +---- .../forge/ForgeServerProxy.java | 7 +- .../forge/wrappers/ForgeDependencySetup.java | 48 ------ .../neoforge/NeoforgeClientProxy.java | 5 +- .../neoforge/NeoforgeMain.java | 42 ++--- .../neoforge/NeoforgeServerProxy.java | 4 +- .../wrappers/NeoforgeDependencySetup.java | 48 ------ 16 files changed, 139 insertions(+), 459 deletions(-) delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java delete mode 100644 fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/FabricDependencySetup.java delete mode 100644 forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java delete mode 100644 neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java index c811a78c4..1c9def3a3 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java @@ -1,13 +1,6 @@ package com.seibel.distanthorizons.common; -import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.ArgumentType; -import com.mojang.brigadier.arguments.BoolArgumentType; -import com.mojang.brigadier.arguments.DoubleArgumentType; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent; import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent; import com.seibel.distanthorizons.common.wrappers.DependencySetup; @@ -16,13 +9,10 @@ import com.seibel.distanthorizons.core.api.internal.SharedApi; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.config.ConfigBase; import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler; -import com.seibel.distanthorizons.core.config.types.AbstractConfigType; -import com.seibel.distanthorizons.core.config.types.ConfigEntry; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.jar.ModJarInfo; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; -import com.seibel.distanthorizons.core.util.objects.Pair; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; @@ -32,35 +22,32 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.dedicated.DedicatedServer; import org.apache.logging.log4j.Logger; -#if MC_VER >= MC_1_19_2 -import net.minecraft.network.chat.Component; -#else // < 1.19.2 -import net.minecraft.network.chat.TranslatableComponent; -#endif - import java.lang.invoke.MethodHandles; -import java.util.HashMap; -import java.util.function.BiFunction; import java.util.function.Consumer; -import java.util.function.Function; import java.util.function.Supplier; -import static com.mojang.brigadier.arguments.DoubleArgumentType.doubleArg; -import static com.mojang.brigadier.arguments.IntegerArgumentType.integer; -import static net.minecraft.commands.Commands.argument; -import static net.minecraft.commands.Commands.literal; - +/** + * Base for all mod loader initializers + * and handles most setup. + */ public abstract class AbstractModInitializer { protected static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); + private CommandDispatcher commandDispatcher; + + + + //==================// + // abstract methods // + //==================// + protected abstract void createInitialBindings(); protected abstract IEventProxy createClientProxy(); protected abstract IEventProxy createServerProxy(boolean isDedicated); protected abstract void initializeModCompat(); protected abstract void subscribeRegisterCommandsEvent(Consumer> eventHandler); - private CommandDispatcher commandDispatcher; protected abstract void subscribeClientStartedEvent(Runnable eventHandler); protected abstract void subscribeServerStartingEvent(Consumer eventHandler); @@ -68,41 +55,9 @@ public abstract class AbstractModInitializer - private void startup() - { - DependencySetup.createSharedBindings(); - SharedApi.init(); - this.createInitialBindings(); - } - - private void printModInfo(boolean printGitInfo) - { - LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); - - if (printGitInfo) - { - // Useful for dev builds - LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); - LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); - LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); - } - } - - protected void tryCreateModCompatAccessor(String modId, Class accessorClass, Supplier accessorConstructor) - { - IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class); - if (modChecker.isModLoaded(modId)) - { - //noinspection unchecked - ModAccessorInjector.INSTANCE.bind((Class) accessorClass, accessorConstructor.get()); - } - } - - private void initConfig() - { - ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2); - Config.completeDelayedSetup(); - } + //===================// + // initialize events // + //===================// public void onInitializeClient() { @@ -148,11 +103,10 @@ public abstract class AbstractModInitializer LOGGER.info(ModInfo.READABLE_NAME + " Initialized"); ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null); - this.subscribeRegisterCommandsEvent(dispatcher -> { - this.commandDispatcher = dispatcher; - }); + this.subscribeRegisterCommandsEvent(dispatcher -> { this.commandDispatcher = dispatcher; }); - this.subscribeServerStartingEvent(server -> { + this.subscribeServerStartingEvent(server -> + { MinecraftDedicatedServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer)server; this.initConfig(); @@ -163,6 +117,48 @@ public abstract class AbstractModInitializer }); } + + + //===========================// + // inner initializer methods // + //===========================// + + private void startup() + { + DependencySetup.createSharedBindings(); + SharedApi.init(); + this.createInitialBindings(); + } + + private void printModInfo(boolean printGitInfo) + { + LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); + + if (printGitInfo) + { + // Useful for dev builds + LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch); + LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit); + LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source); + } + } + + protected void tryCreateModCompatAccessor(String modId, Class accessorClass, Supplier accessorConstructor) + { + IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class); + if (modChecker.isModLoaded(modId)) + { + //noinspection unchecked + ModAccessorInjector.INSTANCE.bind((Class) accessorClass, accessorConstructor.get()); + } + } + + private void initConfig() + { + ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2); + Config.completeDelayedSetup(); + } + private void postInit() { LOGGER.info("Post-Initializing Mod"); @@ -175,4 +171,15 @@ public abstract class AbstractModInitializer // TODO } + + + //================// + // helper classes // + //================// + + public interface IEventProxy + { + void registerEvents(); + } + } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java b/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java deleted file mode 100644 index 0f2e6b896..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/IEventProxy.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.seibel.distanthorizons.common; - -public interface IEventProxy -{ - void registerEvents(); -} diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index 543747c2c..f71095818 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -57,18 +57,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter } @Override - public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) - { - //if (LodCommonMain.forgeMethodCaller != null) - //{ - // return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos), - // blockPos.getX(), blockPos.getZ()); - //} - //else - //{ - return colorResolver.getColor(this._getBiome(blockPos), blockPos.getX(), blockPos.getZ()); - //} - } + public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { return colorResolver.getColor(this._getBiome(blockPos), blockPos.getX(), blockPos.getZ()); } @Override public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index 4e8ff00c5..a840f3868 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -73,16 +73,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter while (cursor3D.advance()) { mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ()); - int n; - //if (LodCommonMain.forgeMethodCaller != null) - //{ - // n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos), - // mutableBlockPos.getX(), mutableBlockPos.getZ()); - //} - //else - //{ - n = colorResolver.getColor(this._getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ()); - //} + int n = colorResolver.getColor(this._getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ()); k += (n & 0xFF0000) >> 16; l += (n & 0xFF00) >> 8; @@ -92,177 +83,96 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter } @Override - public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) - { - return calculateBlockTint(blockPos, colorResolver); - } + public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { return this.calculateBlockTint(blockPos, colorResolver); } @Override public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); } @Override - public LevelLightEngine getLightEngine() - { - return parent.getLightEngine(); - } + public LevelLightEngine getLightEngine() { return this.parent.getLightEngine(); } @Override - public int getBrightness(LightLayer lightLayer, BlockPos blockPos) - { - return parent.getBrightness(lightLayer, blockPos); - } + public int getBrightness(LightLayer lightLayer, BlockPos blockPos) { return this.parent.getBrightness(lightLayer, blockPos); } @Override - public int getRawBrightness(BlockPos blockPos, int i) - { - return parent.getRawBrightness(blockPos, i); - } + public int getRawBrightness(BlockPos blockPos, int i) { return this.parent.getRawBrightness(blockPos, i); } @Override - public boolean canSeeSky(BlockPos blockPos) - { - return parent.canSeeSky(blockPos); - } + public boolean canSeeSky(BlockPos blockPos) { return this.parent.canSeeSky(blockPos); } @Override @Nullable - public BlockEntity getBlockEntity(BlockPos blockPos) - { - return parent.getBlockEntity(blockPos); - } + public BlockEntity getBlockEntity(BlockPos blockPos) { return this.parent.getBlockEntity(blockPos); } @Override - public BlockState getBlockState(BlockPos blockPos) - { - return parent.getBlockState(blockPos); - } + public BlockState getBlockState(BlockPos blockPos) { return this.parent.getBlockState(blockPos); } @Override - public FluidState getFluidState(BlockPos blockPos) - { - return parent.getFluidState(blockPos); - } + public FluidState getFluidState(BlockPos blockPos) { return this.parent.getFluidState(blockPos); } @Override - public int getLightEmission(BlockPos blockPos) - { - return parent.getLightEmission(blockPos); - } + public int getLightEmission(BlockPos blockPos) { return this.parent.getLightEmission(blockPos); } @Override - public int getMaxLightLevel() - { - return parent.getMaxLightLevel(); - } + public int getMaxLightLevel() { return this.parent.getMaxLightLevel(); } @Override - public Stream getBlockStates(AABB aABB) - { - return parent.getBlockStates(aABB); - } + public Stream getBlockStates(AABB aABB) { return this.parent.getBlockStates(aABB); } @Override - public BlockHitResult clip(ClipContext clipContext) - { - return parent.clip(clipContext); - } + public BlockHitResult clip(ClipContext clipContext) { return this.parent.clip(clipContext); } @Override @Nullable public BlockHitResult clipWithInteractionOverride(Vec3 vec3, Vec3 vec32, BlockPos blockPos, VoxelShape voxelShape, BlockState blockState) { - return parent.clipWithInteractionOverride(vec3, vec32, blockPos, voxelShape, blockState); + return this.parent.clipWithInteractionOverride(vec3, vec32, blockPos, voxelShape, blockState); } @Override - public double getBlockFloorHeight(VoxelShape voxelShape, Supplier supplier) - { - return parent.getBlockFloorHeight(voxelShape, supplier); - } + public double getBlockFloorHeight(VoxelShape voxelShape, Supplier supplier) { return this.parent.getBlockFloorHeight(voxelShape, supplier); } @Override - public double getBlockFloorHeight(BlockPos blockPos) - { - return parent.getBlockFloorHeight(blockPos); - } + public double getBlockFloorHeight(BlockPos blockPos) { return this.parent.getBlockFloorHeight(blockPos); } @Override - public int getMaxBuildHeight() - { - return parent.getMaxBuildHeight(); - } + public int getMaxBuildHeight() { return this.parent.getMaxBuildHeight(); } #if MC_VER >= MC_1_17_1 @Override - public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) - { - return parent.getBlockEntity(blockPos, blockEntityType); - } + public Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { return this.parent.getBlockEntity(blockPos, blockEntityType); } @Override - public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) - { - return parent.isBlockInLine(clipBlockStateContext); - } + public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) { return this.parent.isBlockInLine(clipBlockStateContext); } @Override - public int getHeight() - { - return parent.getHeight(); - } + public int getHeight() { return this.parent.getHeight(); } @Override - public int getMinBuildHeight() - { - return parent.getMinBuildHeight(); - } + public int getMinBuildHeight() { return this.parent.getMinBuildHeight(); } @Override - public int getSectionsCount() - { - return parent.getSectionsCount(); - } + public int getSectionsCount() { return this.parent.getSectionsCount(); } @Override - public int getMinSection() - { - return parent.getMinSection(); - } + public int getMinSection() { return this.parent.getMinSection(); } @Override - public int getMaxSection() - { - return parent.getMaxSection(); - } + public int getMaxSection() { return this.parent.getMaxSection(); } @Override - public boolean isOutsideBuildHeight(BlockPos blockPos) - { - return parent.isOutsideBuildHeight(blockPos); - } + public boolean isOutsideBuildHeight(BlockPos blockPos) { return this.parent.isOutsideBuildHeight(blockPos); } @Override - public boolean isOutsideBuildHeight(int i) - { - return parent.isOutsideBuildHeight(i); - } + public boolean isOutsideBuildHeight(int i) { return this.parent.isOutsideBuildHeight(i); } @Override - public int getSectionIndex(int i) - { - return parent.getSectionIndex(i); - } + public int getSectionIndex(int i) { return this.parent.getSectionIndex(i); } @Override - public int getSectionIndexFromSectionY(int i) - { - return parent.getSectionIndexFromSectionY(i); - } + public int getSectionIndexFromSectionY(int i) { return this.parent.getSectionIndexFromSectionY(i); } @Override - public int getSectionYFromSectionIndex(int i) - { - return parent.getSectionYFromSectionIndex(i); - } + public int getSectionYFromSectionIndex(int i) { return this.parent.getSectionYFromSectionIndex(i); } #endif } diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 9a5920656..7fcebe40d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.fabric; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -35,34 +35,26 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor; //import io.netty.buffer.ByteBuf; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; import net.fabricmc.fabric.api.event.player.AttackBlockCallback; import net.fabricmc.fabric.api.event.player.UseBlockCallback; -import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; -import java.nio.FloatBuffer; import java.util.HashSet; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionResult; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.phys.HitResult; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; -import org.lwjgl.opengl.GL15; /** * This handles all events sent to the client, @@ -73,7 +65,7 @@ import org.lwjgl.opengl.GL15; * @version 2023-7-27 */ @Environment(EnvType.CLIENT) -public class FabricClientProxy implements IEventProxy +public class FabricClientProxy implements AbstractModInitializer.IEventProxy { private final ClientApi clientApi = ClientApi.INSTANCE; private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index b047bbfdd..2de23a193 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -21,7 +21,6 @@ package com.seibel.distanthorizons.fabric; import com.mojang.brigadier.CommandDispatcher; import com.seibel.distanthorizons.common.AbstractModInitializer; -import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.config.ConfigBase; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; @@ -29,7 +28,6 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*; import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.fabric.wrappers.FabricDependencySetup; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.*; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.DedicatedServerModInitializer; @@ -47,10 +45,6 @@ import java.util.function.Consumer; * Initialize and setup the Mod.
* If you are looking for the real start of the mod * check out the ClientProxy. - * - * @author coolGi - * @author Ran - * @version 9-2-2022 */ public class FabricMain extends AbstractModInitializer implements ClientModInitializer, DedicatedServerModInitializer { @@ -59,22 +53,13 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti @Override - protected void createInitialBindings() - { - FabricDependencySetup.createInitialBindings(); - } + protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); } @Override - protected IEventProxy createClientProxy() - { - return new FabricClientProxy(); - } + protected IEventProxy createClientProxy() { return new FabricClientProxy(); } @Override - protected IEventProxy createServerProxy(boolean isDedicated) - { - return new FabricServerProxy(isDedicated); - } + protected IEventProxy createServerProxy(boolean isDedicated) { return new FabricServerProxy(isDedicated); } @Override protected void initializeModCompat() @@ -109,19 +94,10 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti } @Override - protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) - { - // fabric-command-api-v1/v2 - //CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess #if MC_VER >= MC_1_19_2 , environment #endif ) -> { - // eventHandler.accept(dispatcher); - //}); - } + protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) { } @Override - protected void subscribeClientStartedEvent(Runnable eventHandler) - { - ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> eventHandler.run()); - } + protected void subscribeClientStartedEvent(Runnable eventHandler) { ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> eventHandler.run()); } @Override protected void subscribeServerStartingEvent(Consumer eventHandler) @@ -133,10 +109,11 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti @Override protected void runDelayedSetup() { - FabricDependencySetup.runDelayedSetup(); + SingletonInjector.INSTANCE.runDelayedSetup(); if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib")) ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog + #if MC_VER >= MC_1_20_1 if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium")) ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java index 7754f5bfb..71a0d8af7 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricServerProxy.java @@ -1,12 +1,11 @@ package com.seibel.distanthorizons.fabric; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.misc.ServerPlayerWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; -import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.api.internal.ServerApi; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; @@ -33,7 +32,7 @@ import java.util.function.Supplier; * @author Tomlee * @version 5-11-2022 */ -public class FabricServerProxy implements IEventProxy +public class FabricServerProxy implements AbstractModInitializer.IEventProxy { private static final ServerApi SERVER_API = ServerApi.INSTANCE; private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/FabricDependencySetup.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/FabricDependencySetup.java deleted file mode 100644 index 13eb0b7eb..000000000 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/FabricDependencySetup.java +++ /dev/null @@ -1,48 +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.wrappers; - -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; -import com.seibel.distanthorizons.fabric.wrappers.modAccessor.ModChecker; - -/** - * Binds all necessary dependencies, so we - * can access them in Core.
- * This needs to be called before any Core classes - * are loaded. - * - * @author James Seibel - * @author Ran - * @version 3-5-2022 - */ -public class FabricDependencySetup -{ - public static void createInitialBindings() - { - SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); - } - - public static void runDelayedSetup() - { - SingletonInjector.INSTANCE.runDelayedSetup(); - } - -} 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 6b225b68f..469f7b134 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.forge; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -52,7 +52,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; //import net.minecraftforge.network.NetworkRegistry; //import net.minecraftforge.network.simple.SimpleChannel; import org.apache.logging.log4j.Logger; @@ -73,7 +72,7 @@ import org.lwjgl.opengl.GL32; * @author James_Seibel * @version 2023-7-27 */ -public class ForgeClientProxy implements IEventProxy +public class ForgeClientProxy implements AbstractModInitializer.IEventProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index bd928126d..3a853f08e 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -21,12 +21,13 @@ package com.seibel.distanthorizons.forge; import com.mojang.brigadier.CommandDispatcher; import com.seibel.distanthorizons.common.AbstractModInitializer; -import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; -import com.seibel.distanthorizons.forge.wrappers.ForgeDependencySetup; +import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker; import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.commands.CommandSourceStack; @@ -68,11 +69,6 @@ import java.util.function.Consumer; * Initialize and setup the Mod.
* If you are looking for the real start of the mod * check out the ClientProxy. - * - * @author coolGi - * @author Ran - * @author James Seibel - * @version 8-15-2022 */ @Mod(ModInfo.ID) public class ForgeMain extends AbstractModInitializer @@ -85,22 +81,13 @@ public class ForgeMain extends AbstractModInitializer } @Override - protected void createInitialBindings() - { - ForgeDependencySetup.createInitialBindings(); - } + protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); } @Override - protected IEventProxy createClientProxy() - { - return new ForgeClientProxy(); - } + protected IEventProxy createClientProxy() { return new ForgeClientProxy(); } @Override - protected IEventProxy createServerProxy(boolean isDedicated) - { - return new ForgeServerProxy(isDedicated); - } + protected IEventProxy createServerProxy(boolean isDedicated) { return new ForgeServerProxy(isDedicated); } @Override protected void initializeModCompat() @@ -122,10 +109,7 @@ public class ForgeMain extends AbstractModInitializer @Override protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) { - MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> - { - eventHandler.accept(e.getDispatcher()); - }); + MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { eventHandler.accept(e.getDispatcher()); }); } @Override @@ -144,9 +128,6 @@ public class ForgeMain extends AbstractModInitializer } @Override - protected void runDelayedSetup() - { - ForgeDependencySetup.runDelayedSetup(); - } + protected void runDelayedSetup() { SingletonInjector.INSTANCE.runDelayedSetup(); } } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java index 0d92d8188..0c9521e0c 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -1,18 +1,15 @@ package com.seibel.distanthorizons.forge; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; -import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.api.internal.ServerApi; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; @@ -41,7 +38,7 @@ import org.apache.logging.log4j.Logger; import java.util.function.Supplier; -public class ForgeServerProxy implements IEventProxy +public class ForgeServerProxy implements AbstractModInitializer.IEventProxy { #if MC_VER < MC_1_19_2 private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java b/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java deleted file mode 100644 index 5008ee6c0..000000000 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/ForgeDependencySetup.java +++ /dev/null @@ -1,48 +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.wrappers; - -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; -import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker; - -/** - * Binds all necessary dependencies so we - * can access them in Core.
- * This needs to be called before any Core classes - * are loaded. - * - * @author James Seibel - * @author Ran - * @version 12-1-2021 - */ -public class ForgeDependencySetup -{ - public static void createInitialBindings() - { - SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); - } - - public static void runDelayedSetup() - { - SingletonInjector.INSTANCE.runDelayedSetup(); - } - -} diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index 24c6bd50d..d46be455c 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.neoforge; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -45,7 +45,6 @@ import net.neoforged.neoforge.event.level.LevelEvent; import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; import net.minecraft.world.level.chunk.ChunkAccess; -import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; //import net.neoforged.network.NetworkRegistry; //import net.neoforged.network.simple.SimpleChannel; import org.apache.logging.log4j.Logger; @@ -66,7 +65,7 @@ import org.lwjgl.opengl.GL32; * @author James_Seibel * @version 2023-7-27 */ -public class NeoforgeClientProxy implements IEventProxy +public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy { private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java index fbb0fec8f..8ee751e5e 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java @@ -17,16 +17,17 @@ * along with this program. If not, see . */ -package com.seibel.distanthorizons.neoforged; +package com.seibel.distanthorizons.neoforge; import com.mojang.brigadier.CommandDispatcher; import com.seibel.distanthorizons.common.AbstractModInitializer; -import com.seibel.distanthorizons.common.IEventProxy; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; +import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.neoforged.wrappers.NeoforgeDependencySetup; -import com.seibel.distanthorizons.neoforged.wrappers.modAccessor.OptifineAccessor; +import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker; +import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.OptifineAccessor; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.MinecraftServer; import net.neoforged.bus.api.IEventBus; @@ -45,11 +46,6 @@ import java.util.function.Consumer; * Initialize and setup the Mod.
* If you are looking for the real start of the mod * check out the ClientProxy. - * - * @author coolGi - * @author Ran - * @author James Seibel - * @version 8-15-2022 */ @Mod(ModInfo.ID) public class NeoforgeMain extends AbstractModInitializer @@ -61,22 +57,13 @@ public class NeoforgeMain extends AbstractModInitializer } @Override - protected void createInitialBindings() - { - NeoforgeDependencySetup.createInitialBindings(); - } + protected IEventProxy createServerProxy(boolean isDedicated) { return new NeoforgeServerProxy(isDedicated); } @Override - protected IEventProxy createClientProxy() - { - return new NeoforgeClientProxy(); - } + protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); } @Override - protected IEventProxy createServerProxy(boolean isDedicated) - { - return new NeoforgeServerProxy(isDedicated); - } + protected IEventProxy createClientProxy() { return new NeoforgeClientProxy(); } @Override protected void initializeModCompat() @@ -90,9 +77,7 @@ public class NeoforgeMain extends AbstractModInitializer @Override protected void subscribeRegisterCommandsEvent(Consumer> eventHandler) { - NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { - eventHandler.accept(e.getDispatcher()); - }); + NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { eventHandler.accept(e.getDispatcher()); }); } @Override @@ -104,15 +89,10 @@ public class NeoforgeMain extends AbstractModInitializer @Override protected void subscribeServerStartingEvent(Consumer eventHandler) { - NeoForge.EVENT_BUS.addListener((ServerStartingEvent e) -> { - eventHandler.accept(e.getServer()); - }); + NeoForge.EVENT_BUS.addListener((ServerStartingEvent e) -> { eventHandler.accept(e.getServer()); }); } @Override - protected void runDelayedSetup() - { - NeoforgeDependencySetup.runDelayedSetup(); - } + protected void runDelayedSetup() { SingletonInjector.INSTANCE.runDelayedSetup(); } } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java index a4048e980..505d3dcd6 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.neoforge; -import com.seibel.distanthorizons.common.IEventProxy; +import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.util.ProxyUtil; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; @@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; import java.util.function.Supplier; -public class NeoforgeServerProxy implements IEventProxy +public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy { private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java deleted file mode 100644 index 0679bc769..000000000 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/NeoforgeDependencySetup.java +++ /dev/null @@ -1,48 +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.wrappers; - -import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; -import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker; - -/** - * Binds all necessary dependencies so we - * can access them in Core.
- * This needs to be called before any Core classes - * are loaded. - * - * @author James Seibel - * @author Ran - * @version 12-1-2021 - */ -public class NeoforgeDependencySetup -{ - public static void createInitialBindings() - { - SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); - } - - public static void runDelayedSetup() - { - SingletonInjector.INSTANCE.runDelayedSetup(); - } - -} From 50663edc7644c76488f9caa3923eb6e03c87bec4 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 16 Jan 2024 17:28:42 +1030 Subject: [PATCH 061/301] Fixed compilation for pre 1.19.4 --- .../wrappers/worldGeneration/mimicObject/ChunkLoader.java | 4 ++++ .../com/seibel/distanthorizons/fabric/FabricClientProxy.java | 1 + 2 files changed, 5 insertions(+) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 97828775d..475f63af8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -234,7 +234,11 @@ public class ChunkLoader ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos")); if (!Objects.equals(chunkPos, actualPos)) { + #if MC_VER > MC_1_16_5 if (actualPos.equals(ChunkPos.ZERO)) + #else + if (actualPos.equals(ChunkPos.INVALID_CHUNK_POS)) + #endif { if (!zeroChunkPosErrorLogged) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 7fcebe40d..2fd788b6a 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -47,6 +47,7 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; +import java.nio.FloatBuffer; import java.util.HashSet; import net.minecraft.client.multiplayer.ClientLevel; From 666ab1319b9aca59b09e5ba008d7ecef7a630f7f Mon Sep 17 00:00:00 2001 From: coolGi Date: Wed, 17 Jan 2024 17:24:52 +1030 Subject: [PATCH 062/301] Fixed 1.17.1 --- .../wrappers/worldGeneration/mimicObject/ChunkLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 475f63af8..16fbac5cd 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -234,7 +234,7 @@ public class ChunkLoader ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos")); if (!Objects.equals(chunkPos, actualPos)) { - #if MC_VER > MC_1_16_5 + #if MC_VER > MC_1_17_1 if (actualPos.equals(ChunkPos.ZERO)) #else if (actualPos.equals(ChunkPos.INVALID_CHUNK_POS)) From 5aca47b357151215d0327f02b3abb413d8b9630d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 17 Jan 2024 07:15:47 -0600 Subject: [PATCH 063/301] Fix render data holes on world gen --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 163c0bf1f..e61f6bb80 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 163c0bf1fac5eb3f17406a6bcc0ed8ba5d5b041f +Subproject commit e61f6bb80204400de2d88bba442b1d3d7c205238 From d7618d73c3eed77fe820cfea08073f1f9c272904 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 17 Jan 2024 07:45:08 -0600 Subject: [PATCH 064/301] Fixes #613 (multiplayer failing due to folder not existing) --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index e61f6bb80..b0c2874e7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e61f6bb80204400de2d88bba442b1d3d7c205238 +Subproject commit b0c2874e71cbb294ca7ce524d51c35e278bc1c92 From 9a8f14c7d34da82820e50f077e2066ab71bf5215 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:47:47 +0600 Subject: [PATCH 065/301] Attempt to remove arch and add AWToAt.java --- .gitignore | 3 + build.gradle | 37 ++- buildSrc/src/main/java/AWToAT.java | 239 ++++++++++++++++++ fabric/build.gradle | 17 +- forge/build.gradle | 184 ++++++++++---- .../distanthorizons/forge/ForgeMain.java | 2 +- .../DistantHorizons.forge.mixins.json | 3 +- forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 4 + versionProperties/1.20.1.properties | 1 + versionProperties/1.20.2.properties | 1 + versionProperties/1.20.4.properties | 3 +- 14 files changed, 425 insertions(+), 75 deletions(-) create mode 100644 buildSrc/src/main/java/AWToAT.java diff --git a/.gitignore b/.gitignore index 16bdd9507..d69b9c48c 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ build.properties # Sqlite databases *.sqlite + +# Don't add access transformers to git as it's dynamically generated +accesstransformer.cfg diff --git a/build.gradle b/build.gradle index f6a938675..e6c680bd0 100644 --- a/build.gradle +++ b/build.gradle @@ -8,13 +8,18 @@ plugins { id "io.github.pacifistmc.forgix" version "1.2.6" // Manifold preprocessor - id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" +// id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" // // Provides mc libraries to core // id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false // Architectury is used here only as a replacement for forge's own loom - id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false +// id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false + id "fabric-loom" version "1.4-SNAPSHOT" apply false + + id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' apply false + id 'org.spongepowered.mixin' version '0.7.+' apply false + id 'org.parchmentmc.librarian.forgegradle' version '1.+' apply false } /** @@ -104,8 +109,8 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" - if (isMinecraftSubProject) - apply plugin: "systems.manifold.manifold-gradle-plugin" +// if (isMinecraftSubProject) +// apply plugin: "systems.manifold.manifold-gradle-plugin" if (p == project(":core")) apply plugin: "application" // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries @@ -114,14 +119,20 @@ subprojects { p -> if ( (findProject(":forge") && p == project(":forge")) || (findProject(":neoforge") && p == project(":neoforge")) - ) - apply plugin: "dev.architectury.loom" + ) { +// apply plugin: 'net.minecraftforge.gradle' +// apply plugin: 'org.spongepowered.mixin' +// apply plugin: 'org.parchmentmc.librarian.forgegradle' + + /* The code below creates the access transformer file */ + new AWToAT().remap(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), accessWidenerVersion) + } // Set the manifold version (may not be required tough) - manifold { - manifoldVersion = rootProject.manifold_version - } +// manifold { +// manifoldVersion = rootProject.manifold_version +// } // set up custom configurations (configurations are a way to handle dependencies) @@ -143,7 +154,7 @@ subprojects { p -> // this should match shadowMe pretty closely implementation.extendsFrom(forgeShadowMe) shadowMe.extendsFrom(forgeShadowMe) - forgeRuntimeLibrary.extendsFrom(forgeShadowMe) + runtimeOnly.extendsFrom(forgeShadowMe) if (isMinecraftSubProject && p != project(":common")) { @@ -154,14 +165,18 @@ subprojects { p -> runtimeClasspath.extendsFrom common if (findProject(":forge")) developmentForge.extendsFrom common + implementation.extendsFrom common if (findProject(":neoforge")) developmentNeoForge.extendsFrom common + implementation.extendsFrom common compileClasspath.extendsFrom coreProjects runtimeClasspath.extendsFrom coreProjects if (findProject(":forge")) developmentForge.extendsFrom coreProjects + implementation.extendsFrom coreProjects if (findProject(":neoforge")) developmentNeoForge.extendsFrom coreProjects + implementation.extendsFrom coreProjects if (findProject(":fabricLike") && p != project(":fabricLike")) { // Shadow fabricLike @@ -615,7 +630,7 @@ allprojects { p -> into p.file("build/resources/main") } - tasks.withType(JavaCompile) { + compileJava { if (isMinecraftSubProject) { options.release = rootProject.java_version as Integer options.compilerArgs += ["-Xplugin:Manifold"] diff --git a/buildSrc/src/main/java/AWToAT.java b/buildSrc/src/main/java/AWToAT.java new file mode 100644 index 000000000..2f851b264 --- /dev/null +++ b/buildSrc/src/main/java/AWToAT.java @@ -0,0 +1,239 @@ +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class AWToAT { + private static final Map ACCESS_POINT_MAP = new HashMap<>(); + + static { + ACCESS_POINT_MAP.put("accessible", "public"); + ACCESS_POINT_MAP.put("extendable", "public-f"); + ACCESS_POINT_MAP.put("mutable", "public-f"); + } + + public String minecraftVersion; + + public File remap(File file, String minecraftVersion) { + this.minecraftVersion = minecraftVersion.replace("_", "."); + File atFile = createATFile(file); + processFile(file, atFile); + return atFile; + } + + private File createATFile(File file) { + File metaInf = new File(file.getParentFile(), "META-INF"); + if (!metaInf.exists() && !metaInf.mkdir()) throw new RuntimeException("Error creating META-INF folder"); + File atFile = new File(metaInf, "accesstransformer.cfg"); + try { + atFile.createNewFile(); + } catch (IOException e) { + throw new RuntimeException("Error creating new file", e); + } + return atFile; + } + + private void processFile(File file, File atFile) { + /* Validates if we need to recreate the Access Transformer file if it's out of date */ + // Get the hash of the file + String fileHash = getFileHash(file); + try (Scanner atScanner = new Scanner(atFile)) { + // Check if the AT file is up-to-date by comparing the hash of the file with the hash stored in the AT file + boolean hashFound = false; + while (atScanner.hasNextLine()) { + String line = atScanner.nextLine(); + if (hashCheck(line, fileHash)) { + hashFound = true; + } + } + + // If the AT file is up-to-date, print a message and return + if (hashFound) { + System.out.println("Access Transformer file is already up to date."); + return; + } + } catch (FileNotFoundException ignored) { + // If the AT file does not exist, continue + } + + /* Creates the Access Transformer file */ + // Opens a scanner for reading the Access Widener file and a writer for writing to the Access Transformer file + try (Scanner scanner = new Scanner(file); FileWriter writer = new FileWriter(atFile)) { + // Create an ExecutorService with a fixed thread pool size equal to the number of available processors + ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + // List to hold Future objects representing results of computation + List> futures = new ArrayList<>(); + + // Write the hash of the file to the AT file + writer.write("#DH_MAPPING_HASH:" + fileHash + "\n"); + + // Read each line from the file + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + // Skip lines starting with "accessWidener", "#" or blank lines + if (line.startsWith("accessWidener") || line.startsWith("#") || line.isBlank()) continue; + + // Submit the line to the executor service for processing + // The processing is done by the processLine method + futures.add(executor.submit(() -> processLine(line.split(" ")))); + } + + // Write the results to the output file + // The results are obtained by calling the get method on each Future + for (Future future : futures) { + writer.write(future.get()); + } + + // Shutdown the executor service to free up resources + executor.shutdown(); + } catch (Exception e) { + throw new RuntimeException("Error reading or writing to file", e); + } + } + + private String processLine(String[] fields) { + // fields[0] = access point like "accessible", "extendable", "mutable" + // fields[1] = type like "field", "method", "class" + // fields[2] = class name + // fields[3] = field/method name + // fields[4] = field/method descriptor + + try { + // Store the original field/method name + String originalName = ""; + + // If there is a class name, replace the slashes with dots in the package name + if (fields.length > 2) fields[2] = fields[2].replace("/", "."); + + // If there is a field/method name, store the original name and remap it to SRG + if (fields.length > 3) { + originalName = fields[3]; + fields[3] = remapToSRG(fields[2], fields[3]); + } + + StringBuilder line = new StringBuilder(ACCESS_POINT_MAP.getOrDefault(fields[0], "public")).append(" "); + switch (fields[1]) { + case "field": + line.append(fields[2]).append(" ").append(fields[3]).append(" #").append(originalName); + // It'll be like: access-point class-name field-name-SRG # field-name-Mojmap + // Eg: public net.minecraft.client.Minecraft f_90981_ # instance + break; + case "method": + line.append(fields[2]).append(" ").append(fields[3]).append(fields[4]).append(" #").append(originalName); + // It'll be like: access-point class-name method-name-SRG method-descriptor # method-name-Mojmap + // Eg: public net.minecraft.client.Minecraft m_172797_()Lnet/minecraft/client/Minecraft; # getInstance + break; + default: + line.append(fields[2]); + // It'll be like: access-point class-name + // Eg: public net.minecraft.client.Minecraft + break; + } + line.append("\n"); + return line.toString(); + } catch (Exception e) { + throw new RuntimeException("Error processing line", e); + } + } + + private boolean hashCheck(String line, String fileHash) { + if (line.startsWith("#DH_MAPPING_HASH:")) { + String hash = line.substring(17); + return hash.equals(fileHash); + } + return false; + } + + public String getFileHash(File file) { + try { + MessageDigest shaDigest = MessageDigest.getInstance("SHA-256"); + try (InputStream fis = new FileInputStream(file)) { + byte[] byteArray = new byte[1024]; + int bytesCount; + + // Read file data and update in message digest + while ((bytesCount = fis.read(byteArray)) != -1) { + shaDigest.update(byteArray, 0, bytesCount); + } + } + + byte[] bytes = shaDigest.digest(); + + // Convert byte array into signum representation + StringBuilder sb = new StringBuilder(); + for (byte aByte : bytes) { + sb.append(Integer.toString((aByte & 0xff) + 0x100, 16).substring(1)); + } + + // Return complete hash + return sb.toString(); + } catch (NoSuchAlgorithmException | IOException e) { + throw new RuntimeException(e); + } + } + + + + // WARNING: BELOW LIES HIGHLY CURSED CODE AND MIGHT EVEN BE ILLEGAL + + + + + // Flag to track if there was an error in the GET request + boolean error = false; + + /** + * This method returns a field or method name from Mojang mappings as SRG mappings. + * It makes a GET request to the Linkie API to fetch the SRG name. + * + * @param clazz The class name + * @param name The field or method name + * @return The SRG name + * @throws Exception If there is an error in the GET request or the SRG name is not found in the response + */ + private String remapToSRG(String clazz, String name) throws Exception { + // Encode the class and field/method name to be used in the URL + String query = URLEncoder.encode(clazz + "." + name, StandardCharsets.UTF_8); + // Construct the URL for the GET request + String urlString = "https://linkieapi.shedaniel.me/api/search?namespace=mojang&query=" + query + "&version=" + this.minecraftVersion + "&limit=1&allowClasses=false&allowFields=true&allowMethods=true&translate=mojang_srg"; + URL url = new URI(urlString).toURL(); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + int responseCode = conn.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String inputLine; + StringBuilder content = new StringBuilder(); + // Read the response line by line + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + conn.disconnect(); + // Regex to find the SRG name in the response + Pattern pattern = Pattern.compile("\"l\"\\s*:\\s*\\{[^}]*\"i\"\\s*:\\s*\"([^\"]*)\""); + Matcher matcher = pattern.matcher(content.toString()); + if (matcher.find()) return matcher.group(1); + else throw new Exception("Couldn't find the SRG mapping for name: " + name + "\nCould not find 'i' in 'l' object in the response"); // `i` is the SRG name which is stored in the `l` JSON object + } else { + if (error) { + // If there was an error in the GET request, and we already tried again, throw an exception + throw new Exception("The GET request failed"); + } + // If there was an error in the GET request, wait 2.5 seconds and try again as we probably got rate limited + error = true; + Thread.sleep(2500); + return remapToSRG(clazz, name); + } + } +} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index ee52d6df3..16b860c36 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,6 +1,4 @@ -plugins { - id "fabric-loom" version "1.4-SNAPSHOT" -} +apply plugin: "fabric-loom" loom { accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") @@ -22,17 +20,12 @@ loom { } } -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null -} - configurations { // The addModJar basically embeds the mod to the built jar addModJar include.extendsFrom addModJar modImplementation.extendsFrom addModJar + dummy } def addMod(path, enabled) { @@ -114,6 +107,12 @@ dependencies { } } +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null +} + task deleteResources(type: Delete) { delete file("build/resources/main") diff --git a/forge/build.gradle b/forge/build.gradle index 9c159a519..5b39fd074 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,15 +1,12 @@ -plugins { - // Note: This is only needed for multi-loader projects - // The main architectury loom version is set at the start of the root build.gradle - id "architectury-plugin" version "3.4-SNAPSHOT" -} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'org.spongepowered.mixin' -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 +//sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 -architectury { - platformSetupLoomIde() - forge() -} +//architectury { +// platformSetupLoomIde() +// forge() +//} //loom { // forge { @@ -19,61 +16,138 @@ architectury { // } //} -loom { - silentMojangMappingsLicense() // Shut the licencing warning - accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") +//loom { +// silentMojangMappingsLicense() // Shut the licencing warning +// accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") +// +// forge { +// convertAccessWideners = true +// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name +// +// mixinConfigs = [ +// "DistantHorizons.forge.mixins.json" +// ] +// } +// +// // "runs" isn't required, but when we do need it then it can be useful +// runs { +// client { +// client() +// setConfigName("Forge Client") +// ideConfigGenerated(true) +// runDir("../run") +//// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) +// } +// server { +// server() +// setConfigName("Forge Server") +// ideConfigGenerated(true) +// runDir("../run") +// } +// } +//} - forge { - convertAccessWideners = true - extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - - mixinConfigs = [ - "DistantHorizons.forge.mixins.json" - ] - } - - // "runs" isn't required, but when we do need it then it can be useful +minecraft { + mappings channel: 'official', version: minecraft_version + accessTransformer = project(":common").file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { - client() - setConfigName("Forge Client") - ideConfigGenerated(true) - runDir("../run") -// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) + workingDirectory project.file('run') + ideaModule "${rootProject.name}.${project.name}.main" + taskName 'Client' + args "-mixins.config=${mod_name}.forge.mixins.json" + mods { + modClientRun { + source sourceSets.main + source project(":common").sourceSets.main + source project(":api").sourceSets.main + source project(":core").sourceSets.main + } + } + property 'forge.enabledGameTestNamespaces', mod_id + property 'forge.logging.console.level', 'debug' + properties 'mixin.env.remapRefMap': 'true' + property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg" } + server { - server() - setConfigName("Forge Server") - ideConfigGenerated(true) - runDir("../run") + workingDirectory project.file('run') + ideaModule "${rootProject.name}.${project.name}.main" + taskName 'Server' + args "-mixins.config=${mod_name}.forge.mixins.json" + mods { + modServerRun { + source sourceSets.main + source project(":common").sourceSets.main + source project(":api").sourceSets.main + source project(":core").sourceSets.main + } + } + property 'forge.logging.console.level', 'debug' + properties 'mixin.env.remapRefMap': 'true' + property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg" + } + + data { + workingDirectory project.file('run') + ideaModule "${rootProject.name}.${project.name}.main" + args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + taskName 'Data' + args "-mixins.config=${mod_name}.forge.mixins.json" + mods { + modDataRun { + source sourceSets.main + source project(":common").sourceSets.main + source project(":api").sourceSets.main + source project(":core").sourceSets.main + } + } + property 'forge.logging.console.level', 'debug' } } } +sourceSets.main.resources.srcDir 'src/generated/resources' -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null +//remapJar { +// inputFile = shadowJar.archiveFile +// dependsOn shadowJar +//// classifier null +//} +shadowJar { + finalizedBy 'reobfShadowJar' +} +jar.dependsOn('shadowJar') +reobf { + shadowJar {} } +minecraft.runs.all { + lazyToken('minecraft_classpath') { +// configurations.implementation.exclude group: 'org.jetbrains', module: 'annotations' +// configurations.implementation.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) +// configurations.runtimeLibrary.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) + } +} def addMod(path, enabled) { if (enabled == "2") - dependencies { implementation(path) } +// dependencies { implementation(path) } + dependencies { implementation(fg.deobf(path)) } else if (enabled == "1") - dependencies { modCompileOnly(path) } +// dependencies { modCompileOnly(path) } + dependencies { compileOnly(fg.deobf(path)) } } dependencies { - minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - mappings loom.layered() { - // Mojmap mappings - officialMojangMappings() - // Parchment mappings (it adds parameter mappings & javadoc) - parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") - } +// minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" +// mappings loom.layered() { +// // Mojmap mappings +// officialMojangMappings() +// // Parchment mappings (it adds parameter mappings & javadoc) +// parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") +// } // Forge - forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" + minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" // Architectury API // if (minecraft_version == "1.16.5") { @@ -89,12 +163,18 @@ dependencies { addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) + + annotationProcessor "org.spongepowered:mixin:0.8.5:processor" // if (System.getProperty("idea.sync.active") != "true") { // annotationProcessor "org.spongepowered:mixin:0.8.4:processor" // } } +mixin { + add sourceSets.main, "${mod_name}-forge-refmap.json" +} + task deleteResources(type: Delete) { delete file("build/resources/main") } @@ -108,10 +188,14 @@ processResources { dependsOn(tasks.named('copyAllResources')) } -tasks.named('runClient') { - dependsOn(tasks.named('copyAllResources')) - finalizedBy(deleteResources) -} +//processResources { +// dependsOn(tasks.named('copyAllResources')) +//} + +//tasks.named('prepareClient') { +// dependsOn(tasks.named('copyAllResources')) +// finalizedBy(deleteResources) +//} sourcesJar { diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index 4195b2dea..a86b24a9d 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -86,7 +86,7 @@ import java.util.List; * @author James Seibel * @version 8-15-2022 */ -@Mod(ModInfo.ID) +@Mod("distanthorizons") // TODO: Change it back to ModInfo.ID when forge works public class ForgeMain implements LodForgeMethodCaller { private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); diff --git a/forge/src/main/resources/DistantHorizons.forge.mixins.json b/forge/src/main/resources/DistantHorizons.forge.mixins.json index b30ef91ed..cd96e8fec 100644 --- a/forge/src/main/resources/DistantHorizons.forge.mixins.json +++ b/forge/src/main/resources/DistantHorizons.forge.mixins.json @@ -20,5 +20,6 @@ "client.MixinTextureUtil" ], "server": [], - "plugin": "com.seibel.distanthorizons.forge.mixins.ForgeMixinPlugin" + "plugin": "com.seibel.distanthorizons.forge.mixins.ForgeMixinPlugin", + "refmap": "DistantHorizons-forge-refmap.json" } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 3f199093b..d9aab7f79 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -29,5 +29,5 @@ issueTrackerURL = "${issues}" mandatory = true # Forge syntax type = "required" # Neoforge syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for - ordering = "NONE" + ordering = "AFTER" side = "BOTH" \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ac5579831..68434b1e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,11 @@ org.gradle.jvmargs=-Xmx4096M org.gradle.parallel=true org.gradle.caching=true +fabric.loom.multiProjectOptimisation=true # Mod Info mod_name=DistantHorizons +mod_id=distanthorizons mod_version=2.0.2-a-dev api_version=1.1.0 maven_group=com.seibel.distanthorizons diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e6aba2515..1af9e0930 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-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index 5e8900e42..f90316ec2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,6 +25,10 @@ pluginManagement { name "Sponge" url "https://repo.spongepowered.org/repository/maven-public/" } + maven { + name "ParchmentMC" + url "https://maven.parchmentmc.org" + } mavenCentral() gradlePluginPortal() diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index ba4d8188b..c09f670e1 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -2,6 +2,7 @@ java_version=17 minecraft_version=1.20.1 parchment_version=1.20.1:2023.09.03 +parchment_forge_version=1.20.1-2023.09.03 compatible_minecraft_versions=["1.20", "1.20.1"] accessWidenerVersion=1_20 builds_for=fabric,forge diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 1f15abab5..20b716662 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -2,6 +2,7 @@ java_version=17 minecraft_version=1.20.2 parchment_version=1.20.1:2023.09.03 +parchment_forge_version=1.20.1-2023.09.03 compatible_minecraft_versions=["1.20.2"] accessWidenerVersion=1_20_2 builds_for=fabric,forge diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 1f588d1db..74ac59e5a 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -2,9 +2,10 @@ java_version=17 minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 +parchment_forge_version=1.20.2-2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,forge,neoforge +builds_for=forge,fabric # Fabric loader fabric_loader_version=0.15.1 From aa73a30ac4c5a90b744f0bbbf16614abfb78c64a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 17 Jan 2024 20:57:10 -0600 Subject: [PATCH 066/301] Fix C2ME throwing errors when attempting to get region file --- .../RegionFileStorageExternalCache.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index edbc1c89f..bcdd6f5ab 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -21,6 +21,8 @@ public class RegionFileStorageExternalCache implements AutoCloseable { private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + /** Can be null due to the C2ME mod */ + @Nullable public final RegionFileStorage storage; public static final int MAX_CACHE_SIZE = 16; @@ -56,6 +58,19 @@ public class RegionFileStorageExternalCache implements AutoCloseable @Nullable public RegionFile getRegionFile(ChunkPos pos) throws IOException { + if (this.storage == null) + { + if (!regionCacheNullPointerWarningSent) + { + regionCacheNullPointerWarningSent = true; + LOGGER.warn("Unable to access Minecraft's chunk cache. This may be due to another mod changing said cache. DH will be unable to access any Minecraft chunk data until said mod is removed."); + } + + return null; + } + + + long posLong = ChunkPos.asLong(pos.getRegionX(), pos.getRegionZ()); RegionFile rFile = null; From 1d8946702233f83edee3d870e86bfa11f449e13a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Jan 2024 11:12:08 -0600 Subject: [PATCH 067/301] Fix Forge 1.20.1 launching (although crashes due to shadowJar fail) --- forge/build.gradle | 10 ++++++---- settings.gradle | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/forge/build.gradle b/forge/build.gradle index 5b39fd074..aaac92ced 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,3 +1,6 @@ +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'maven-publish' apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' @@ -49,6 +52,9 @@ apply plugin: 'org.spongepowered.mixin' minecraft { mappings channel: 'official', version: minecraft_version + + copyIdeResources = true + accessTransformer = project(":common").file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { @@ -188,10 +194,6 @@ processResources { dependsOn(tasks.named('copyAllResources')) } -//processResources { -// dependsOn(tasks.named('copyAllResources')) -//} - //tasks.named('prepareClient') { // dependsOn(tasks.named('copyAllResources')) // finalizedBy(deleteResources) diff --git a/settings.gradle b/settings.gradle index f90316ec2..fafdfba49 100644 --- a/settings.gradle +++ b/settings.gradle @@ -37,6 +37,10 @@ pluginManagement { } } +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + // Loads the version.properties From 4135fa6211ae9d43c9c1dce3d984c21d206ba348 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Jan 2024 12:24:10 -0600 Subject: [PATCH 068/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b0c2874e7..1c90270eb 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b0c2874e71cbb294ca7ce524d51c35e278bc1c92 +Subproject commit 1c90270eb61e65354af86ea07b5c2db6914196fe From 0d165860fb3734898f54223758326fa72cf92fc1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 21 Jan 2024 19:24:42 -0600 Subject: [PATCH 069/301] Merge branch 'distant-horizons-main' --- .../wrappers/block/BlockStateWrapper.java | 118 +++++++++++++++++- coreSubProjects | 2 +- .../fabric/FabricClientProxy.java | 12 +- .../mixins/client/MixinLevelRenderer.java | 23 ++-- .../mixins/client/MixinLevelRenderer.java | 15 ++- 5 files changed, 144 insertions(+), 26 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 23e635044..c39e8a69b 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -24,7 +24,10 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrappe import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import org.apache.logging.log4j.Logger; @@ -85,6 +88,8 @@ public class BlockStateWrapper implements IBlockStateWrapper * Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE} */ private int opacity = -1; + /** used by the Iris shader mod to determine how each LOD should be rendered */ + private byte irisBlockMaterialId = 0; @@ -116,7 +121,8 @@ public class BlockStateWrapper implements IBlockStateWrapper { this.blockState = blockState; this.serialString = this.serialize(levelWrapper); - LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"]"); + this.irisBlockMaterialId = this.calculateIrisBlockMaterialId(); + LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]"); } @@ -274,6 +280,9 @@ public class BlockStateWrapper implements IBlockStateWrapper #endif } + @Override + public byte getIrisBlockMaterialId() { return this.irisBlockMaterialId; } + @Override public String toString() { return this.getSerialString(); } @@ -457,4 +466,111 @@ public class BlockStateWrapper implements IBlockStateWrapper + //==============// + // Iris methods // + //==============// + + private byte calculateIrisBlockMaterialId() + { + if (this.blockState == null) + { + return 0; + } + + + String serialString = this.getSerialString(); + if (this.blockState.is(BlockTags.LEAVES)) + { + return 1; + } + else if (serialString.contains("water") && this.isLiquid()) + { + return 12; + } + else if (this.blockState.getSoundType() == SoundType.WOOD + #if MC_VER >= MC_1_19_2 + || this.blockState.getSoundType() == SoundType.CHERRY_WOOD + #endif + ) + { + return 3; + } + else if (this.blockState.getSoundType() == SoundType.METAL + #if MC_VER >= MC_1_19_2 + || this.blockState.getSoundType() == SoundType.COPPER + #endif + #if MC_VER >= MC_1_20_4 + || this.blockState.getSoundType() == SoundType.COPPER_BULB + || this.blockState.getSoundType() == SoundType.COPPER_GRATE + #endif + ) + { + return 4; + } + else if ( + #if MC_VER >= MC_1_18_2 + this.blockState.is(BlockTags.DIRT) + #else + state.is(Blocks.DIRT) + || state.is(Blocks.PODZOL) + || state.is(Blocks.COARSE_DIRT) + || state.is(Blocks.GRASS_BLOCK) + #endif + ) + { + return 5; + } + else if (this.blockState.is(Blocks.LAVA)) + { + return 6; + } + #if MC_VER >= MC_1_17_1 + else if (this.blockState.getSoundType() == SoundType.DEEPSLATE + || this.blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS + || this.blockState.getSoundType() == SoundType.DEEPSLATE_TILES + || this.blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE) + { + return 7; + } + #endif + else if (this.blockState.getSoundType() == SoundType.SNOW + #if MC_VER >= MC_1_17_1 + || this.blockState.getSoundType() == SoundType.POWDER_SNOW + #endif + ) + { + return 8; + } + else if (this.blockState.is(BlockTags.SAND)) + { + return 9; + } + else if ( + #if MC_VER >= MC_1_18_2 + this.blockState.is(BlockTags.TERRACOTTA) + #else + serialString.contains("terracotta") + #endif + ) + { + return 10; + } + else if (this.blockState.is(BlockTags.BASE_STONE_NETHER)) + { + return 11; + } + else if (serialString.contains("stone")) + { + return 2; + } + else if (this.blockState.getLightEmission() > 0) + { + return 15; + } + else + { + return 0; + } + } + } diff --git a/coreSubProjects b/coreSubProjects index 1c90270eb..0efa4c3de 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1c90270eb61e65354af86ea07b5c2db6914196fe +Subproject commit 0efa4c3de33b0d2650e0bb99f2e42add066adf6a diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 2fd788b6a..218f4cd5e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -47,7 +47,6 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; -import java.nio.FloatBuffer; import java.util.HashSet; import net.minecraft.client.multiplayer.ClientLevel; @@ -181,9 +180,6 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy // render event // //==============// - //Define this in the MixinLevelRenderer so that it works with sodium without any changes to the code - // TODO: If all else is fine, can we remove these commented code - // Client Render Level WorldRenderEvents.AFTER_SETUP.register((renderContext) -> { this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()), @@ -206,6 +202,14 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy #endif } }); + + WorldRenderEvents.AFTER_TRANSLUCENT.register((renderContext) -> + { + this.clientApi.renderDeferredLods(ClientLevelWrapper.getWrapper(renderContext.world()), + McObjectConverter.Convert(renderContext.matrixStack().last().pose()), + McObjectConverter.Convert(renderContext.projectionMatrix()), + renderContext.tickDelta()); + }); // Debug keyboard event // FIXME: Use better hooks so it doesn't trigger key press events in text boxes diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index f6223c099..558696d27 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -35,40 +35,29 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.coreapi.util.math.Mat4f; -import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.level.lighting.LevelLightEngine; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.nio.FloatBuffer; - #if MC_VER < MC_1_17_1 import org.lwjgl.opengl.GL15; #endif /** - * This class is used to mix in my rendering code + * This class is used to mix in DH's rendering code * before Minecraft starts rendering blocks. * If this wasn't done, and we used Forge's * render last event, the LODs would render on top * of the normal terrain.

* * This is also the mixin for rendering the clouds - * - * @author coolGi - * @author James Seibel - * @version 12-31-2021 */ @Mixin(LevelRenderer.class) public class MixinLevelRenderer @@ -92,13 +81,15 @@ public class MixinLevelRenderer public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTicks, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) #endif { + // FIXME this is only called when clouds are enabled and vanilla render distance is far enough + // not having the parital ticks doesn't appear to be critical currently, but might cause weird issues down the line + // get the partial ticks since renderBlockLayer doesn't // have access to them previousPartialTicks = partialTicks; } - // TODO: Can we move this to forge's client proxy similarly to how fabric does it #if MC_VER < MC_1_17_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", @@ -142,7 +133,7 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) @@ -157,6 +148,10 @@ public class MixinLevelRenderer projectionMatrix.set(matrixFloatArray); #endif } + } + else if (renderType.equals(RenderType.translucent())) + { + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index 6c54ed6db..ad7ca6cbc 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -51,17 +51,13 @@ import org.lwjgl.opengl.GL15; /** - * This class is used to mix in my rendering code + * This class is used to mix in DH's rendering code * before Minecraft starts rendering blocks. * If this wasn't done, and we used Forge's * render last event, the LODs would render on top * of the normal terrain.

* * This is also the mixin for rendering the clouds - * - * @author coolGi - * @author James Seibel - * @version 12-31-2021 */ @Mixin(LevelRenderer.class) public class MixinLevelRenderer @@ -88,6 +84,9 @@ public class MixinLevelRenderer public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTicks, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) #endif { + // FIXME this is only called when clouds are enabled and vanilla render distance is far enough + // not having the partial ticks doesn't appear to be critical currently, but might cause weird issues down the line + // get the partial ticks since renderBlockLayer doesn't // have access to them previousPartialTicks = partialTicks; @@ -138,7 +137,7 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderOpaqueLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) @@ -153,6 +152,10 @@ public class MixinLevelRenderer projectionMatrix.set(matrixFloatArray); #endif } + } + else if (renderType.equals(RenderType.translucent())) + { + ClientApi.INSTANCE.renderTranslucentLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) From 9390b8bc4d779b5bf956a4b1b0a85372790521ea Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 21 Jan 2024 21:36:12 -0600 Subject: [PATCH 070/301] Fix several Block materials --- .../wrappers/block/BlockStateWrapper.java | 75 +++++++++---------- coreSubProjects | 2 +- 2 files changed, 35 insertions(+), 42 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index c39e8a69b..79d3a9139 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -474,26 +474,31 @@ public class BlockStateWrapper implements IBlockStateWrapper { if (this.blockState == null) { - return 0; + return IrisBlockMaterial.AIR; } - String serialString = this.getSerialString(); - if (this.blockState.is(BlockTags.LEAVES)) + String serialString = this.getSerialString().toLowerCase(); + + if (this.blockState.is(BlockTags.LEAVES) + || serialString.contains("bamboo") + || serialString.contains("cactus") + ) { - return 1; + return IrisBlockMaterial.LEAVES; } - else if (serialString.contains("water") && this.isLiquid()) + else if (this.isLiquid() || this.blockState.is(Blocks.WATER)) { - return 12; + return IrisBlockMaterial.WATER; } else if (this.blockState.getSoundType() == SoundType.WOOD + || serialString.contains("root") #if MC_VER >= MC_1_19_2 || this.blockState.getSoundType() == SoundType.CHERRY_WOOD #endif ) { - return 3; + return IrisBlockMaterial.WOOD; } else if (this.blockState.getSoundType() == SoundType.METAL #if MC_VER >= MC_1_19_2 @@ -505,71 +510,59 @@ public class BlockStateWrapper implements IBlockStateWrapper #endif ) { - return 4; + return IrisBlockMaterial.METAL; } else if ( - #if MC_VER >= MC_1_18_2 - this.blockState.is(BlockTags.DIRT) - #else - state.is(Blocks.DIRT) - || state.is(Blocks.PODZOL) - || state.is(Blocks.COARSE_DIRT) - || state.is(Blocks.GRASS_BLOCK) - #endif + serialString.contains("dirt") + || serialString.contains("grass_block") + || serialString.contains("gravel") + || serialString.contains("mud") ) { - return 5; + return IrisBlockMaterial.DIRT; } else if (this.blockState.is(Blocks.LAVA)) { - return 6; + return IrisBlockMaterial.LAVA; } #if MC_VER >= MC_1_17_1 else if (this.blockState.getSoundType() == SoundType.DEEPSLATE || this.blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS || this.blockState.getSoundType() == SoundType.DEEPSLATE_TILES - || this.blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE) + || this.blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE + || serialString.contains("deepslate") ) { - return 7; + return IrisBlockMaterial.DEEPSLATE; } #endif - else if (this.blockState.getSoundType() == SoundType.SNOW - #if MC_VER >= MC_1_17_1 - || this.blockState.getSoundType() == SoundType.POWDER_SNOW - #endif - ) + else if (this.serialString.contains("snow")) { - return 8; + return IrisBlockMaterial.SNOW; } - else if (this.blockState.is(BlockTags.SAND)) + else if (serialString.contains("sand")) { - return 9; + return IrisBlockMaterial.SAND; } - else if ( - #if MC_VER >= MC_1_18_2 - this.blockState.is(BlockTags.TERRACOTTA) - #else - serialString.contains("terracotta") - #endif - ) + else if (serialString.contains("terracotta")) { - return 10; + return IrisBlockMaterial.TERRACOTTA; } else if (this.blockState.is(BlockTags.BASE_STONE_NETHER)) { - return 11; + return IrisBlockMaterial.NETHER_STONE; } - else if (serialString.contains("stone")) + else if (serialString.contains("stone") + || serialString.contains("ore")) { - return 2; + return IrisBlockMaterial.STONE; } else if (this.blockState.getLightEmission() > 0) { - return 15; + return IrisBlockMaterial.ILLUMINATED; } else { - return 0; + return IrisBlockMaterial.UNKOWN; } } diff --git a/coreSubProjects b/coreSubProjects index 0efa4c3de..9c8d77a4f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 0efa4c3de33b0d2650e0bb99f2e42add066adf6a +Subproject commit 9c8d77a4f3a979bfa537c6fb633764509a09e0cc From 8d32ab9bdbcb9ef3b8251ac3073a778d7c25a7cc Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 21 Jan 2024 21:48:06 -0600 Subject: [PATCH 071/301] Fix method names in neoForge mixinLevelRenderer --- coreSubProjects | 2 +- .../neoforge/mixins/client/MixinLevelRenderer.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 9c8d77a4f..d7eb8d941 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9c8d77a4f3a979bfa537c6fb633764509a09e0cc +Subproject commit d7eb8d9416a0d2fe4f7a332ea708e28ffc5fd299 diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index ad7ca6cbc..a6940f748 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -93,7 +93,6 @@ public class MixinLevelRenderer } - // TODO: Can we move this to forge's client proxy similarly to how fabric does it #if MC_VER < MC_1_17_1 @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V", @@ -137,7 +136,7 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderOpaqueLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) @@ -155,7 +154,7 @@ public class MixinLevelRenderer } else if (renderType.equals(RenderType.translucent())) { - ClientApi.INSTANCE.renderTranslucentLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) From 038073d34d92c56c4428ce19ab859e2442c23071 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Mon, 22 Jan 2024 08:37:27 -0800 Subject: [PATCH 072/301] Minor fixes for translucency and block ID's --- .../common/wrappers/block/BlockStateWrapper.java | 3 +++ .../distanthorizons/fabric/FabricClientProxy.java | 8 -------- .../fabric/mixins/client/MixinLevelRenderer.java | 11 +++++++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 79d3a9139..b7ff6ebcd 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -483,6 +483,7 @@ public class BlockStateWrapper implements IBlockStateWrapper if (this.blockState.is(BlockTags.LEAVES) || serialString.contains("bamboo") || serialString.contains("cactus") + || serialString.contains("chorus_flower") ) { return IrisBlockMaterial.LEAVES; @@ -517,6 +518,8 @@ public class BlockStateWrapper implements IBlockStateWrapper || serialString.contains("grass_block") || serialString.contains("gravel") || serialString.contains("mud") + || serialString.contains("podzol") + || serialString.contains("mycelium") ) { return IrisBlockMaterial.DIRT; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 218f4cd5e..6c35bcf5d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -202,14 +202,6 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy #endif } }); - - WorldRenderEvents.AFTER_TRANSLUCENT.register((renderContext) -> - { - this.clientApi.renderDeferredLods(ClientLevelWrapper.getWrapper(renderContext.world()), - McObjectConverter.Convert(renderContext.matrixStack().last().pose()), - McObjectConverter.Convert(renderContext.projectionMatrix()), - renderContext.tickDelta()); - }); // Debug keyboard event // FIXME: Use better hooks so it doesn't trigger key press events in text boxes diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 4d2f041a2..786453348 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -23,7 +23,11 @@ import com.mojang.blaze3d.vertex.PoseStack; #if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else +import com.seibel.distanthorizons.common.wrappers.McObjectConverter; +import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; +import com.seibel.distanthorizons.core.api.internal.ClientApi; import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import org.joml.Matrix4f; @@ -106,6 +110,13 @@ public class MixinLevelRenderer private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) #endif { + if (renderType.equals(RenderType.translucent())) { + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), + McObjectConverter.Convert(modelViewMatrixStack.last().pose()), + McObjectConverter.Convert(projectionMatrix), + previousPartialTicks); + } + // FIXME completely disables rendering when sodium is installed if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) { From 9b4276c29b74b7ca0ae16f70c2c0fa3c45685fab Mon Sep 17 00:00:00 2001 From: IMS212 Date: Mon, 22 Jan 2024 08:49:00 -0800 Subject: [PATCH 073/301] Add mushroom --- .../distanthorizons/common/wrappers/block/BlockStateWrapper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index b7ff6ebcd..a8289775f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -484,6 +484,7 @@ public class BlockStateWrapper implements IBlockStateWrapper || serialString.contains("bamboo") || serialString.contains("cactus") || serialString.contains("chorus_flower") + || serialString.contains("mushroom") ) { return IrisBlockMaterial.LEAVES; From 200ad05f4cb170ba03d33a4091bd5e9e7f24e0ef Mon Sep 17 00:00:00 2001 From: IMS212 Date: Mon, 22 Jan 2024 17:52:51 -0800 Subject: [PATCH 074/301] Fix suspicious frame time code --- .../mixins/client/MixinLevelRenderer.java | 23 +------------------ .../mixins/client/MixinLevelRenderer.java | 5 ++-- .../mixins/client/MixinLevelRenderer.java | 5 ++-- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 786453348..517ddbe44 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -66,27 +66,6 @@ public class MixinLevelRenderer { @Shadow private ClientLevel level; - @Unique - private static float previousPartialTicks = 0; - - // Inject rendering at first call to renderChunkLayer - // HEAD or RETURN - #if MC_VER < MC_1_17_1 - @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") - private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) - { - // get the partial ticks since renderBlockLayer doesn't - // have access to them - previousPartialTicks = partialTicks; - } - #else - @Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true) - public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) { - // get the partial ticks since renderChunkLayer doesn't - // have access to them - previousPartialTicks = tickDelta; - } - #endif #if MC_VER < MC_1_17_1 @Inject(at = @At("HEAD"), @@ -114,7 +93,7 @@ public class MixinLevelRenderer ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), McObjectConverter.Convert(modelViewMatrixStack.last().pose()), McObjectConverter.Convert(projectionMatrix), - previousPartialTicks); + Minecraft.getInstance().getFrameTime()); } // FIXME completely disables rendering when sodium is installed diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 558696d27..ce1ab1ea5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -24,6 +24,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import org.joml.Matrix4f; @@ -133,7 +134,7 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) @@ -151,7 +152,7 @@ public class MixinLevelRenderer } else if (renderType.equals(RenderType.translucent())) { - ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index a6940f748..ad0dc6d61 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -24,6 +24,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; #else import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import org.joml.Matrix4f; @@ -136,7 +137,7 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) @@ -154,7 +155,7 @@ public class MixinLevelRenderer } else if (renderType.equals(RenderType.translucent())) { - ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) From e809429a8c1f0df6703d9e2f2ac27c8d6d90b9ec Mon Sep 17 00:00:00 2001 From: IMS212 Date: Mon, 22 Jan 2024 17:59:59 -0800 Subject: [PATCH 075/301] Fix 1.16 support --- .../mixins/client/MixinLevelRenderer.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 517ddbe44..75bb8c02b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -23,16 +23,17 @@ import com.mojang.blaze3d.vertex.PoseStack; #if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else +import org.joml.Matrix4f; +#endif +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; +import com.seibel.distanthorizons.coreapi.util.math.Mat4f; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; -import org.joml.Matrix4f; -#endif -import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.core.config.Config; import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; @@ -41,6 +42,7 @@ import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.level.lighting.LevelLightEngine; +import org.lwjgl.opengl.GL15; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -89,10 +91,25 @@ public class MixinLevelRenderer private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) #endif { + #if MC_VER == MC_1_16_5 + // get the matrices from the OpenGL fixed pipeline + float[] mcProjMatrixRaw = new float[16]; + GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw); + Mat4f mcProjectionMatrix = new Mat4f(mcProjMatrixRaw); + mcProjectionMatrix.transpose(); + + Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose()); + + #else + // get the matrices directly from MC + Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose()); + Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix); + #endif + if (renderType.equals(RenderType.translucent())) { ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), - McObjectConverter.Convert(modelViewMatrixStack.last().pose()), - McObjectConverter.Convert(projectionMatrix), + mcModelViewMatrix, + mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); } From 297c8a1a1e89be1b4c4b0b6a77410de2c0a9ae49 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Tue, 23 Jan 2024 07:47:43 -0800 Subject: [PATCH 076/301] Actually fix 1.16 --- .../forge/mixins/client/MixinLevelRenderer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index ce1ab1ea5..22c938e6c 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -36,8 +36,12 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.coreapi.util.math.Mat4f; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; From d868b8fc72ebda4d4b100d1ee84d0af22cc532fb Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Jan 2024 13:32:35 -0600 Subject: [PATCH 077/301] Fix missing imports --- .../com/seibel/distanthorizons/fabric/FabricClientProxy.java | 1 + .../forge/mixins/client/MixinLevelRenderer.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 218f4cd5e..62d7d4135 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -47,6 +47,7 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; +import java.nio.FloatBuffer; import java.util.HashSet; import net.minecraft.client.multiplayer.ClientLevel; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 558696d27..32a1fe843 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -35,8 +35,11 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.coreapi.util.math.Mat4f; +import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -45,6 +48,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.nio.FloatBuffer; + #if MC_VER < MC_1_17_1 import org.lwjgl.opengl.GL15; #endif From 6d7b557c36051d19c1f30b79a1322e68c01f6e90 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:44:50 +1100 Subject: [PATCH 078/301] Attempt to move over to Unimined --- build.gradle | 97 +++++----- .../RegionFileStorageExternalCache.java | 2 +- coreSubProjects | 2 +- fabric/build.gradle | 71 ++++--- forge/build.gradle | 173 ++---------------- .../mixins/client/MixinDynamicTexture.java | 2 +- .../DistantHorizons.forge.mixins.json | 4 +- forge/src/main/resources/META-INF/mods.toml | 7 +- forge/src/main/resources/pack.mcmeta | 10 - neoforge/build.gradle | 111 ++--------- settings.gradle | 6 + versionProperties/1.20.1.properties | 1 - versionProperties/1.20.2.properties | 1 - versionProperties/1.20.4.properties | 5 +- 14 files changed, 130 insertions(+), 362 deletions(-) delete mode 100644 forge/src/main/resources/pack.mcmeta diff --git a/build.gradle b/build.gradle index e6c680bd0..fd98ce39f 100644 --- a/build.gradle +++ b/build.gradle @@ -13,13 +13,8 @@ plugins { // // Provides mc libraries to core // id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false - // Architectury is used here only as a replacement for forge's own loom -// id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false - id "fabric-loom" version "1.4-SNAPSHOT" apply false - - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' apply false - id 'org.spongepowered.mixin' version '0.7.+' apply false - id 'org.parchmentmc.librarian.forgegradle' version '1.+' apply false + // Use unimined which is our one in all solution to minecraft loaders + id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false } /** @@ -114,18 +109,30 @@ subprojects { p -> if (p == project(":core")) apply plugin: "application" // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries + + if (p != project(":common") && isMinecraftSubProject) { + apply plugin: "xyz.wagyourtail.unimined" - // Apply forge's loom - if ( - (findProject(":forge") && p == project(":forge")) || - (findProject(":neoforge") && p == project(":neoforge")) - ) { -// apply plugin: 'net.minecraftforge.gradle' -// apply plugin: 'org.spongepowered.mixin' -// apply plugin: 'org.parchmentmc.librarian.forgegradle' + unimined.minecraft(sourceSets.main, true) { + version minecraft_version - /* The code below creates the access transformer file */ - new AWToAT().remap(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), accessWidenerVersion) + def parchmentVersionParts = parchment_version.split(":") + mappings { + mojmap() + parchment(parchmentVersionParts[0], parchmentVersionParts[1]) + devNamespace "mojmap" + } + } + + tasks.withType(JavaCompile).configureEach { + source(project(":common").sourceSets.main.allSource) + source(project(":api").sourceSets.main.allSource) + source(project(":core").sourceSets.main.allSource) + } + } + + tasks.withType(GenerateModuleMetadata) { + enabled = false } @@ -138,52 +145,33 @@ subprojects { p -> // set up custom configurations (configurations are a way to handle dependencies) configurations { // extends the shadowJar configuration - shadowMe + shadowMe // Configuration that contains coreProjects + shade // Configuration that doesn't contain coreProjects + // have implemented dependencies automatically embedded in the final jar implementation.extendsFrom(shadowMe) + implementation.extendsFrom(shade) + + // Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way) + minecraftLibraries.extendsFrom(shade) // Configuration fpr core & api coreProjects shadowMe.extendsFrom(coreProjects) - // FIXME this additional configuration is necessary because forge - // needs forgeRuntimeLibrary, although adding it to shadowMe - // causes runtime issues where the libraries aren't properly added - forgeShadowMe - // this should match shadowMe pretty closely - implementation.extendsFrom(forgeShadowMe) - shadowMe.extendsFrom(forgeShadowMe) - runtimeOnly.extendsFrom(forgeShadowMe) - - if (isMinecraftSubProject && p != project(":common")) { // Shadow common common shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - if (findProject(":forge")) - developmentForge.extendsFrom common - implementation.extendsFrom common - if (findProject(":neoforge")) - developmentNeoForge.extendsFrom common - implementation.extendsFrom common - compileClasspath.extendsFrom coreProjects - runtimeClasspath.extendsFrom coreProjects - if (findProject(":forge")) - developmentForge.extendsFrom coreProjects - implementation.extendsFrom coreProjects - if (findProject(":neoforge")) - developmentNeoForge.extendsFrom coreProjects - implementation.extendsFrom coreProjects + implementation.extendsFrom common + implementation.extendsFrom coreProjects if (findProject(":fabricLike") && p != project(":fabricLike")) { // Shadow fabricLike fabricLike shadowFabricLike - compileClasspath.extendsFrom fabricLike - runtimeClasspath.extendsFrom fabricLike + implementation.extendsFrom fabricLike } } } @@ -202,7 +190,6 @@ subprojects { p -> // shared dependencies // //=====================// - // Manifold if (isMinecraftSubProject) { annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}") @@ -223,24 +210,24 @@ subprojects { p -> implementation("junit:junit:4.13") // Compression - forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") + shade("org.lz4:lz4-java:${rootProject.lz4_version}") // Sqlite Database - forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") + shade("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}") + shade("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") + shade("com.electronwill.night-config:json:${rootProject.nightconfig_version}") // SVG (not needed atm) -// forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") +// shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") // Netty // Breaks 1.16.5 - //forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}") + //shade("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}") { + shade("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it } @@ -291,7 +278,7 @@ subprojects { p -> shadowJar { - configurations = [project.configurations.shadowMe] + configurations = [project.configurations.shadowMe, project.configurations.shade] if (isMinecraftSubProject && p != project(":common")) { configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index edbc1c89f..757f5500c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.chunk.storage.RegionFile; import net.minecraft.world.level.chunk.storage.RegionFileStorage; import org.apache.logging.log4j.Logger; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.DataInputStream; import java.io.IOException; import java.nio.file.Files; diff --git a/coreSubProjects b/coreSubProjects index 754954326..fd80b0add 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7549543268149eb5f93d44bf1b4651e10734247f +Subproject commit fd80b0adde7a545f3793729d31e6dce3254300f4 diff --git a/fabric/build.gradle b/fabric/build.gradle index 16b860c36..342f7704c 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,22 +1,7 @@ -apply plugin: "fabric-loom" - -loom { - accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") - - // "runs" isn't required, but when we do need it then it can be useful - runs { - client { - client() - setConfigName("Fabric Client") - ideConfigGenerated(true) - runDir("../run") - } - server { - server() - setConfigName("Fabric Server") - ideConfigGenerated(true) - runDir("../run") - } +unimined.minecraft { + fabric { + loader rootProject.fabric_loader_version + accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) } } @@ -32,27 +17,31 @@ def addMod(path, enabled) { if (enabled == "2") dependencies { modImplementation(path) } else if (enabled == "1") - dependencies { modCompileOnly(path) } + dependencies { compileOnly(path) } +} + +// TODO: There currently seems to be a bug which causes the regular addModJar to not work, swap back to the regular addModJar when fixed +def addModJar_(path) { + dependencies { + modImplementation(path) + include(path) + } } dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings loom.layered() { - // Mojmap mappings - officialMojangMappings() - // Parchment mappings (it adds parameter mappings & javadoc) - parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") - } - // Fabric loader - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - + annotationProcessor "javax.annotation:javax.annotation-api:1.3.2" + implementation("javax.annotation:javax.annotation-api:1.3.2") + runtimeOnly "javax.annotation:javax.annotation-api:1.3.2" + compileOnly "javax.annotation:javax.annotation-api:1.3.2" + modImplementation "javax.annotation:javax.annotation-api:1.3.2" + // Fabric API - addModJar(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) - addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) - addModJar(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version)) - addModJar(fabricApi.module("fabric-events-interaction-v0", rootProject.fabric_api_version)) - addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy) - addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version)) + addModJar_(fabricApi.fabricModule("fabric-api-base", rootProject.fabric_api_version)) + addModJar_(fabricApi.fabricModule("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) + addModJar_(fabricApi.fabricModule("fabric-resource-loader-v0", rootProject.fabric_api_version)) + addModJar_(fabricApi.fabricModule("fabric-events-interaction-v0", rootProject.fabric_api_version)) + addModJar_(fabricApi.fabricModule("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy) + addModJar_(fabricApi.fabricModule("fabric-networking-api-v1", rootProject.fabric_api_version)) // Mod Menu modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") @@ -123,11 +112,13 @@ processResources { dependsOn(copyCommonLoaderResources) } -runClient { - dependsOn(copyCoreResources) - dependsOn(copyCommonLoaderResources) +afterEvaluate { + runClient { + dependsOn(copyCoreResources) + dependsOn(copyCommonLoaderResources) // jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) - finalizedBy(deleteResources) + finalizedBy(deleteResources) + } } //jar { diff --git a/forge/build.gradle b/forge/build.gradle index 5b39fd074..660022115 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,154 +1,19 @@ -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.spongepowered.mixin' - -//sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 - -//architectury { -// platformSetupLoomIde() -// forge() -//} - -//loom { -// forge { -// convertAccessWideners.set(true) -// extraAccessWideners.add("lod.accesswidener") -// mixinConfigs("DistantHorizons.mixins.json") -// } -//} - -//loom { -// silentMojangMappingsLicense() // Shut the licencing warning -// accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") -// -// forge { -// convertAccessWideners = true -// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name -// -// mixinConfigs = [ -// "DistantHorizons.forge.mixins.json" -// ] -// } -// -// // "runs" isn't required, but when we do need it then it can be useful -// runs { -// client { -// client() -// setConfigName("Forge Client") -// ideConfigGenerated(true) -// runDir("../run") -//// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) -// } -// server { -// server() -// setConfigName("Forge Server") -// ideConfigGenerated(true) -// runDir("../run") -// } -// } -//} - -minecraft { - mappings channel: 'official', version: minecraft_version - accessTransformer = project(":common").file('src/main/resources/META-INF/accesstransformer.cfg') - runs { - client { - workingDirectory project.file('run') - ideaModule "${rootProject.name}.${project.name}.main" - taskName 'Client' - args "-mixins.config=${mod_name}.forge.mixins.json" - mods { - modClientRun { - source sourceSets.main - source project(":common").sourceSets.main - source project(":api").sourceSets.main - source project(":core").sourceSets.main - } - } - property 'forge.enabledGameTestNamespaces', mod_id - property 'forge.logging.console.level', 'debug' - properties 'mixin.env.remapRefMap': 'true' - property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg" - } - - server { - workingDirectory project.file('run') - ideaModule "${rootProject.name}.${project.name}.main" - taskName 'Server' - args "-mixins.config=${mod_name}.forge.mixins.json" - mods { - modServerRun { - source sourceSets.main - source project(":common").sourceSets.main - source project(":api").sourceSets.main - source project(":core").sourceSets.main - } - } - property 'forge.logging.console.level', 'debug' - properties 'mixin.env.remapRefMap': 'true' - property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg" - } - - data { - workingDirectory project.file('run') - ideaModule "${rootProject.name}.${project.name}.main" - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - taskName 'Data' - args "-mixins.config=${mod_name}.forge.mixins.json" - mods { - modDataRun { - source sourceSets.main - source project(":common").sourceSets.main - source project(":api").sourceSets.main - source project(":core").sourceSets.main - } - } - property 'forge.logging.console.level', 'debug' - } +unimined.minecraft { + minecraftForge { + loader forge_version + mixinConfig("DistantHorizons.forge.mixins.json") + accessTransformer(aw2at(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))) } } -sourceSets.main.resources.srcDir 'src/generated/resources' -//remapJar { -// inputFile = shadowJar.archiveFile -// dependsOn shadowJar -//// classifier null -//} -shadowJar { - finalizedBy 'reobfShadowJar' -} -jar.dependsOn('shadowJar') -reobf { - shadowJar {} -} - -minecraft.runs.all { - lazyToken('minecraft_classpath') { -// configurations.implementation.exclude group: 'org.jetbrains', module: 'annotations' -// configurations.implementation.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) -// configurations.runtimeLibrary.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) - } -} def addMod(path, enabled) { if (enabled == "2") -// dependencies { implementation(path) } - dependencies { implementation(fg.deobf(path)) } + dependencies { modImplementation(path) } else if (enabled == "1") -// dependencies { modCompileOnly(path) } - dependencies { compileOnly(fg.deobf(path)) } + dependencies { compileOnly(path) } } dependencies { -// minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" -// mappings loom.layered() { -// // Mojmap mappings -// officialMojangMappings() -// // Parchment mappings (it adds parameter mappings & javadoc) -// parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") -// } - - // Forge - minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - // Architectury API // if (minecraft_version == "1.16.5") { // implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") @@ -164,17 +29,13 @@ dependencies { addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) - annotationProcessor "org.spongepowered:mixin:0.8.5:processor" +// annotationProcessor "org.spongepowered:mixin:0.8.5:processor" // if (System.getProperty("idea.sync.active") != "true") { // annotationProcessor "org.spongepowered:mixin:0.8.4:processor" // } } -mixin { - add sourceSets.main, "${mod_name}-forge-refmap.json" -} - task deleteResources(type: Delete) { delete file("build/resources/main") } @@ -188,14 +49,18 @@ processResources { dependsOn(tasks.named('copyAllResources')) } -//processResources { -// dependsOn(tasks.named('copyAllResources')) -//} +afterEvaluate { + runClient { + dependsOn(tasks.named('copyAllResources')) + finalizedBy(deleteResources) + } +} -//tasks.named('prepareClient') { -// dependsOn(tasks.named('copyAllResources')) -// finalizedBy(deleteResources) -//} +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null +} sourcesJar { 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 index 7117e7063..36bf97035 100644 --- 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 @@ -38,7 +38,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; @Mixin(DynamicTexture.class) public abstract class MixinDynamicTexture implements ILightTextureMarker diff --git a/forge/src/main/resources/DistantHorizons.forge.mixins.json b/forge/src/main/resources/DistantHorizons.forge.mixins.json index cd96e8fec..c7326a9e4 100644 --- a/forge/src/main/resources/DistantHorizons.forge.mixins.json +++ b/forge/src/main/resources/DistantHorizons.forge.mixins.json @@ -19,7 +19,5 @@ "client.MixinOptionsScreen", "client.MixinTextureUtil" ], - "server": [], - "plugin": "com.seibel.distanthorizons.forge.mixins.ForgeMixinPlugin", - "refmap": "DistantHorizons-forge-refmap.json" + "server": [] } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d9aab7f79..07a9fb5ca 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -23,11 +23,16 @@ issueTrackerURL = "${issues}" #// Allow any version to be present (or not) on the server acceptableRemoteVersions = "*" +[[dependencies.distanthorizons]] + modId="forge" #mandatory + mandatory = true # Forge syntax + versionRange="[0,)" #mandatory + ordering="NONE" + side="BOTH" [[dependencies.distanthorizons]] modId = "minecraft" mandatory = true # Forge syntax - type = "required" # Neoforge syntax versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "AFTER" side = "BOTH" \ No newline at end of file diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta deleted file mode 100644 index 37621f6f9..000000000 --- a/forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "pack": { - "pack_format": 7, - "supported_formats": { - "min_inclusive": 16, - "max_inclusive": 90000 - }, - "description": "Distant Horizons" - } -} diff --git a/neoforge/build.gradle b/neoforge/build.gradle index dd98c015a..31700a31b 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -1,100 +1,19 @@ -plugins { - // Note: This is only needed for multi-loader projects - // The main architectury loom version is set at the start of the root build.gradle - id "architectury-plugin" version "3.4-SNAPSHOT" -} - -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 - -architectury { - platformSetupLoomIde() - neoForge() -} - -repositories { - maven { - name "Neoforge" - url "https://maven.neoforged.net/releases/" +unimined.minecraft { + neoForged { + loader neoforge_version + mixinConfig("DistantHorizons.neoforge.mixins.json") + accessTransformer(aw2at(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))) } } -//loom { -// forge { -// convertAccessWideners.set(true) -// extraAccessWideners.add("lod.accesswidener") -// mixinConfigs("DistantHorizons.mixins.json") -// } -//} - -loom { - silentMojangMappingsLicense() // Shut the licencing warning - accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") - - neoForge { - // Access wideners are now defined in the `remapJar.atAccessWideners` -// convertAccessWideners = true -// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - - // Mixins are now defined in the `mods.toml` -// mixinConfigs = [ -// "DistantHorizons.mixins.json" -// ] - } - mixin { - // Mixins are now defined in the `mods.toml` -// mixinConfigs = [ -// "DistantHorizons.mixins.json" -// ] - } - - // "runs" isn't required, but when we do need it then it can be useful - runs { - client { - client() - setConfigName("NeoForge Client") - ideConfigGenerated(true) - runDir("../run") -// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) - } - server { - server() - setConfigName("NeoForge Server") - ideConfigGenerated(true) - runDir("../run") - } - } -} - -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null - - atAccessWideners.add("distanthorizons.accesswidener") -} - def addMod(path, enabled) { if (enabled == "2") - dependencies { implementation(path) } + dependencies { modImplementation(path) } else if (enabled == "1") - dependencies { modCompileOnly(path) } + dependencies { compileOnly(path) } } dependencies { - minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - mappings loom.layered() { - // Mojmap mappings - officialMojangMappings() - // Parchment mappings (it adds parameter mappings & javadoc) - parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") - - // Architectury hackishness -// it.mappings "dev.architectury:yarn-mappings-patch-forge:${rootProject.mappings_patch}" - } - - // Neoforge - neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - // Architectury API // if (minecraft_version == "1.16.5") { // implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") @@ -110,6 +29,8 @@ dependencies { addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) +// annotationProcessor "org.spongepowered:mixin:0.8.5:processor" + // if (System.getProperty("idea.sync.active") != "true") { // annotationProcessor "org.spongepowered:mixin:0.8.4:processor" // } @@ -128,9 +49,17 @@ processResources { dependsOn(tasks.named('copyAllResources')) } -tasks.named('runClient') { - dependsOn(tasks.named('copyAllResources')) - finalizedBy(deleteResources) +afterEvaluate { + runClient { + dependsOn(tasks.named('copyAllResources')) + finalizedBy(deleteResources) + } +} + +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null } diff --git a/settings.gradle b/settings.gradle index f90316ec2..33c4c4554 100644 --- a/settings.gradle +++ b/settings.gradle @@ -29,6 +29,12 @@ pluginManagement { name "ParchmentMC" url "https://maven.parchmentmc.org" } + maven { + url = "https://maven.wagyourtail.xyz/releases" + } + maven { + url = "https://maven.wagyourtail.xyz/snapshots" + } mavenCentral() gradlePluginPortal() diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index c09f670e1..ba4d8188b 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -2,7 +2,6 @@ java_version=17 minecraft_version=1.20.1 parchment_version=1.20.1:2023.09.03 -parchment_forge_version=1.20.1-2023.09.03 compatible_minecraft_versions=["1.20", "1.20.1"] accessWidenerVersion=1_20 builds_for=fabric,forge diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 20b716662..1f15abab5 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -2,7 +2,6 @@ java_version=17 minecraft_version=1.20.2 parchment_version=1.20.1:2023.09.03 -parchment_forge_version=1.20.1-2023.09.03 compatible_minecraft_versions=["1.20.2"] accessWidenerVersion=1_20_2 builds_for=fabric,forge diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 74ac59e5a..315f01d8d 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -2,10 +2,9 @@ java_version=17 minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 -parchment_forge_version=1.20.2-2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=forge,fabric +builds_for=fabric,neoforge # Fabric loader fabric_loader_version=0.15.1 @@ -39,7 +38,7 @@ fabric_api_version=0.91.2+1.20.4 # (Neo)Forge loader forge_version=49.0.16 -neoforge_version=20.4.83-beta +neoforge_version=118-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From a887e35285df371fb24c3532a877ff15e4f2be03 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 31 Jan 2024 21:49:59 -0600 Subject: [PATCH 079/301] Add Iris API events --- .../common/wrappers/minecraft/MinecraftRenderWrapper.java | 6 ------ coreSubProjects | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) 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 6a8ae1318..30eb60581 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 @@ -261,12 +261,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public int getTargetFrameBuffer() { - int frameBufferOverrideId = DhApiRenderProxy.INSTANCE.targetFrameBufferOverride; - if (frameBufferOverrideId != -1) - { - return frameBufferOverrideId; - } - // used so we can access the framebuffer shaders end up rendering to if (AbstractOptifineAccessor.optifinePresent()) { diff --git a/coreSubProjects b/coreSubProjects index d7eb8d941..15ee6a951 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit d7eb8d9416a0d2fe4f7a332ea708e28ffc5fd299 +Subproject commit 15ee6a9512ba5850b606fcd46651cfa2144b9999 From 982bf951e1087833fe4fd15a71f1df1bc956bf50 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 1 Feb 2024 07:39:16 -0600 Subject: [PATCH 080/301] Fix 1.19.2 compiling --- .../common/wrappers/block/BlockStateWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index a8289775f..3e3fbd24e 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -495,7 +495,7 @@ public class BlockStateWrapper implements IBlockStateWrapper } else if (this.blockState.getSoundType() == SoundType.WOOD || serialString.contains("root") - #if MC_VER >= MC_1_19_2 + #if MC_VER >= MC_1_19_4 || this.blockState.getSoundType() == SoundType.CHERRY_WOOD #endif ) From 03c4926b0997b4011656ff3bb8a58a7efa563a0b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 3 Feb 2024 19:45:29 -0600 Subject: [PATCH 081/301] update to latest core --- .../wrappers/block/BlockStateWrapper.java | 121 +++++++++++++++++- .../minecraft/MinecraftRenderWrapper.java | 6 - coreSubProjects | 2 +- 3 files changed, 118 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 23e635044..523d992e6 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -24,7 +24,10 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrappe import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import org.apache.logging.log4j.Logger; @@ -61,7 +64,7 @@ public class BlockStateWrapper implements IBlockStateWrapper // must be defined before AIR, otherwise a null pointer will be thrown private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - public static final ConcurrentHashMap WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>(); + public static final ConcurrentHashMap WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>(); public static final String AIR_STRING = "AIR"; public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null); @@ -80,11 +83,13 @@ public class BlockStateWrapper implements IBlockStateWrapper public final BlockState blockState; /** technically final, but since it requires a method call to generate it can't be marked as such */ private String serialString; - /** + /** * Cached opacity value, -1 if not populated.
* Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE} */ private int opacity = -1; + /** used by the Iris shader mod to determine how each LOD should be rendered */ + private byte irisBlockMaterialId = 0; @@ -116,7 +121,8 @@ public class BlockStateWrapper implements IBlockStateWrapper { this.blockState = blockState; this.serialString = this.serialize(levelWrapper); - LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"]"); + this.irisBlockMaterialId = this.calculateIrisBlockMaterialId(); + LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]"); } @@ -125,7 +131,7 @@ public class BlockStateWrapper implements IBlockStateWrapper // helper methods // //================// - /** + /** * Requires a {@link ILevelWrapper} since {@link BlockStateWrapper#deserialize(String,ILevelWrapper)} also requires one. * This way the method won't accidentally be called before the deserialization can be completed. */ @@ -274,6 +280,9 @@ public class BlockStateWrapper implements IBlockStateWrapper #endif } + @Override + public byte getIrisBlockMaterialId() { return this.irisBlockMaterialId; } + @Override public String toString() { return this.getSerialString(); } @@ -457,4 +466,108 @@ public class BlockStateWrapper implements IBlockStateWrapper + //==============// + // Iris methods // + //==============// + + private byte calculateIrisBlockMaterialId() + { + if (this.blockState == null) + { + return IrisBlockMaterial.AIR; + } + + + String serialString = this.getSerialString().toLowerCase(); + + if (this.blockState.is(BlockTags.LEAVES) + || serialString.contains("bamboo") + || serialString.contains("cactus") + || serialString.contains("chorus_flower") + || serialString.contains("mushroom") + ) + { + return IrisBlockMaterial.LEAVES; + } + else if (this.isLiquid() || this.blockState.is(Blocks.WATER)) + { + return IrisBlockMaterial.WATER; + } + else if (this.blockState.getSoundType() == SoundType.WOOD + || serialString.contains("root") + #if MC_VER >= MC_1_19_4 + || this.blockState.getSoundType() == SoundType.CHERRY_WOOD + #endif + ) + { + return IrisBlockMaterial.WOOD; + } + else if (this.blockState.getSoundType() == SoundType.METAL + #if MC_VER >= MC_1_19_2 + || this.blockState.getSoundType() == SoundType.COPPER + #endif + #if MC_VER >= MC_1_20_4 + || this.blockState.getSoundType() == SoundType.COPPER_BULB + || this.blockState.getSoundType() == SoundType.COPPER_GRATE + #endif + ) + { + return IrisBlockMaterial.METAL; + } + else if ( + serialString.contains("dirt") + || serialString.contains("grass_block") + || serialString.contains("gravel") + || serialString.contains("mud") + || serialString.contains("podzol") + || serialString.contains("mycelium") + ) + { + return IrisBlockMaterial.DIRT; + } + else if (this.blockState.is(Blocks.LAVA)) + { + return IrisBlockMaterial.LAVA; + } + #if MC_VER >= MC_1_17_1 + else if (this.blockState.getSoundType() == SoundType.DEEPSLATE + || this.blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS + || this.blockState.getSoundType() == SoundType.DEEPSLATE_TILES + || this.blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE + || serialString.contains("deepslate") ) + { + return IrisBlockMaterial.DEEPSLATE; + } + #endif + else if (this.serialString.contains("snow")) + { + return IrisBlockMaterial.SNOW; + } + else if (serialString.contains("sand")) + { + return IrisBlockMaterial.SAND; + } + else if (serialString.contains("terracotta")) + { + return IrisBlockMaterial.TERRACOTTA; + } + else if (this.blockState.is(BlockTags.BASE_STONE_NETHER)) + { + return IrisBlockMaterial.NETHER_STONE; + } + else if (serialString.contains("stone") + || serialString.contains("ore")) + { + return IrisBlockMaterial.STONE; + } + else if (this.blockState.getLightEmission() > 0) + { + return IrisBlockMaterial.ILLUMINATED; + } + else + { + return IrisBlockMaterial.UNKOWN; + } + } + } 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 6a8ae1318..30eb60581 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 @@ -261,12 +261,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper @Override public int getTargetFrameBuffer() { - int frameBufferOverrideId = DhApiRenderProxy.INSTANCE.targetFrameBufferOverride; - if (frameBufferOverrideId != -1) - { - return frameBufferOverrideId; - } - // used so we can access the framebuffer shaders end up rendering to if (AbstractOptifineAccessor.optifinePresent()) { diff --git a/coreSubProjects b/coreSubProjects index fd80b0add..a07e43ad5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit fd80b0adde7a545f3793729d31e6dce3254300f4 +Subproject commit a07e43ad5ce2fbb0b9107874edae600172229ed8 From a38551b3d0e4f8b06acb3cf363077fedc4d728aa Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Sun, 4 Feb 2024 13:28:52 +1100 Subject: [PATCH 082/301] Disable tests for modloader projects --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index fd98ce39f..be028fe31 100644 --- a/build.gradle +++ b/build.gradle @@ -134,6 +134,16 @@ subprojects { p -> tasks.withType(GenerateModuleMetadata) { enabled = false } + + // Disable testing for projects that isn't the core or api project + if (isMinecraftSubProject) { + test { + enabled = false + } + compileTestJava { + enabled = false + } + } // Set the manifold version (may not be required tough) From 794f524ae335a67013c47926f190eabc111af1d1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 4 Feb 2024 15:52:27 -0600 Subject: [PATCH 083/301] gradle commenting and minor refactoring --- build.gradle | 99 ++++++++++++++++++++++--------------------------- settings.gradle | 10 ++--- 2 files changed, 49 insertions(+), 60 deletions(-) diff --git a/build.gradle b/build.gradle index be028fe31..da1fd718a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,29 +1,31 @@ plugins { id "java" - // Plugin to handle dependencies + // Plugin to put dependencies inside our final jar id "com.github.johnrengelman.shadow" version '7.1.2' apply false // Plugin to create merged jars id "io.github.pacifistmc.forgix" version "1.2.6" - // Manifold preprocessor -// id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" - -// // Provides mc libraries to core -// id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false - - // Use unimined which is our one in all solution to minecraft loaders + // Unimined is our all in one solution to minecraft loaders id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false } + +// Transfers the values set in settings.gradle to the rest of the project +project.gradle.ext.getProperties().each { prop -> + rootProject.ext.set(prop.key, prop.value) +// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" +} + + /** * Creates the list of preprocessors to use. * * @param mcVers array of all MC versions * @param mcIndex array index of the currently active MC version */ -def writeBuildGradlePredefine(List mcVers, int mcIndex) +def writeBuildGradlePredefine(List mcVers, int mcIndex) { // Build the list of preprocessors to use StringBuilder sb = new StringBuilder(); @@ -31,7 +33,7 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) sb.append("# DON'T TOUCH THIS FILE, This is handled by the build script\n"); - for (int i = 0; i < mcVers.size(); i++) + for (int i = 0; i < mcVers.size(); i++) { String verStr = mcVers[i].replace(".", "_"); sb.append("MC_" + verStr + "=" + i.toString() + "\n"); @@ -42,23 +44,15 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) // Check if this is a development build - if (mod_version.toLowerCase().contains("dev")) + if (mod_version.toLowerCase().contains("dev")) { // WARNING: only use this for logging, we don't want to have confusion // when a method doesn't work correctly in the release build. sb.append("DEV_BUILD=\n"); } - + new File(projectDir, "build.properties").text = sb.toString() } - - -// Transfers the values set in settings.gradle to the rest of the project -project.gradle.ext.getProperties().each { prop -> - rootProject.ext.set(prop.key, prop.value) -// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" -} -// Sets up manifold stuff writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex) @@ -66,6 +60,7 @@ writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex) // Sets up the version string (the name we use for our jar) rootProject.versionStr = rootProject.mod_version + "-" + rootProject.minecraft_version // + "-" + new Date().format("yyyy_MM_dd_HH_mm") + // Forgix settings (used for merging jars) forgix { group = "com.seibel.distanthorizons" @@ -96,7 +91,7 @@ forgix { } subprojects { p -> - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverWeAddLaterOn")" + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverLoaderWeAddLaterOn")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") @@ -104,19 +99,17 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" -// if (isMinecraftSubProject) -// apply plugin: "systems.manifold.manifold-gradle-plugin" - if (p == project(":core")) + if (p == project(":core")) { apply plugin: "application" -// apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries + } if (p != project(":common") && isMinecraftSubProject) { apply plugin: "xyz.wagyourtail.unimined" unimined.minecraft(sourceSets.main, true) { - version minecraft_version - - def parchmentVersionParts = parchment_version.split(":") + version = rootProject.minecraft_version + + def parchmentVersionParts = rootProject.parchment_version.split(":") mappings { mojmap() parchment(parchmentVersionParts[0], parchmentVersionParts[1]) @@ -135,7 +128,8 @@ subprojects { p -> enabled = false } - // Disable testing for projects that isn't the core or api project + // Disable testing for projects that aren't the core or api project. + // If not done compiling will fail due to an issue with Manifold if (isMinecraftSubProject) { test { enabled = false @@ -144,13 +138,7 @@ subprojects { p -> enabled = false } } - - - // Set the manifold version (may not be required tough) -// manifold { -// manifoldVersion = rootProject.manifold_version -// } - + // set up custom configurations (configurations are a way to handle dependencies) configurations { @@ -211,7 +199,7 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") - // JOML + // JOML (doesn't have to be shaded in because NightConfig already includes it) implementation("org.joml:joml:${rootProject.joml_version}") // JUnit tests @@ -230,7 +218,7 @@ subprojects { p -> shade("com.electronwill.night-config:json:${rootProject.nightconfig_version}") // SVG (not needed atm) -// shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") + //shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") // Netty // Breaks 1.16.5 @@ -255,6 +243,7 @@ subprojects { p -> exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" + // Removed dependencies transitive false } @@ -267,6 +256,7 @@ subprojects { p -> exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" + // Removed dependencies transitive false } @@ -289,6 +279,7 @@ subprojects { p -> shadowJar { configurations = [project.configurations.shadowMe, project.configurations.shade] + if (isMinecraftSubProject && p != project(":common")) { configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location @@ -298,6 +289,8 @@ subprojects { p -> relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location } } + + def librariesLocation = "distanthorizons.libraries" // LWJGL @@ -341,7 +334,7 @@ subprojects { p -> // The mixins for each of the loaders "DistantHorizons."+ p.name +".fabricLike.mixins.json" ] - def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder + def buildResourceTargets = ["$buildDir/resources/main/"] // Location of the built resources folder // Fix forge version numbering system as it is weird // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] @@ -349,7 +342,7 @@ subprojects { p -> // println compatible_forgemc_versions // Quilt's custom contributors system - // This has to be like + // has to be in the format: // "Person": "Developer", "Another person": "Developer" def quilt_contributors = [] def mod_author_list = mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",") @@ -357,9 +350,9 @@ subprojects { p -> quilt_contributors.push("\"${dev.strip()}\": \"Developer\"") } quilt_contributors.reverse() -// println quilt_contributors.join(", ") + //println quilt_contributors.join(", ") - // TODOI: Find something we can use so we can basically re-map only when the jar is shadowed and relocated + // TODO: Find something we can use so we can basically re-map only when the jar is shadowed and relocated // println p.tasks.findByName('shadowJar') @@ -374,6 +367,7 @@ subprojects { p -> println "Git or Git project not found" } + // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties def replaceProperties = [ version : mod_version, mod_name : mod_readable_name, @@ -397,15 +391,17 @@ subprojects { p -> fabric_incompatibility_list : fabric_incompatibility_list, fabric_recommend_list : fabric_recommend_list, ] - // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties - + + // replace any properties in the sub-projects with the values defined here inputs.properties replaceProperties - replaceProperties.put "project", project + replaceProperties.put("project", project) filesMatching(resourceTargets) { expand replaceProperties } - - intoTargets.each { target -> + + + // copy all our resources into the loader specific resource directory + buildResourceTargets.each { target -> if (file(target).exists()) { copy { from(sourceSets.main.resources) { @@ -462,13 +458,6 @@ subprojects { p -> } } */ - - // Run mergeJars when running build - // TODO: Fix later -// if (isMinecraftSubProject) { -// build.finalizedBy(mergeJars) -// assemble.finalizedBy(mergeJars) -// } } allprojects { p -> @@ -489,7 +478,7 @@ allprojects { p -> javadoc.title = rootProject.mod_name + "-" + project.name // Some annotations arent "technically" part of the official java standard, - // so we define it ourself here + // so we define it ourself here javadoc { configure( options ) { tags( diff --git a/settings.gradle b/settings.gradle index 983b96002..9c9cbd392 100644 --- a/settings.gradle +++ b/settings.gradle @@ -44,12 +44,13 @@ pluginManagement { } plugins { + // handles JVM and toolchain downloading id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' } -// Loads the version.properties +/** Loads the VersionProperties fiel for the currently selected Minecraft version. */ def loadProperties() { def defaultMcVersion = "1.20.1" // 1.20.1 is our current most stable version so we use that if no version was defined @@ -86,7 +87,6 @@ def loadProperties() { gradle.ext.mcVers = mcVers gradle.ext.mcIndex = mcIndex } - loadProperties() @@ -102,9 +102,9 @@ project(":api").projectDir = file('coreSubProjects/api') include("common") // Enables or disables the subprojects depending on whats in the versionProperties/mcVer.properties for (loader in ((String) gradle.builds_for).split(",")) { - def l = loader.strip() // Strip it in case a space is added before or after the comma - println "Adding loader " + l - include(l) + def loaderName = loader.strip() // Strip it in case a space is added before or after the comma + println "Adding loader " + loaderName + include(loaderName) } //if (gradle.builds_for.contains("fabric") || gradle.builds_for.contains("quilt")) // include("fabricLike") From b62af66f4b4fa6ed2e8b08fefdb418dbe4c6ec8c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 4 Feb 2024 16:30:25 -0600 Subject: [PATCH 084/301] rename shadowMe ->shadowCore and shade ->shadowMc --- build.gradle | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index da1fd718a..96c30a3b3 100644 --- a/build.gradle +++ b/build.gradle @@ -143,19 +143,19 @@ subprojects { p -> // set up custom configurations (configurations are a way to handle dependencies) configurations { // extends the shadowJar configuration - shadowMe // Configuration that contains coreProjects - shade // Configuration that doesn't contain coreProjects + shadowCore // Configuration that contains coreProjects + shadowMc // Configuration that doesn't contain coreProjects // have implemented dependencies automatically embedded in the final jar - implementation.extendsFrom(shadowMe) - implementation.extendsFrom(shade) + implementation.extendsFrom(shadowCore) + implementation.extendsFrom(shadowMc) // Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way) - minecraftLibraries.extendsFrom(shade) + minecraftLibraries.extendsFrom(shadowMc) // Configuration fpr core & api coreProjects - shadowMe.extendsFrom(coreProjects) + shadowCore.extendsFrom(coreProjects) if (isMinecraftSubProject && p != project(":common")) { @@ -194,7 +194,7 @@ subprojects { p -> } // Log4j - // TODO: Change to shadowMe later to work in the standalone jar + // TODO: Change to shadowCore later to work in the standalone jar // 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}") @@ -208,24 +208,24 @@ subprojects { p -> implementation("junit:junit:4.13") // Compression - shade("org.lz4:lz4-java:${rootProject.lz4_version}") + shadowMc("org.lz4:lz4-java:${rootProject.lz4_version}") // Sqlite Database - shade("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") + shadowMc("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") // NightConfig (includes Toml & Json) - shade("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") - shade("com.electronwill.night-config:json:${rootProject.nightconfig_version}") + shadowMc("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") + shadowMc("com.electronwill.night-config:json:${rootProject.nightconfig_version}") // SVG (not needed atm) - //shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") + //shadowMc("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") // Netty // Breaks 1.16.5 - //shade("io.netty:netty-all:${rootProject.netty_version}") + //shadowMc("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 - shade("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { + shadowMc("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it } @@ -278,7 +278,7 @@ subprojects { p -> shadowJar { - configurations = [project.configurations.shadowMe, project.configurations.shade] + configurations = [project.configurations.shadowCore, project.configurations.shadowMc] if (isMinecraftSubProject && p != project(":common")) { configurations.push(project.configurations.shadowCommon) // Shadow the common subproject From 838d82589be00bdadd72ea4b51d09b8820ca06ba Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 4 Feb 2024 21:27:22 -0600 Subject: [PATCH 085/301] Fix Forge 1.20.4 compiling, but not gradle running --- forge/build.gradle | 19 ++++++++++++++++++- .../{pack.mcmeta.ignored => pack.mcmeta} | 0 versionProperties/1.20.4.properties | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) rename forge/src/main/resources/{pack.mcmeta.ignored => pack.mcmeta} (100%) diff --git a/forge/build.gradle b/forge/build.gradle index 660022115..5ed383e22 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -73,4 +73,21 @@ sourcesJar { // withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { // skip() // } -//} \ No newline at end of file +//} + + + +// TODO this was specifically added for MC 1.20.4 should it be enabled for anything below MC 1.20.4? +// source: https://github.com/MinecraftForge/MinecraftForge/blob/5d0047753dfac0caaf5d97cc3f5c9a8b0990cb44/mdk/build.gradle#L209-L217 +// +// Merge the resources and classes into the same directory. +// This is done because java expects modules to be in a single directory. +// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem +// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. +sourceSets.each { + def dir = layout.buildDirectory.dir("sourcesSets/$it.name") + //println "source name " + it.name // as of 2024-2-4 "it.name" only returned "main" and "test" + it.output.resourcesDir = dir + it.java.destinationDirectory = dir +} + diff --git a/forge/src/main/resources/pack.mcmeta.ignored b/forge/src/main/resources/pack.mcmeta similarity index 100% rename from forge/src/main/resources/pack.mcmeta.ignored rename to forge/src/main/resources/pack.mcmeta diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 315f01d8d..3efdf77f9 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,neoforge +builds_for=fabric,neoforge,forge # Fabric loader fabric_loader_version=0.15.1 From 32c1cc29f87dc3cc20c487375b99d27189b74bca Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 5 Feb 2024 19:21:52 -0600 Subject: [PATCH 086/301] Fix Render Buffer count F3 menu not closing --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 15ee6a951..30055805d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 15ee6a9512ba5850b606fcd46651cfa2144b9999 +Subproject commit 30055805d8fc90687f71aab20ab86f8cbcbc6ba3 From b878faac96ed9e48cc4e93019952a5569613ab26 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 5 Feb 2024 20:31:05 -0600 Subject: [PATCH 087/301] Improve StepFeatures logging --- .../worldGeneration/step/StepFeatures.java | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) 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 65092f701..dcd46c044 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 @@ -19,24 +19,24 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.step; -import java.util.ArrayList; - import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters; import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.DhLitWorldGenRegion; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.gridList.ArrayGridList; -import net.minecraft.ReportedException; 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_18_2 -#endif +import org.apache.logging.log4j.Logger; + public final class StepFeatures { + private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + public static final ChunkStatus STATUS = ChunkStatus.FEATURES; private final BatchGenerationEnvironment environment; @@ -51,36 +51,44 @@ public final class StepFeatures ThreadedParameters tParams, DhLitWorldGenRegion worldGenRegion, ArrayGridList chunkWrappers) { - ArrayList chunksToDo = new ArrayList(); - for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) continue; - ((ProtoChunk) chunk).setStatus(STATUS); - chunksToDo.add(chunk); - } - - for (ChunkAccess chunk : chunksToDo) - { + if (chunk.getStatus().isOrAfter(STATUS)) + { + continue; + } + + if (chunk instanceof ProtoChunk) + { + ((ProtoChunk) chunk).setStatus(STATUS); + } + + try { #if MC_VER < MC_1_18_2 worldGenRegion.setOverrideCenter(chunk.getPos()); environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat); #else - environment.params.generator.applyBiomeDecoration(worldGenRegion, chunk, - tParams.structFeat.forWorldGenRegion(worldGenRegion)); + if (worldGenRegion.hasChunk(chunkWrapper.getChunkPos().x, chunkWrapper.getChunkPos().z)) + { + this.environment.params.generator.applyBiomeDecoration(worldGenRegion, chunk, tParams.structFeat.forWorldGenRegion(worldGenRegion)); + } + else + { + LOGGER.warn("Unable to generate features for chunk at pos ["+chunkWrapper.getChunkPos()+"], world gen region doesn't contain the chunk."); + } #endif Heightmap.primeHeightmaps(chunk, STATUS.heightmapsAfter()); BatchGenerationEnvironment.clearDistantGenerationMixinData(); } - catch (ReportedException e) + catch (Exception e) { - e.printStackTrace(); + LOGGER.warn("Unexpected issue when generating features for chunk at pos ["+chunkWrapper.getChunkPos()+"], error: ["+e.getMessage()+"].", e); // FIXME: Features concurrent modification issue. Something about cocobeans might just - // error out. For now just retry. + // error out. For now just retry. } } } From 42bcc28d3e02d5512204339c93335bb2b0ad7049 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 5 Feb 2024 21:38:46 -0600 Subject: [PATCH 088/301] Merge branch 'minecraft-lod-mod-frustum.culling' --- .../common/wrappers/McObjectConverter.java | 6 ++++- .../minecraft/MinecraftRenderWrapper.java | 25 ++++++++++++++++--- coreSubProjects | 2 +- .../fabric/FabricClientProxy.java | 2 ++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java index b37282f4d..f9422eba4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java @@ -77,7 +77,11 @@ public class McObjectConverter #endif } - /** 4x4 float matrix converter */ + /** + * 4x4 float matrix converter + * TODO this should be moved into Mat4f's constructor + */ + @Deprecated public static Mat4f Convert(Matrix4f mcMatrix) { FloatBuffer buffer = FloatBuffer.allocate(16); 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 30eb60581..9c4a13f74 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 @@ -21,6 +21,7 @@ package com.seibel.distanthorizons.common.wrappers.minecraft; import java.awt.Color; import java.lang.invoke.MethodHandles; +import java.nio.FloatBuffer; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -40,8 +41,9 @@ import com.seibel.distanthorizons.core.render.DhApiRenderProxy; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; #if MC_VER < MC_1_19_4 -import com.mojang.math.Vector3f; +import org.joml.Vector3f; #else +import org.joml.Matrix4f; import org.joml.Vector3f; #endif #if MC_VER >= MC_1_20_2 @@ -78,6 +80,7 @@ import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import org.apache.logging.log4j.Logger; +import org.joml.Matrix4f; /** @@ -116,8 +119,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper public Vec3f getLookAtVector() { Camera camera = MC.gameRenderer.getMainCamera(); - Vector3f cameraDir = camera.getLookVector(); - return new Vec3f(cameraDir.x(), cameraDir.y(), cameraDir.z()); + return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z()); } @Override @@ -148,6 +150,23 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper return new Vec3d(projectedView.x, projectedView.y, projectedView.z); } + @Override + public Mat4f getWorldViewMatrix() + { + Camera camera = MC.gameRenderer.getMainCamera(); + Vector3f cameraVec3 = new Vector3f( + (float)camera.getPosition().x, + (float)camera.getPosition().y, + (float)camera.getPosition().z); + cameraVec3 = cameraVec3.negate(); + + Matrix4f matWorldView = new Matrix4f() + .rotateX((float)Math.toRadians(camera.getXRot())) + .rotateY((float)Math.toRadians(camera.getYRot() + 180f)) + .translate(cameraVec3); + return McObjectConverter.Convert(matWorldView); + } + @Override public Mat4f getDefaultProjectionMatrix(float partialTicks) { diff --git a/coreSubProjects b/coreSubProjects index 30055805d..06b43d662 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 30055805d8fc90687f71aab20ab86f8cbcbc6ba3 +Subproject commit 06b43d6627914062be3af752e04a4e8e1099bb8c diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index a632c4b3f..931113d95 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -47,7 +47,9 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; +#if MC_VER < MC_1_19_4 import java.nio.FloatBuffer; +#endif import java.util.HashSet; import net.minecraft.client.multiplayer.ClientLevel; From 41f8c8cfa45adcf70588be2a7ee84638ab4c5b6c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 6 Feb 2024 07:17:43 -0600 Subject: [PATCH 089/301] Fix compiling on MC 1.19.2 and below --- .../common/wrappers/McObjectConverter.java | 45 +++++++++---------- .../minecraft/MinecraftRenderWrapper.java | 2 +- coreSubProjects | 2 +- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java index f9422eba4..ebcab8af8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java @@ -23,12 +23,6 @@ import java.nio.FloatBuffer; import java.util.function.BiConsumer; import java.util.function.Consumer; -#if MC_VER < MC_1_19_4 -import com.mojang.math.Matrix4f; -#else -import org.joml.Matrix4f; -#endif - import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.pos.DhBlockPos; import com.seibel.distanthorizons.core.pos.DhChunkPos; @@ -51,8 +45,29 @@ public class McObjectConverter { return y * 4 + x; } + + + /** 4x4 float matrix converter */ + @Deprecated + public static Mat4f Convert( + #if MC_VER < MC_1_19_4 com.mojang.math.Matrix4f + #else org.joml.Matrix4f #endif + mcMatrix) + { + FloatBuffer buffer = FloatBuffer.allocate(16); + storeMatrix(mcMatrix, buffer); + Mat4f matrix = new Mat4f(buffer); + #if MC_VER < MC_1_19_4 + matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it + #endif + return matrix; + } /** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */ - private static void storeMatrix(Matrix4f matrix, FloatBuffer buffer) + private static void storeMatrix( + #if MC_VER < MC_1_19_4 com.mojang.math.Matrix4f + #else org.joml.Matrix4f #endif + matrix, + FloatBuffer buffer) { #if MC_VER < MC_1_19_4 matrix.store(buffer); @@ -77,22 +92,6 @@ public class McObjectConverter #endif } - /** - * 4x4 float matrix converter - * TODO this should be moved into Mat4f's constructor - */ - @Deprecated - public static Mat4f Convert(Matrix4f mcMatrix) - { - FloatBuffer buffer = FloatBuffer.allocate(16); - storeMatrix(mcMatrix, buffer); - Mat4f matrix = new Mat4f(buffer); - #if MC_VER < MC_1_19_4 - matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it - #endif - return matrix; - } - static final Direction[] directions; static final EDhDirection[] lodDirections; 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 9c4a13f74..b1a2a0604 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 @@ -164,7 +164,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper .rotateX((float)Math.toRadians(camera.getXRot())) .rotateY((float)Math.toRadians(camera.getYRot() + 180f)) .translate(cameraVec3); - return McObjectConverter.Convert(matWorldView); + return new Mat4f(matWorldView); } @Override diff --git a/coreSubProjects b/coreSubProjects index 06b43d662..bc1a4ec13 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 06b43d6627914062be3af752e04a4e8e1099bb8c +Subproject commit bc1a4ec1389aebab233961cfe8e2be8879e15ee8 From 4764f0969abc33a066045bb5f4210febd4342271 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 6 Feb 2024 17:49:08 -0600 Subject: [PATCH 090/301] Fix assertion errors in the end --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index bc1a4ec13..f6e2f2f52 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit bc1a4ec1389aebab233961cfe8e2be8879e15ee8 +Subproject commit f6e2f2f52ac4ffa5dabc280db97202fb566d0406 From 733fb8e8714a1554a458ef7a096fe3e661ac7d62 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 6 Feb 2024 19:23:56 -0600 Subject: [PATCH 091/301] Merge branch 'minecraft-lod-mod-shadow.frustum.culling' --- coreSubProjects | 2 +- .../java/com/seibel/distanthorizons/fabric/FabricMain.java | 4 ++-- .../fabric/wrappers/modAccessor/IrisAccessor.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index f6e2f2f52..9392decd3 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f6e2f2f52ac4ffa5dabc280db97202fb566d0406 +Subproject commit 9392decd3502c2d1e00cc0085e3156f82b9dfcf5 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 2de23a193..73ef942b3 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -87,8 +87,8 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti this.tryCreateModCompatAccessor("starlight", IStarlightAccessor.class, StarlightAccessor::new); this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new); - #if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1 - // 1.17.1 won't support this since there isn't a matching Iris version + #if MC_VER >= MC_1_19_4 + // 1.19.4 is the lowest version Iris supports DH this.tryCreateModCompatAccessor("iris", IIrisAccessor.class, IrisAccessor::new); #endif } diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java index 53edafd5e..cc0a7216a 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; -#if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1 +#if MC_VER >= MC_1_19_4 import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; import net.coderbot.iris.Iris; From dd341c9a22e939f98086a3adb78a377e8d7a1ff6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 6 Feb 2024 21:45:12 -0600 Subject: [PATCH 092/301] Add frustum culling config control to the API --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 9392decd3..223326afe 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9392decd3502c2d1e00cc0085e3156f82b9dfcf5 +Subproject commit 223326afe2ace97164d5984459ea9e0a2e9e42f5 From 08c31e5999dbde96033c72d5dda32eedb6fd9ca5 Mon Sep 17 00:00:00 2001 From: coolGi Date: Wed, 7 Feb 2024 23:23:07 +1030 Subject: [PATCH 093/301] Fixed mod auto-updating on quilt --- coreSubProjects | 2 +- .../fabric/wrappers/modAccessor/ModChecker.java | 8 ++++++++ .../forge/wrappers/modAccessor/ModChecker.java | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 223326afe..556550fea 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 223326afe2ace97164d5984459ea9e0a2e9e42f5 +Subproject commit 556550fea802c5e7ad526204a40916ba9b698ad0 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/ModChecker.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/ModChecker.java index 1e4d15622..dcd7d7fd7 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/ModChecker.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/ModChecker.java @@ -22,6 +22,8 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import net.fabricmc.loader.api.FabricLoader; +import java.io.File; + public class ModChecker implements IModChecker { public static final ModChecker INSTANCE = new ModChecker(); @@ -32,4 +34,10 @@ public class ModChecker implements IModChecker return FabricLoader.getInstance().isModLoaded(modid); } + @Override + public File modLocation(String modid) + { + return new File(FabricLoader.getInstance().getModContainer(modid).get().getOrigin().getPaths().get(0).toUri()); + } + } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java b/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java index 4475c6900..1125b4240 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/ModChecker.java @@ -22,6 +22,8 @@ package com.seibel.distanthorizons.forge.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import net.minecraftforge.fml.ModList; +import java.io.File; + public class ModChecker implements IModChecker { public static final ModChecker INSTANCE = new ModChecker(); @@ -32,4 +34,10 @@ public class ModChecker implements IModChecker return ModList.get().isLoaded(modid); } + @Override + public File modLocation(String modid) + { + return ModList.get().getModFileById(modid).getFile().getFilePath().toFile(); + } + } From f17bc1eccd65f803b41b352351645e87a1ce68d0 Mon Sep 17 00:00:00 2001 From: coolGi Date: Wed, 7 Feb 2024 23:32:33 +1030 Subject: [PATCH 094/301] Fixed JOML not being shadowed (not being included in the jar) --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f6a938675..d995fbf11 100644 --- a/build.gradle +++ b/build.gradle @@ -200,7 +200,7 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") // JOML - implementation("org.joml:joml:${rootProject.joml_version}") + forgeShadowMe("org.joml:joml:${rootProject.joml_version}") // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") @@ -298,6 +298,9 @@ subprojects { p -> // 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 + relocate "org.joml", "${librariesLocation}.joml" // NightConfig (includes Toml & Json) relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" From c578ae0fa458a1784ba4dd95848f15e5ae80aff3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 7 Feb 2024 07:06:39 -0600 Subject: [PATCH 095/301] Add Lod Shading to the api config --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 556550fea..b255e0ac6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 556550fea802c5e7ad526204a40916ba9b698ad0 +Subproject commit b255e0ac686a10a1486513eaf491e489d31682cf From aa084c885d61abbff1009604dc18142254bf5070 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 7 Feb 2024 07:34:49 -0600 Subject: [PATCH 096/301] Attempt to reduce queuing duplicate world gen tasks --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b255e0ac6..2651e3d43 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b255e0ac686a10a1486513eaf491e489d31682cf +Subproject commit 2651e3d43590637914e068e4a53a62b6407ed84d From 0ccdcfbb6d3e8918cb15be7010be6366cc8c7676 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 7 Feb 2024 18:19:41 -0600 Subject: [PATCH 097/301] Fix 1.20.4 compling --- .../neoforge/wrappers/modAccessor/ModChecker.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java index 775869e49..6494d6edf 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/wrappers/modAccessor/ModChecker.java @@ -22,14 +22,22 @@ package com.seibel.distanthorizons.neoforge.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; import net.neoforged.fml.ModList; +import java.io.File; + public class ModChecker implements IModChecker { public static final ModChecker INSTANCE = new ModChecker(); @Override - public boolean isModLoaded(String modid) + public boolean isModLoaded(String modid) { - return ModList.get().isLoaded(modid); + return ModList.get().isLoaded(modid); + } + + @Override + public File modLocation(String modid) + { + return ModList.get().getModFileById(modid).getFile().getFilePath().toFile(); } } From 6a6a87a3f772fd55b9b6573784672db2de889cfc Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 8 Feb 2024 17:47:13 +1030 Subject: [PATCH 098/301] Fixed joml being embedded on versions where mc already embeds it --- build.gradle | 8 ++++++-- versionProperties/1.16.5.properties | 1 + versionProperties/1.17.1.properties | 1 + versionProperties/1.18.2.properties | 1 + versionProperties/1.19.2.properties | 1 + versionProperties/1.19.4.properties | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index d995fbf11..f0261f6b9 100644 --- a/build.gradle +++ b/build.gradle @@ -200,7 +200,10 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") // JOML - forgeShadowMe("org.joml:joml:${rootProject.joml_version}") + if (project.hasProperty("embed_joml") && embed_joml == "true") + forgeShadowMe("org.joml:joml:${rootProject.joml_version}") + else + implementation("org.joml:joml:${rootProject.joml_version}") // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") @@ -300,7 +303,8 @@ subprojects { p -> // relocate "org.sqlite", "${librariesLocation}.sqlite" // JOML - relocate "org.joml", "${librariesLocation}.joml" + if (project.hasProperty("embed_joml") && embed_joml == "true") + relocate "org.joml", "${librariesLocation}.joml" // NightConfig (includes Toml & Json) relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index dc8d54645..dae7f1dc0 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -5,6 +5,7 @@ parchment_version=1.16.5:2022.03.06 compatible_minecraft_versions=["1.16.4", "1.16.5"] accessWidenerVersion=1_16 builds_for=fabric,forge +embed_joml=true # Fabric loader fabric_loader_version=0.14.24 diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 44be229a8..4b5b8dfc9 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -5,6 +5,7 @@ parchment_version=1.17.1:2021.12.12 compatible_minecraft_versions=["1.17", "1.17.1"] accessWidenerVersion=1_17 builds_for=fabric,forge +embed_joml=true # Fabric loader fabric_loader_version=0.14.24 diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index e987c439f..e168e4f1b 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -5,6 +5,7 @@ parchment_version=1.18.2:2022.11.06 compatible_minecraft_versions=["1.18.2"] accessWidenerVersion=1_18 builds_for=fabric,forge +embed_joml=true # Fabric loader fabric_loader_version=0.14.24 diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index c4fe3195f..34e38b150 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -5,6 +5,7 @@ parchment_version=1.19.2:2022.11.27 compatible_minecraft_versions=["1.19.2"] accessWidenerVersion=1_19_2 builds_for=fabric,forge +embed_joml=true # Fabric loader fabric_loader_version=0.14.24 diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index c3a91dfda..0d0691a44 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -5,6 +5,7 @@ parchment_version=1.19.4:2023.06.26 compatible_minecraft_versions=["1.19.4"] accessWidenerVersion=1_19_4 builds_for=fabric,forge +embed_joml=true # Fabric loader fabric_loader_version=0.14.24 From 3bba08723ff1f00e10faf1f22457b2881e12bc2f Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 8 Feb 2024 10:28:33 +0000 Subject: [PATCH 099/301] joml is included in vanilla 1.19.4 --- versionProperties/1.19.4.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index 0d0691a44..c3a91dfda 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -5,7 +5,6 @@ parchment_version=1.19.4:2023.06.26 compatible_minecraft_versions=["1.19.4"] accessWidenerVersion=1_19_4 builds_for=fabric,forge -embed_joml=true # Fabric loader fabric_loader_version=0.14.24 From 0ebe8db2688f7f24b46944839463203808d5e4b5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 10 Feb 2024 21:38:44 -0600 Subject: [PATCH 100/301] Add IDhApiShadowCullingFrustum and a config for shadow culling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 2651e3d43..b4269afc9 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2651e3d43590637914e068e4a53a62b6407ed84d +Subproject commit b4269afc9fba5cfeb1a619ae4a9de8c90f019fde From ec8d1b5538fe7fe047992f77be9da4c41516a3c6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 10 Feb 2024 21:38:55 -0600 Subject: [PATCH 101/301] Fix Lava Iris block material ID --- .../common/wrappers/block/BlockStateWrapper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 3e3fbd24e..e44a30e0a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -489,6 +489,10 @@ public class BlockStateWrapper implements IBlockStateWrapper { return IrisBlockMaterial.LEAVES; } + else if (this.blockState.is(Blocks.LAVA)) + { + return IrisBlockMaterial.LAVA; + } else if (this.isLiquid() || this.blockState.is(Blocks.WATER)) { return IrisBlockMaterial.WATER; @@ -524,10 +528,6 @@ public class BlockStateWrapper implements IBlockStateWrapper ) { return IrisBlockMaterial.DIRT; - } - else if (this.blockState.is(Blocks.LAVA)) - { - return IrisBlockMaterial.LAVA; } #if MC_VER >= MC_1_17_1 else if (this.blockState.getSoundType() == SoundType.DEEPSLATE From 8a5bca3136b0753291873d9bb084dbe96af6e772 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 10 Feb 2024 21:58:24 -0600 Subject: [PATCH 102/301] Fix using the wrong near clip plane --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b4269afc9..97e7f0563 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b4269afc9fba5cfeb1a619ae4a9de8c90f019fde +Subproject commit 97e7f0563640465c089625990e687fd9de8d6fb4 From 91ac4309df130668f327dc2f689e2e3689b1b2e4 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 10 Feb 2024 22:02:19 -0600 Subject: [PATCH 103/301] Fix the API seeing the wrong far clip plane --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 97e7f0563..c71873310 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 97e7f0563640465c089625990e687fd9de8d6fb4 +Subproject commit c718733104e77e3e5284193e891d17dd140909ce From 56167a137e39af5b41ab1b9eabe1e036d63944c9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Feb 2024 14:56:16 -0600 Subject: [PATCH 104/301] Default to no culling for the shadow pass --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index c71873310..cc134092e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c718733104e77e3e5284193e891d17dd140909ce +Subproject commit cc134092ed8d92ed73fefcc92c1d6e1fcffd1c0e From e87823aa29c95dabfd614ef9de2b232b68bbe432 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Feb 2024 16:39:29 -0600 Subject: [PATCH 105/301] Close #615 (lag when rapidly breaking/placing blocks) --- coreSubProjects | 2 +- .../fabric/FabricClientProxy.java | 52 +++++++++++-------- .../forge/ForgeClientProxy.java | 10 ++++ .../neoforge/NeoforgeClientProxy.java | 10 ++++ 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index cc134092e..b8f90ddc5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit cc134092ed8d92ed73fefcc92c1d6e1fcffd1c0e +Subproject commit b8f90ddc551302b5b9202375e1cc4b14e4e49cfc diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 931113d95..d9216458d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -32,6 +32,8 @@ import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.pos.DhBlockPos; +import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; @@ -123,17 +125,20 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy // if we have access to the server, use the chunk save event instead if (MC.clientConnectedToDedicatedServer()) { - // Since fabric doesn't have a client-side break-block API event, this is the next best thing - ChunkAccess chunk = level.getChunk(blockPos); - if (chunk != null) + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(blockPos.getX(), blockPos.getZ())) { - LOGGER.trace("attack block at blockPos: " + blockPos); - - IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); - SharedApi.INSTANCE.chunkBlockChangedEvent( - new ChunkWrapper(chunk, level, wrappedLevel), - wrappedLevel - ); + // Since fabric doesn't have a client-side break-block API event, this is the next best thing + ChunkAccess chunk = level.getChunk(blockPos); + if (chunk != null) + { + LOGGER.trace("attack block at blockPos: " + blockPos); + + IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); + SharedApi.INSTANCE.chunkBlockChangedEvent( + new ChunkWrapper(chunk, level, wrappedLevel), + wrappedLevel + ); + } } } @@ -147,20 +152,23 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy // if we have access to the server, use the chunk save event instead if (MC.clientConnectedToDedicatedServer()) { - // Since fabric doesn't have a client-side place-block API event, this is the next best thing - if (hitResult.getType() == HitResult.Type.BLOCK - && !hitResult.isInside()) + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(hitResult.getBlockPos().getX(), hitResult.getBlockPos().getZ())) { - ChunkAccess chunk = level.getChunk(hitResult.getBlockPos()); - if (chunk != null) + // Since fabric doesn't have a client-side place-block API event, this is the next best thing + if (hitResult.getType() == HitResult.Type.BLOCK + && !hitResult.isInside()) { - LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos()); - - IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); - SharedApi.INSTANCE.chunkBlockChangedEvent( - new ChunkWrapper(chunk, level, wrappedLevel), - wrappedLevel - ); + ChunkAccess chunk = level.getChunk(hitResult.getBlockPos()); + if (chunk != null) + { + LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos()); + + IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); + SharedApi.INSTANCE.chunkBlockChangedEvent( + new ChunkWrapper(chunk, level, wrappedLevel), + wrappedLevel + ); + } } } } 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 469f7b134..9b1b03c49 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -173,6 +173,11 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy @SubscribeEvent public void rightClickBlockEvent(PlayerInteractEvent.RightClickBlock event) { + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(event.getPos().getX(), event.getPos().getZ())) + { + return; + } + LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); #if MC_VER < MC_1_19_2 @@ -187,6 +192,11 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy @SubscribeEvent public void leftClickBlockEvent(PlayerInteractEvent.LeftClickBlock event) { + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(event.getPos().getX(), event.getPos().getZ())) + { + return; + } + LOGGER.trace("break or block attack at blockPos: " + event.getPos()); #if MC_VER < MC_1_19_2 diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index d46be455c..69da1d5e1 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -146,6 +146,11 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy @SubscribeEvent public void rightClickBlockEvent(PlayerInteractEvent.RightClickBlock event) { + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(event.getPos().getX(), event.getPos().getZ())) + { + return; + } + LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); LevelAccessor level = event.getLevel(); @@ -156,6 +161,11 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy @SubscribeEvent public void leftClickBlockEvent(PlayerInteractEvent.LeftClickBlock event) { + if (SharedApi.isChunkAtBlockPosAlreadyUpdating(event.getPos().getX(), event.getPos().getZ())) + { + return; + } + LOGGER.trace("break or block attack at blockPos: " + event.getPos()); LevelAccessor level = event.getLevel(); From f4f234a159431431317e3e0edbdfade3969572b4 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Feb 2024 18:29:51 -0600 Subject: [PATCH 106/301] Fix NeverCullFrustum casting error --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b8f90ddc5..7df442878 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b8f90ddc551302b5b9202375e1cc4b14e4e49cfc +Subproject commit 7df442878dc533a4b85623c9bb5dd416e401b2b9 From 2da444d03cef5dc89abc4ddd5005207396269327 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Feb 2024 20:24:36 -0600 Subject: [PATCH 107/301] Fix BiomeWrapper warning about null level on startup --- .../common/wrappers/block/BiomeWrapper.java | 10 ++++++++-- coreSubProjects | 2 +- 2 files changed, 9 insertions(+), 3 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 843817892..9cbdd9816 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 @@ -65,7 +65,7 @@ public class BiomeWrapper implements IBiomeWrapper #endif public static final String EMPTY_STRING = "EMPTY"; - public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); + public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(); /** keep track of broken biomes so we don't log every time */ private static final HashSet brokenResourceLocationStrings = new HashSet<>(); @@ -115,7 +115,6 @@ public class BiomeWrapper implements IBiomeWrapper return newWrapper; } } - private BiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) { this.biome = biome; @@ -123,6 +122,13 @@ public class BiomeWrapper implements IBiomeWrapper LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]"); } + /** should only be used to create {@link BiomeWrapper#EMPTY_WRAPPER} */ + private BiomeWrapper() + { + this.biome = null; + this.serialString = EMPTY_STRING; + } + //=========// diff --git a/coreSubProjects b/coreSubProjects index 7df442878..5c30d077d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7df442878dc533a4b85623c9bb5dd416e401b2b9 +Subproject commit 5c30d077ddf6cf21e5ba2b47c18a2c98d3d15738 From 4e6e727799460c0c560bd8b5f7c4e9e5da4e5ef6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Feb 2024 21:32:08 -0600 Subject: [PATCH 108/301] Fix ocean floors showing at very low detail levels Partially fixes #632 --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 5c30d077d..d7c96bbba 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 5c30d077ddf6cf21e5ba2b47c18a2c98d3d15738 +Subproject commit d7c96bbba4895009f851c0affe1ab6ed6d8395be From 2e7cc9f4b634a46716f52221b9ccec161c8c40e8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 13 Feb 2024 07:53:08 -0600 Subject: [PATCH 109/301] Temp fix for near clip plane going too far in some cases --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index d7c96bbba..cd20fb1e3 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit d7c96bbba4895009f851c0affe1ab6ed6d8395be +Subproject commit cd20fb1e345f0661af0b9e9b3bb242c04ba8cf18 From 761f802ced9ee9677f34fdae7db312f2dee1bb1d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 15 Feb 2024 20:36:41 -0600 Subject: [PATCH 110/301] Fix fog rendering --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index cd20fb1e3..6fcdde8a9 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit cd20fb1e345f0661af0b9e9b3bb242c04ba8cf18 +Subproject commit 6fcdde8a9f6dcbe7185e2a21ae694d3b8e69b481 From a6143780fa10a242b56231d653b77d1eba89a64e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 15 Feb 2024 21:45:11 -0600 Subject: [PATCH 111/301] Fix C2ME file loading --- .../BatchGenerationEnvironment.java | 25 +++++ .../RegionFileStorageExternalCache.java | 6 ++ .../fabric/mixins/server/MixinChunkMap.java | 102 ++++++++++-------- 3 files changed, 87 insertions(+), 46 deletions(-) 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 bed2582a3..26f49ee4c 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 @@ -70,6 +70,7 @@ 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; +import net.minecraft.world.level.chunk.storage.IOWorker; import net.minecraft.world.level.chunk.storage.RegionFileStorage; import net.minecraft.world.level.levelgen.DebugLevelSource; import net.minecraft.world.level.levelgen.FlatLevelSource; @@ -388,6 +389,30 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv // it can throw EOFExceptions that are caught and logged by Minecraft //chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos); + IOWorker ioWorker = this.params.level.getChunkSource().chunkMap.worker; + + #if MC_VER <= MC_1_18_2 + chunkData = ioWorker.load(chunkPos); + #else + + // 10 second timeout should prevent locking up the thread if the ioWorker dies or has issues + int maxGetTimeInMs = 10_000; + CompletableFuture> future = ioWorker.loadAsync(chunkPos); + try + { + Optional data = future.get(maxGetTimeInMs, TimeUnit.MILLISECONDS); + if (data.isPresent()) + { + chunkData = data.get(); + } + } + catch (Exception e) + { + LOAD_LOGGER.warn("Unable to get chunk at pos ["+chunkPos+"] after ["+maxGetTimeInMs+"] milliseconds.", e); + future.cancel(true); + } + #endif + RegionFileStorage storage = this.params.level.getChunkSource().chunkMap.worker.storage; RegionFileStorageExternalCache cache = this.getOrCreateRegionFileCache(storage); chunkData = cache.read(chunkPos); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index bcdd6f5ab..a181e2253 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -17,6 +17,12 @@ import java.nio.file.Path; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; +/** + * @deprecated should be replaced with net.minecraft.world.level.chunk.storage.IOWorker to + * prevent potential file corruption and issues with the C2ME mod. + * Generally this would be done via (MC ServerLevel) level.getChunkSource().chunkMap.worker#loadAsync() + */ +@Deprecated public class RegionFileStorageExternalCache implements AutoCloseable { private static final Logger LOGGER = DhLoggerBuilder.getLogger(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java index 617a8aaf0..ffef0238c 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java @@ -28,56 +28,66 @@ public class MixinChunkMap @Final ServerLevel level; - @Inject(method = "save", at = @At(value = "INVOKE", target = CHUNK_SERIALIZER_WRITE)) + // firing at INVOKE causes issues with C2ME and is probably unnecessary since we + // don't need the chunk(s) before MC has finished saving them + @Inject(method = "save", at = @At(value = "RETURN", target = CHUNK_SERIALIZER_WRITE)) private void onChunkSave(ChunkAccess chunk, CallbackInfoReturnable ci) { - //=====================================// - // corrupt/incomplete chunk validation // - //=====================================// - - // MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks) - // this logic should prevent that from happening - #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 - if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect()) + // true means a chunk was saved to disk + if (ci.getReturnValue()) { - return; + // TODO is this validation necessary since we are checking above if + // the callback return value should state if the chunk was actually saved or not? + // Do we trust it to always be correct? + + //=====================================// + // corrupt/incomplete chunk validation // + //=====================================// + + // MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks) + // this logic should prevent that from happening + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect()) + { + return; + } + #else + if (chunk.isUnsaved() || chunk.isUpgrading() || !chunk.isLightCorrect()) + { + return; + } + #endif + + + //==================// + // biome validation // + //==================// + + // some chunks may be missing their biomes, which cause issues when attempting to save them + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + if (chunk.getBiomes() == null) + { + return; + } + #else + try + { + // this will throw an exception if the biomes aren't set up + chunk.getNoiseBiome(0,0,0); + } + catch (Exception e) + { + return; + } + #endif + + + + ServerApi.INSTANCE.serverChunkSaveEvent( + new ChunkWrapper(chunk, this.level, ServerLevelWrapper.getWrapper(this.level)), + ServerLevelWrapper.getWrapper(this.level) + ); } - #else - if (chunk.isUnsaved() || chunk.isUpgrading() || !chunk.isLightCorrect()) - { - return; - } - #endif - - - //==================// - // biome validation // - //==================// - - // some chunks may be missing their biomes, which cause issues when attempting to save them - #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 - if (chunk.getBiomes() == null) - { - return; - } - #else - try - { - // this will throw an exception if the biomes aren't set up - chunk.getNoiseBiome(0,0,0); - } - catch (Exception e) - { - return; - } - #endif - - - - ServerApi.INSTANCE.serverChunkSaveEvent( - new ChunkWrapper(chunk, this.level, ServerLevelWrapper.getWrapper(this.level)), - ServerLevelWrapper.getWrapper(this.level) - ); } } From 0a11f310cfcbbf4a50ca8f51d3c87cb370c3439c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 15 Feb 2024 21:54:33 -0600 Subject: [PATCH 112/301] Revert Fog near end/far start distance to pre-RenderUtil fix --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 6fcdde8a9..f37ed0ccc 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 6fcdde8a9f6dcbe7185e2a21ae694d3b8e69b481 +Subproject commit f37ed0cccf3c3a60630b8263392fcb6d32f57fb7 From 7265e2b631c3a61189d21590008fcf5794ce861b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 16 Feb 2024 20:04:46 -0600 Subject: [PATCH 113/301] add chunk read timeout config and remove duplicate RegionFileStorageExternalCache --- .../BatchGenerationEnvironment.java | 30 +++++++++++-------- coreSubProjects | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) 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 26f49ee4c..de268a590 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 @@ -382,25 +382,27 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv { ServerLevel level = this.params.level; + + + //====================// + // get the chunk data // + //====================// + CompoundTag chunkData = null; try { - // Warning: if multiple threads attempt to access this method at the same time, - // it can throw EOFExceptions that are caught and logged by Minecraft - //chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos); - - IOWorker ioWorker = this.params.level.getChunkSource().chunkMap.worker; + IOWorker ioWorker = level.getChunkSource().chunkMap.worker; #if MC_VER <= MC_1_18_2 chunkData = ioWorker.load(chunkPos); #else - // 10 second timeout should prevent locking up the thread if the ioWorker dies or has issues - int maxGetTimeInMs = 10_000; + // timeout should prevent locking up the thread if the ioWorker dies or has issues + int maxGetTimeInSec = Config.Client.Advanced.WorldGenerator.worldGenerationTimeoutLengthInSeconds.get(); CompletableFuture> future = ioWorker.loadAsync(chunkPos); try { - Optional data = future.get(maxGetTimeInMs, TimeUnit.MILLISECONDS); + Optional data = future.get(maxGetTimeInSec, TimeUnit.SECONDS); if (data.isPresent()) { chunkData = data.get(); @@ -408,20 +410,22 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } catch (Exception e) { - LOAD_LOGGER.warn("Unable to get chunk at pos ["+chunkPos+"] after ["+maxGetTimeInMs+"] milliseconds.", e); + LOAD_LOGGER.warn("Unable to get chunk at pos ["+chunkPos+"] after ["+maxGetTimeInSec+"] milliseconds.", e); future.cancel(true); } #endif - - RegionFileStorage storage = this.params.level.getChunkSource().chunkMap.worker.storage; - RegionFileStorageExternalCache cache = this.getOrCreateRegionFileCache(storage); - chunkData = cache.read(chunkPos); } catch (Exception e) { LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Error: " + e.getMessage(), e); } + + + //========================// + // convert the chunk data // + //========================// + if (chunkData == null) { return EmptyChunk(level, chunkPos); diff --git a/coreSubProjects b/coreSubProjects index f37ed0ccc..7826d756d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f37ed0cccf3c3a60630b8263392fcb6d32f57fb7 +Subproject commit 7826d756d0a882eedfb033882ade06aaf4cbf7ab From c84aac7e45ad88ed4385f9805bbdad06e5b5983c Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 11:59:02 +1030 Subject: [PATCH 114/301] Fixed resources in forge --- .gitlab-ci.yml | 4 ++++ build.gradle | 34 +++++++--------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef07d29c4..79afe1193 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,12 +47,16 @@ build: exclude: # TODO: There is a lot of duplicate stuff here, try to maybe make it smaller - fabric/build/libs/*-all.jar + - fabric/build/libs/*-dev.jar - fabric/build/libs/*-sources.jar - quilt/build/libs/*-all.jar + - quilt/build/libs/*-dev.jar - quilt/build/libs/*-sources.jar - forge/build/libs/*-all.jar + - forge/build/libs/*-dev.jar - forge/build/libs/*-sources.jar - neoforge/build/libs/*-all.jar + - neoforge/build/libs/*-dev.jar - neoforge/build/libs/*-sources.jar expire_in: 14 days when: always diff --git a/build.gradle b/build.gradle index ac073fc65..8a319feb2 100644 --- a/build.gradle +++ b/build.gradle @@ -164,13 +164,6 @@ subprojects { p -> shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. implementation.extendsFrom common implementation.extendsFrom coreProjects - - if (findProject(":fabricLike") && p != project(":fabricLike")) { - // Shadow fabricLike - fabricLike - shadowFabricLike - implementation.extendsFrom fabricLike - } } } @@ -267,12 +260,6 @@ subprojects { p -> // Common common(project(":common")) { transitive false } shadowCommon(project(":common")) { transitive false } - - // FabricLike - if (findProject(":fabricLike") && p != project(":fabricLike")) { - fabricLike(project(path: ":fabricLike")) { transitive false } - shadowFabricLike(project(path: ":fabricLike")) { transitive false } - } } } @@ -283,11 +270,6 @@ subprojects { p -> if (isMinecraftSubProject && p != project(":common")) { configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location - - if (findProject(":fabricLike") && p != project(":fabricLike")) { - configurations.push(project.configurations.shadowFabricLike) // Shadow the fabricLike subproject - relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location - } } @@ -324,7 +306,13 @@ subprojects { p -> // Put stuff from gradle.properties into the mod info processResources { - def resourceTargets = [ // Location of where to inject the properties + // Include all the resources + from project(":common").sourceSets.main.resources + from project(":core").sourceSets.main.resources + from project(":api").sourceSets.main.resources + + // Location of where to inject the properties + def resourceTargets = [ // Holds info like git commit // TODO: For some reason this script doesnt work with the core project "build_info.json", @@ -604,14 +592,6 @@ allprojects { p -> from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") into(file(p.file("build/resources/main"))) rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" - - - // Move the fabricLike mixin to its different places for each subproject - if (findProject(":fabricLike")) { - from project(":fabricLike").file("src/main/resources/DistantHorizons.fabricLike.mixins.json") - into(file(p.file("build/resources/main"))) - rename "DistantHorizons.fabricLike.mixins.json", "DistantHorizons." + p.name + ".fabricLike.mixins.json" - } } task copyCoreResources(type: Copy) { From f93e648f6963666a16452ceafcd2310f5c00a302 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 12:19:34 +1030 Subject: [PATCH 115/301] Added a small error if the user forgot to clone the sub-project, and some extra comments --- build.gradle | 10 +++++++++- settings.gradle | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4ef2058ef..5cda8f19a 100644 --- a/build.gradle +++ b/build.gradle @@ -313,10 +313,17 @@ subprojects { p -> // Put stuff from gradle.properties into the mod info processResources { + duplicatesStrategy = DuplicatesStrategy.WARN // Include all the resources from project(":common").sourceSets.main.resources from project(":core").sourceSets.main.resources from project(":api").sourceSets.main.resources + + // Copy accessWideners + // FIXME: remove copyCommonLoaderResources and use this instead (and if you are removing that task, also remove copyCoreResources while your at it) +// from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") +// into(file(p.file("build/resources/main"))) +// rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" // Location of where to inject the properties def resourceTargets = [ @@ -476,7 +483,7 @@ allprojects { p -> javadoc.title = rootProject.mod_name + "-" + project.name // Some annotations arent "technically" part of the official java standard, - // so we define it ourself here + // so we define it ourself here javadoc { configure( options ) { tags( @@ -563,6 +570,7 @@ allprojects { p -> // Set the OS lwjgl is using to the current os project.ext.lwjglNatives = "natives-" + os.toFamilyName() + // TODO: Include Minecraft in core-projects but dont include MC code stuff dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core // Imports most of lwjgl's libraries (well, only the ones that we need) implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions diff --git a/settings.gradle b/settings.gradle index 9c9cbd392..8579a3916 100644 --- a/settings.gradle +++ b/settings.gradle @@ -50,6 +50,21 @@ plugins { +// Throw an error and a little help message if the user forgot to clone the core sub-project +if (!file("./coreSubProjects/LICENSE.txt").exists()) { // the LICENCE.txt file should always, and only exist if the core-sub-project was cloned + println(''' +It seems that the core sub project was not included... + please make sure that when you were cloning the repo, you were using the `--recurse-submodules` flag on git. + and if its too late now to re-clone the project, please grab the core sub project in whatever way you can from https://gitlab.com/jeseibel/distant-horizons-core.git + +If you still need help with compiling, please read the Readme.md + ''') + throw new GradleException("coreSubProject not found") +} + + + + /** Loads the VersionProperties fiel for the currently selected Minecraft version. */ def loadProperties() { def defaultMcVersion = "1.20.1" // 1.20.1 is our current most stable version so we use that if no version was defined From 32a256619f5df55bcf6e7dfc4ee0dc4f328dd304 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 14:00:34 +1030 Subject: [PATCH 116/301] Fixed using wrong implementation for joml --- build.gradle | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 5cda8f19a..dc29939fd 100644 --- a/build.gradle +++ b/build.gradle @@ -192,19 +192,17 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") - // JOML - if (project.hasProperty("embed_joml") && embed_joml == "true") - forgeShadowMe("org.joml:joml:${rootProject.joml_version}") - else - implementation("org.joml:joml:${rootProject.joml_version}") // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") - + // JOML - shadowMc("org.joml:joml:${rootProject.joml_version}") + if (project.hasProperty("embed_joml") && embed_joml == "true") + shadowMc("org.joml:joml:${rootProject.joml_version}") + else + implementation("org.joml:joml:${rootProject.joml_version}") // Compression shadowMc("org.lz4:lz4-java:${rootProject.lz4_version}") From 5cc7bebbe5ac22d752d89b260dfd802905102b80 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 17 Feb 2024 22:34:06 -0600 Subject: [PATCH 117/301] Update forge 1.20.4 49.0.16 -> 49.0.30 --- versionProperties/1.20.4.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 3efdf77f9..0d0b115c2 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -37,7 +37,7 @@ fabric_api_version=0.91.2+1.20.4 enable_canvas=0 # (Neo)Forge loader -forge_version=49.0.16 +forge_version=49.0.30 neoforge_version=118-beta # (Neo)Forge mod versions starlight_version_forge= From a0935249390ddd1ae0f749cfe5babafe55304069 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 17 Feb 2024 22:34:18 -0600 Subject: [PATCH 118/301] Fix Forge 1.20.4 gradle run --- coreSubProjects | 2 +- forge/build.gradle | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 7826d756d..045c9f46d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7826d756d0a882eedfb033882ade06aaf4cbf7ab +Subproject commit 045c9f46d2cb623612428ca7e9e76f0e428cf188 diff --git a/forge/build.gradle b/forge/build.gradle index 5ed383e22..2aee85b34 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -36,15 +36,25 @@ dependencies { // } } -task deleteResources(type: Delete) { - delete file("build/resources/main") -} - tasks.register('copyAllResources') { dependsOn(copyCoreResources) dependsOn(copyCommonLoaderResources) } +tasks.build.doLast { + copy { + from file("build/resources/main") + into file("build/sourcesSets/main") + } + + // TODO may not be necessary since we also do this before runClient + delete file("../common/build/libs") + delete file("../coreSubProjects/core/build/libs") + delete file("../coreSubProjects/api/build/libs") +} + + + processResources { dependsOn(tasks.named('copyAllResources')) } @@ -52,7 +62,22 @@ processResources { afterEvaluate { runClient { dependsOn(tasks.named('copyAllResources')) - finalizedBy(deleteResources) + } + + // TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now + tasks.runClient.doFirst { + // copy the resources into the sourceSets folder so Forge can access them + copy { + from file("build/resources/main") + into file("build/sourcesSets/main") + } + + // TODO can we just ignore these folders instead? + // deleting them may cause issues if the OS locks the files + // and it feels hacky + delete file("../common/build/libs") + delete file("../coreSubProjects/core/build/libs") + delete file("../coreSubProjects/api/build/libs") } } @@ -77,7 +102,7 @@ sourcesJar { -// TODO this was specifically added for MC 1.20.4 should it be enabled for anything below MC 1.20.4? +// TODO this was specifically added for MC 1.20.4 and should probably be disabled for all MC versions below // source: https://github.com/MinecraftForge/MinecraftForge/blob/5d0047753dfac0caaf5d97cc3f5c9a8b0990cb44/mdk/build.gradle#L209-L217 // // Merge the resources and classes into the same directory. @@ -85,8 +110,9 @@ sourcesJar { // And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem // This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. sourceSets.each { + // all of our code and resources should be in the sourceSets/main/ folder for Forge 1.20.4+ def dir = layout.buildDirectory.dir("sourcesSets/$it.name") - //println "source name " + it.name // as of 2024-2-4 "it.name" only returned "main" and "test" + println "source name: [" + it.name + "]"// as of 2024-2-4 "it.name" only returned "main" and "test" it.output.resourcesDir = dir it.java.destinationDirectory = dir } From 0c5f38a00bd739c7b160e7d3cd3fcdd2669f6685 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 16:07:51 +1030 Subject: [PATCH 119/301] Removed un-needed stuff --- build.gradle | 12 +++--------- forge/build.gradle | 39 +++++++++++++++------------------------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 95947703b..748a747fd 100644 --- a/build.gradle +++ b/build.gradle @@ -118,9 +118,9 @@ subprojects { p -> } tasks.withType(JavaCompile).configureEach { - source(project(":common").sourceSets.main.allSource) - source(project(":api").sourceSets.main.allSource) - source(project(":core").sourceSets.main.allSource) + source(project(":common").sourceSets.main.java) + source(project(":api").sourceSets.main.java) + source(project(":core").sourceSets.main.java) } } @@ -192,12 +192,6 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") - // JOML - if (project.hasProperty("embed_joml") && embed_joml == "true") - forgeShadowMe("org.joml:joml:${rootProject.joml_version}") - else - implementation("org.joml:joml:${rootProject.joml_version}") - // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") diff --git a/forge/build.gradle b/forge/build.gradle index 2aee85b34..3c79ac947 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -41,18 +41,6 @@ tasks.register('copyAllResources') { dependsOn(copyCommonLoaderResources) } -tasks.build.doLast { - copy { - from file("build/resources/main") - into file("build/sourcesSets/main") - } - - // TODO may not be necessary since we also do this before runClient - delete file("../common/build/libs") - delete file("../coreSubProjects/core/build/libs") - delete file("../coreSubProjects/api/build/libs") -} - processResources { @@ -66,12 +54,6 @@ afterEvaluate { // TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now tasks.runClient.doFirst { - // copy the resources into the sourceSets folder so Forge can access them - copy { - from file("build/resources/main") - into file("build/sourcesSets/main") - } - // TODO can we just ignore these folders instead? // deleting them may cause issues if the OS locks the files // and it feels hacky @@ -102,7 +84,7 @@ sourcesJar { -// TODO this was specifically added for MC 1.20.4 and should probably be disabled for all MC versions below +// TODO this was specifically added for MC 1.20.4 and should not be used on MC versions prior to it // source: https://github.com/MinecraftForge/MinecraftForge/blob/5d0047753dfac0caaf5d97cc3f5c9a8b0990cb44/mdk/build.gradle#L209-L217 // // Merge the resources and classes into the same directory. @@ -110,10 +92,19 @@ sourcesJar { // And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem // This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. sourceSets.each { - // all of our code and resources should be in the sourceSets/main/ folder for Forge 1.20.4+ - def dir = layout.buildDirectory.dir("sourcesSets/$it.name") - println "source name: [" + it.name + "]"// as of 2024-2-4 "it.name" only returned "main" and "test" - it.output.resourcesDir = dir - it.java.destinationDirectory = dir + if ( // Only run on MC 1.20.4 or later + // FIXME: Add an environment variable for the Major, Minor, and Patch version number of Minecraft + minecraft_version.split("\\.")[1].toInteger() >= 20 && + ( + minecraft_version.split("\\.").length > 1 && // Incase there isn't a minor version + minecraft_version.split("\\.")[2].toInteger() >= 4 + ) + ) { + // all of our code and resources should be in the sourceSets/main/ folder for Forge 1.20.4+ + def dir = layout.buildDirectory.dir("sourcesSets/$it.name") + println "source name: [" + it.name + "]"// as of 2024-2-4 "it.name" only returned "main" and "test" + it.output.resourcesDir = dir + it.java.destinationDirectory = dir + } } From a14748ac7547985b99659a4890263c7d3599d310 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 18:42:44 +1030 Subject: [PATCH 120/301] Fixed most of the remaining issues --- build.gradle | 29 ++++++----------------------- forge/build.gradle | 10 ---------- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 748a747fd..e72a95fb5 100644 --- a/build.gradle +++ b/build.gradle @@ -143,28 +143,13 @@ subprojects { p -> // set up custom configurations (configurations are a way to handle dependencies) configurations { // extends the shadowJar configuration - shadowCore // Configuration that contains coreProjects shadowMc // Configuration that doesn't contain coreProjects // have implemented dependencies automatically embedded in the final jar - implementation.extendsFrom(shadowCore) implementation.extendsFrom(shadowMc) // Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way) minecraftLibraries.extendsFrom(shadowMc) - - // Configuration fpr core & api - coreProjects - shadowCore.extendsFrom(coreProjects) - - - if (isMinecraftSubProject && p != project(":common")) { - // Shadow common - common - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - implementation.extendsFrom common - implementation.extendsFrom coreProjects - } } @@ -234,12 +219,12 @@ subprojects { p -> // Add core if (isMinecraftSubProject) { - coreProjects(project(":core")) { + compileOnly(project(":core")) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" - + // Removed dependencies transitive false } @@ -247,12 +232,12 @@ subprojects { p -> // Add the api if (p != project(":api")) { - coreProjects(project(":api")) { + implementation(project(":api")) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" - + // Removed dependencies transitive false } @@ -261,17 +246,15 @@ subprojects { p -> // Add common if (isMinecraftSubProject && p != project(":common")) { // Common - common(project(":common")) { transitive false } - shadowCommon(project(":common")) { transitive false } + compileOnly(project(":common")) { transitive false } } } shadowJar { - configurations = [project.configurations.shadowCore, project.configurations.shadowMc] + configurations = [project.configurations.shadowMc] if (isMinecraftSubProject && p != project(":common")) { - configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location } diff --git a/forge/build.gradle b/forge/build.gradle index 3c79ac947..f3b1af41d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -51,16 +51,6 @@ afterEvaluate { runClient { dependsOn(tasks.named('copyAllResources')) } - - // TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now - tasks.runClient.doFirst { - // TODO can we just ignore these folders instead? - // deleting them may cause issues if the OS locks the files - // and it feels hacky - delete file("../common/build/libs") - delete file("../coreSubProjects/core/build/libs") - delete file("../coreSubProjects/api/build/libs") - } } remapJar { From eb491144f3f62515369f65cca159a8be037b83a6 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 19:02:56 +1030 Subject: [PATCH 121/301] Refactored logos into assets/distanthorizons --- .../common/wrappers/gui/updater/UpdateModScreen.java | 9 +-------- coreSubProjects | 2 +- fabric/src/main/resources/fabric.mod.json | 2 +- forge/src/main/resources/META-INF/mods.toml | 4 ++-- neoforge/src/main/resources/META-INF/mods.toml | 4 ++-- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 074e96b21..1662849bd 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -66,13 +66,6 @@ public class UpdateModScreen extends DhScreen try { - // We cannot get assets from the root of the mod so we use this hack - // TODO: Load the icon.png and logo.png in the mod initialise rather than here - ResourceLocation logoLocation = new ResourceLocation(ModInfo.ID, "logo.png"); - Minecraft.getInstance().getTextureManager().register( - logoLocation, - new DynamicTexture(NativeImage.read(JarUtils.accessFile("logo.png"))) - ); // Logo image @@ -84,7 +77,7 @@ public class UpdateModScreen extends DhScreen // Offset 0, 0, // Some textuary stuff - 0, logoLocation, 130, 65, + 0, new ResourceLocation(ModInfo.ID, "logo.png"), 130, 65, // Create the button and tell it where to go // For now it goes to the client option by default (buttonWidget) -> System.out.println("Nice, you found an easter egg :)"), // TODO: Add a proper easter egg to pressing the logo (maybe with confetti) diff --git a/coreSubProjects b/coreSubProjects index 7826d756d..87e564737 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7826d756d0a882eedfb033882ade06aaf4cbf7ab +Subproject commit 87e56473791c56bea97834ae27b5a588db354caa diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index c14865e15..3aa8af35d 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -17,7 +17,7 @@ }, "license": "LGPL-3", - "icon": "icon.png", + "icon": "assets/distanthorizons/icon.png", "accessWidener": "distanthorizons.accesswidener", diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 3f199093b..983a89cde 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -12,8 +12,8 @@ issueTrackerURL = "${issues}" #//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ displayURL = "${homepage}" description = "${description}" #//mandatory. The description text for the mod - logoFile = "logo.png" - catalogueImageIcon = "icon.png" + logoFile = "assets/distanthorizons/logo.png" + catalogueImageIcon = "assets/distanthorizons/icon.png" credits = "Massive thanks to: Leonardo, Cola, Ran, CoolGi, and Leetom. For their hard work to bring Distant Horizons to where it is today. - James" #// if not set defaults to "false" clientSideOnly = "true" diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml index e8abb9812..dd5a9fa74 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -12,8 +12,8 @@ issueTrackerURL = "${issues}" #//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ displayURL = "${homepage}" description = "${description}" #//mandatory. The description text for the mod - logoFile = "logo.png" - catalogueImageIcon = "icon.png" + logoFile = "assets/distanthorizons/logo.png" + catalogueImageIcon = "assets/distanthorizons/icon.png" credits = "Massive thanks to: Leonardo, Cola, Ran, CoolGi, and Leetom. For their hard work to bring Distant Horizons to where it is today. - James" #// if not set defaults to "false" clientSideOnly = "true" From 40102521a1f1ad94ae34954281f4ada9b8396659 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 19:09:54 +1030 Subject: [PATCH 122/301] Updated readme with new mc version --- Readme.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 625bf6edd..187478a33 100644 --- a/Readme.md +++ b/Readme.md @@ -20,6 +20,14 @@ If you want to see a quick demo, check out a video covering the mod here: ### This branch supports the following versions of Minecraft: +#### 1.20.4, 1.20.3 (Default) +Fabric: 0.15.1\ +Fabric API: 0.91.2+1.20.4\ +Forge: 49.0.16\ +NeoForge: 20.4.83-beta\ +Parchment: 1.20.2:2023.12.10\ +Modmenu: 9.0.0-pre.1 + #### 1.20.2 Fabric: 0.14.24\ Fabric API: 0.90.4+1.20.2\ @@ -27,7 +35,7 @@ Forge: 48.0.13\ Parchment: 1.20.1:2023.09.03\ Modmenu: 8.0.0 -#### 1.20.1, 1.20 (Default) +#### 1.20.1, 1.20 Fabric: 0.14.24\ Fabric API: 0.90.4+1.20.1\ Forge: 47.2.1\ From ee922236a0f15b87057e9ebc3e90582c58f861c7 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 19:12:49 +1030 Subject: [PATCH 123/301] Fixed forge version in readme for this branch --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 187478a33..e0bd02a50 100644 --- a/Readme.md +++ b/Readme.md @@ -23,8 +23,8 @@ If you want to see a quick demo, check out a video covering the mod here: #### 1.20.4, 1.20.3 (Default) Fabric: 0.15.1\ Fabric API: 0.91.2+1.20.4\ -Forge: 49.0.16\ -NeoForge: 20.4.83-beta\ +Forge: 49.0.30\ +NeoForge: 118-beta\ Parchment: 1.20.2:2023.12.10\ Modmenu: 9.0.0-pre.1 From d0dc3ec9bcda5624bb0c7b77fef699271dc47eff Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 20:11:15 +1030 Subject: [PATCH 124/301] Added the new unimined flag to fix fabric's access wideners --- build.gradle | 2 +- fabric/build.gradle | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e72a95fb5..c2a3a898b 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { id "io.github.pacifistmc.forgix" version "1.2.6" // Unimined is our all in one solution to minecraft loaders - id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false + id "xyz.wagyourtail.unimined" version "1.1.2-SNAPSHOT" apply false } diff --git a/fabric/build.gradle b/fabric/build.gradle index 342f7704c..1e0a557bb 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -2,6 +2,8 @@ unimined.minecraft { fabric { loader rootProject.fabric_loader_version accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) + + skipInsertAw = true } } From 4d73c3ecb89df49b8b8b1725286214d2d011b275 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 21:09:00 +1030 Subject: [PATCH 125/301] Moved common to Unimined --- build.gradle | 17 +++++++++-------- common/build.gradle | 40 ++++++++++++---------------------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/build.gradle b/build.gradle index c2a3a898b..56f3e0443 100644 --- a/build.gradle +++ b/build.gradle @@ -91,7 +91,7 @@ forgix { } subprojects { p -> - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverLoaderWeAddLaterOn")" + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":forge") || p == project("WhateverLoaderWeAddLaterOn")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") @@ -99,11 +99,10 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" - if (p == project(":core")) { + if (p == project(":core")) apply plugin: "application" - } - if (p != project(":common") && isMinecraftSubProject) { + if (isMinecraftSubProject) { apply plugin: "xyz.wagyourtail.unimined" unimined.minecraft(sourceSets.main, true) { @@ -117,10 +116,12 @@ subprojects { p -> } } - tasks.withType(JavaCompile).configureEach { - source(project(":common").sourceSets.main.java) - source(project(":api").sourceSets.main.java) - source(project(":core").sourceSets.main.java) + if (p != project(":common")) { + tasks.withType(JavaCompile).configureEach { + source(project(":common").sourceSets.main.java) + source(project(":api").sourceSets.main.java) + source(project(":core").sourceSets.main.java) + } } } diff --git a/common/build.gradle b/common/build.gradle index b61221fda..d4bf54ebe 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,32 +1,16 @@ -plugins { - id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT" -} +// Use Unimined's implimentation for MC as we can use Parchment mappings in common now! :tada: +// With Sponge's vanilla gradle, we cannot change the mappings to anything out of mojmaps +unimined.minecraft { + fabric { // TODO: Find a way to only include the mc stuff, not fabric's loader + loader rootProject.fabric_loader_version + accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) -minecraft { - accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) - version(rootProject.minecraft_version) + skipInsertAw = true + } + + defaultRemapJar = false } dependencies { - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader -// modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - - // So mixins can be written in common - compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' -} - - -publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = rootProject.mod_readable_name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} + +} \ No newline at end of file From 4e6255dc2b72ed1f952b32966442a44353a1a4e1 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 21:38:20 +1030 Subject: [PATCH 126/301] Re-added jank file deleting again for now --- forge/build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/forge/build.gradle b/forge/build.gradle index f3b1af41d..3c79ac947 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -51,6 +51,16 @@ afterEvaluate { runClient { dependsOn(tasks.named('copyAllResources')) } + + // TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now + tasks.runClient.doFirst { + // TODO can we just ignore these folders instead? + // deleting them may cause issues if the OS locks the files + // and it feels hacky + delete file("../common/build/libs") + delete file("../coreSubProjects/core/build/libs") + delete file("../coreSubProjects/api/build/libs") + } } remapJar { From 0146d62c2a53554b59b51800be3540ca0f2fb17b Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 19 Feb 2024 23:19:53 +1030 Subject: [PATCH 127/301] Moved AT to only appear in final build, not in the source code --- build.gradle | 4 ++++ forge/build.gradle | 5 ++++- neoforge/build.gradle | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 56f3e0443..1a80a4fae 100644 --- a/build.gradle +++ b/build.gradle @@ -584,12 +584,16 @@ allprojects { p -> } + // TODO: Remove this as no loader needs this + // - Fabric can rename which aw they use + // - (Neo)Forge converts the aw to their own at, which is stored at a different place task copyCommonLoaderResources(type: Copy) { from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") into(file(p.file("build/resources/main"))) rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" } + // TODO: Remove this later as we no longer need this. We are now including the resources in the processResources section task copyCoreResources(type: Copy) { from fileTree(project(":core").file("src/main/resources")) into p.file("build/resources/main") diff --git a/forge/build.gradle b/forge/build.gradle index 3c79ac947..16bfa5045 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -2,7 +2,10 @@ unimined.minecraft { minecraftForge { loader forge_version mixinConfig("DistantHorizons.forge.mixins.json") - accessTransformer(aw2at(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))) + accessTransformer(aw2at( + project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), + file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar + )) } } diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 31700a31b..d7f64e826 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -2,7 +2,10 @@ unimined.minecraft { neoForged { loader neoforge_version mixinConfig("DistantHorizons.neoforge.mixins.json") - accessTransformer(aw2at(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))) + accessTransformer(aw2at( + project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), + file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar + )) } } From 4d038fc5e615fc3e5c3901fd74ce09642d6acd4b Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 20 Feb 2024 00:51:25 +1030 Subject: [PATCH 128/301] Fixed up AT --- build.gradle | 2 +- forge/build.gradle | 2 ++ neoforge/build.gradle | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1a80a4fae..0a371783c 100644 --- a/build.gradle +++ b/build.gradle @@ -304,7 +304,7 @@ subprojects { p -> // FIXME: remove copyCommonLoaderResources and use this instead (and if you are removing that task, also remove copyCoreResources while your at it) // from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") // into(file(p.file("build/resources/main"))) -// rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" + rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" // Location of where to inject the properties def resourceTargets = [ diff --git a/forge/build.gradle b/forge/build.gradle index 16bfa5045..18ae90bde 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -2,6 +2,8 @@ unimined.minecraft { minecraftForge { loader forge_version mixinConfig("DistantHorizons.forge.mixins.json") + + file("build/sourcesSets/main/META-INF/").mkdirs() accessTransformer(aw2at( project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar diff --git a/neoforge/build.gradle b/neoforge/build.gradle index d7f64e826..5703ea19f 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -2,8 +2,10 @@ unimined.minecraft { neoForged { loader neoforge_version mixinConfig("DistantHorizons.neoforge.mixins.json") + + file("build/sourcesSets/main/META-INF/").mkdirs() accessTransformer(aw2at( - project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), + project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar )) } From 4290cdf8c6cd3b0fec4e375048caccd9c77cf025 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 20 Feb 2024 00:51:41 +1030 Subject: [PATCH 129/301] Changed run dir to the root of the project --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index 0a371783c..ee19ae497 100644 --- a/build.gradle +++ b/build.gradle @@ -114,6 +114,16 @@ subprojects { p -> parchment(parchmentVersionParts[0], parchmentVersionParts[1]) devNamespace "mojmap" } + + runs { + config("client") { + workingDir = rootProject.file("run") + } + config("server") { + workingDir = rootProject.file("run") // TODO: When running the server, would it be a better idea to change this to a different dir? + disabled = true // TODO: Once server-side support is added, remove this + } + } } if (p != project(":common")) { From 004059dd9fffac7d322db2f71a1c38867a725f9d Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 22 Feb 2024 22:10:34 +1030 Subject: [PATCH 130/301] Removed mixins from neoforge's mods.toml --- build.gradle | 3 ++- neoforge/src/main/resources/META-INF/mods.toml | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index ee19ae497..9cfcb809c 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,8 @@ plugins { id "io.github.pacifistmc.forgix" version "1.2.6" // Unimined is our all in one solution to minecraft loaders - id "xyz.wagyourtail.unimined" version "1.1.2-SNAPSHOT" apply false +// id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false // Unstable Release (TODO: Check back to see when the unstable branch fixes forge run without the jank) + id "xyz.wagyourtail.unimined" version "1.1.2-SNAPSHOT" apply false // LTS Release } diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml index dd5a9fa74..2a295c5ad 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -23,10 +23,9 @@ issueTrackerURL = "${issues}" #// Allow any version to be present (or not) on the server acceptableRemoteVersions = "*" -# TODO: Once there is a way to move this to the `META-INF/MANIFEST.MF` with architectury, DO SO! -# (currently, this only works cus neoforge's mods.toml is added to the jar after forge's mods.toml, so this can work -[[mixins]] - config = "DistantHorizons.neoforge.mixins.json" +# We may need this to make forge (lexforge) & neoforge work together +#[[mixins]] +# config = "DistantHorizons.neoforge.mixins.json" [[dependencies.distanthorizons]] modId = "minecraft" From 870c0f68d3faf6aa7c76a1c094d19c802f59f06b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 22 Feb 2024 07:05:21 -0600 Subject: [PATCH 131/301] temporary multiverse null pointer fix --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 87e564737..9b4661335 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 87e56473791c56bea97834ae27b5a588db354caa +Subproject commit 9b466133557289324e0647301cc94bd98ac3e2a7 From e34203fe3d50b39dd4666d3a4bddc96344a2e15b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 2 Mar 2024 11:45:14 -0600 Subject: [PATCH 132/301] Fix potential null pointer in BiomeWrapper --- .../distanthorizons/common/wrappers/block/BiomeWrapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 9cbdd9816..fab19b68f 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 @@ -209,7 +209,8 @@ public class BiomeWrapper implements IBiomeWrapper // generate the serial string // - net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); + Level level = (Level)levelWrapper.getWrappedMcObject(); + net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); ResourceLocation resourceLocation; #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 From 1a279b90bee10b60cc081becfc7d7cb37020a798 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 3 Mar 2024 14:53:40 -0600 Subject: [PATCH 133/301] rename ThreadPools -> ThreadPoolUtil --- .../common/wrappers/worldGeneration/GenerationEvent.java | 6 ++---- coreSubProjects | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GenerationEvent.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GenerationEvent.java index 3bee78e77..46df3f13e 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GenerationEvent.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GenerationEvent.java @@ -26,13 +26,11 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep; -import com.seibel.distanthorizons.core.generation.WorldGenerationQueue; -import com.seibel.distanthorizons.core.util.ThreadUtil; import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.util.objects.EventTimer; -import com.seibel.distanthorizons.core.util.threading.ThreadPools; +import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import org.apache.logging.log4j.Logger; @@ -123,7 +121,7 @@ public final class GenerationEvent public boolean terminate() { LOGGER.info("======================DUMPING ALL THREADS FOR WORLD GEN======================="); - ThreadPools.WORLD_GEN_THREAD_FACTORY.dumpAllThreadStacks(); + ThreadPoolUtil.WORLD_GEN_THREAD_FACTORY.dumpAllThreadStacks(); this.future.cancel(true); return this.future.isCancelled(); } diff --git a/coreSubProjects b/coreSubProjects index 9b4661335..dc687f70a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9b466133557289324e0647301cc94bd98ac3e2a7 +Subproject commit dc687f70aeffdf905ee087685421823998898219 From 40580e81c2a2c8113090250955b3e2ef8446f471 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 3 Mar 2024 14:54:11 -0600 Subject: [PATCH 134/301] Fix ChunkWrapper returning block light 15 for out of bound positions Now it will return 0, which is more accurate --- .../wrappers/chunk/ChunkLightStorage.java | 35 +++++++++++++++---- .../common/wrappers/chunk/ChunkWrapper.java | 10 ++++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java index 8d0a465c5..405c0fb95 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java @@ -42,26 +42,49 @@ public class ChunkLightStorage /** the data stored in this storage, split up into 16x16x16 areas. */ public LightSection[] lightSections; + /** + * If the get method is called on a Y position above what's stored + * this value will be returned.

+ * + * This needs to be manually defined since sky and block lights behave differently + * for values both above and below what's defined. + */ + public int aboveMaxYValue; + /** @see ChunkLightStorage#aboveMaxYValue */ + public int belowMinYValue; - public ChunkLightStorage(int minY, int maxY) + + //=============// + // constructor // + //=============// + + public ChunkLightStorage(int minY, int maxY, int aboveMaxYValue, int belowMinYValue) { this.minY = minY; this.maxY = maxY; + + this.aboveMaxYValue = aboveMaxYValue; + this.belowMinYValue = belowMinYValue; } + //=====================// + // getters and setters // + //=====================// + public int get(int x, int y, int z) { if (y < this.minY) { - return 0; - } - if (y >= this.maxY) - { - return 15; + return this.belowMinYValue; } + else if (y >= this.maxY) + { + return this.aboveMaxYValue; + } + if (this.lightSections != null) { 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 55471663a..b49e01a74 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 @@ -358,7 +358,10 @@ public class ChunkWrapper implements IChunkWrapper { if (this.blockLightStorage == null) { - this.blockLightStorage = new ChunkLightStorage(this.getMinBuildHeight(), this.getMaxBuildHeight()); + this.blockLightStorage = new ChunkLightStorage( + this.getMinBuildHeight(), this.getMaxBuildHeight(), + // positions above and below the handled area should be unlit + LodUtil.MIN_MC_LIGHT, LodUtil.MIN_MC_LIGHT); } return this.blockLightStorage; } @@ -381,7 +384,10 @@ public class ChunkWrapper implements IChunkWrapper { if (this.skyLightStorage == null) { - this.skyLightStorage = new ChunkLightStorage(this.getMinBuildHeight(), this.getMaxBuildHeight()); + this.skyLightStorage = new ChunkLightStorage( + this.getMinBuildHeight(), this.getMaxBuildHeight(), + // positions above should be lit but positions below should be unlit + LodUtil.MAX_MC_LIGHT, LodUtil.MIN_MC_LIGHT); } return this.skyLightStorage; } From cd35461df68a690b06aa07af0945c61aaa68afb3 Mon Sep 17 00:00:00 2001 From: Tatounee Date: Sun, 10 Mar 2024 02:38:31 +0100 Subject: [PATCH 135/301] Fix cd command in compiling instructions --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 187478a33..a4968dacc 100644 --- a/Readme.md +++ b/Readme.md @@ -143,7 +143,7 @@ From the File Explorer: From the command line: 1. `git clone --recurse-submodules https://gitlab.com/jeseibel/distant-horizons.git` -2. `cd minecraft-lod-mod` +2. `cd distant-horizons` 3. `./gradlew assemble` 4. `./gradlew mergeJars` 5. The compiled jar file will be in the folder `Merged` From ea0e24b430847b8289a1381fe37e0317124a49f2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Mar 2024 17:25:29 -0500 Subject: [PATCH 136/301] Add multiple compression options and unit tests --- build.gradle | 4 +++- coreSubProjects | 2 +- gradle.properties | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f0261f6b9..7b2622872 100644 --- a/build.gradle +++ b/build.gradle @@ -211,7 +211,9 @@ subprojects { p -> implementation("junit:junit:4.13") // Compression - forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") + 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}") diff --git a/coreSubProjects b/coreSubProjects index dc687f70a..6413e17e4 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit dc687f70aeffdf905ee087685421823998898219 +Subproject commit 6413e17e4b80a48a58adea30df83cc7ef7598cad diff --git a/gradle.properties b/gradle.properties index ac5579831..cc09a4c84 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,8 @@ mod_discord=https://discord.gg/xAB8G4cENx manifold_version=2024.1.0 nightconfig_version=3.6.6 lz4_version=1.8.0 +zstd_version=1.5.5-11 +xz_version=1.9 sqlite_jdbc_version=3.43.0.0 #svgSalamander_version=1.1.3 From 8bedb3dbaa0456d56e19d5eca0ff79ae8db0052b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Mar 2024 21:03:27 -0500 Subject: [PATCH 137/301] Remove Seamless Overdraw Test The result wasn't very good due to rendering issues with entities --- .../common/rendering/SeamlessOverdraw.java | 94 ------------------- coreSubProjects | 2 +- .../fabric/FabricClientProxy.java | 16 ---- .../mixins/client/MixinLevelRenderer.java | 15 --- .../mixins/client/MixinLevelRenderer.java | 15 --- 5 files changed, 1 insertion(+), 141 deletions(-) delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java deleted file mode 100644 index e6795c666..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java +++ /dev/null @@ -1,94 +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.common.rendering; - -#if MC_VER < MC_1_19_4 -import com.mojang.math.Matrix4f; -#else -import org.joml.Matrix4f; -#endif -import com.seibel.distanthorizons.core.config.Config; -import com.seibel.distanthorizons.core.util.RenderUtil; -import com.seibel.distanthorizons.coreapi.util.math.Mat4f; -import org.lwjgl.opengl.GL15; - -import java.nio.FloatBuffer; - -public class SeamlessOverdraw -{ - /** - * Proof-of-concept experimental option, not intended for normal use.
- * (Poorly) replaces Minecraft's far clip plane so it lines up with DH's near clip plane. - */ - public static float[] overwriteMinecraftNearFarClipPlanes(Matrix4f minecraftProjectionMatrix, float previousPartialTicks) - { - float[] matrixFloatArray; - - #if MC_VER < MC_1_19_4 - FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16); - minecraftProjectionMatrix.store(matrixFloatBuffer); - matrixFloatArray = matrixFloatBuffer.array(); - #else - // Passing float buffers in caused native code crashes, so we are passing in a float array instead - matrixFloatArray = new float[16]; - minecraftProjectionMatrix.get(matrixFloatArray); - #endif - - return overwriteMinecraftNearFarClipPlanes(matrixFloatArray, previousPartialTicks); - } - - public static float[] overwriteMinecraftNearFarClipPlanes(Mat4f minecraftProjectionMatrix, float previousPartialTicks) - { - return overwriteMinecraftNearFarClipPlanes(minecraftProjectionMatrix.getValuesAsArray(), previousPartialTicks); - } - - private static float[] overwriteMinecraftNearFarClipPlanes(float[] projectionMatrixFloatArray, float previousPartialTicks) - { - float dhFarClipPlane = RenderUtil.getNearClipPlaneDistanceInBlocks(previousPartialTicks); - - // works for fabric, bad not for forge for some reason :/ - float farClip = dhFarClipPlane * 5.1f; // magic number found via trial and error, James has no idea what it represents, except that it makes the seam between DH and vanilla rendering pretty close - float nearClip = 0.5f; // this causes issues with some vanilla rendering, specifically the wireframe around selected blocks is slightly off. Unfortunately the ratio between the near and far clip plane can't be easily modified without completely screwing up the rendering. - - // these may be the wrong index locations in any version of MC other than 1.18.2 - projectionMatrixFloatArray[10] = -((farClip + nearClip) / (farClip - nearClip)); // near clip plane - projectionMatrixFloatArray[11] = -((2 * farClip * nearClip) / (farClip - nearClip)); // far clip plane - - - return projectionMatrixFloatArray; - } - - - - //================// - // helper methods // - //================// - - public static void applyLegacyProjectionMatrix(float[] projectionMatrixFloatArray) - { - int glMatrixMode = GL15.glGetInteger(GL15.GL_MATRIX_MODE); - GL15.glMatrixMode(GL15.GL_PROJECTION); - - GL15.glLoadMatrixf(projectionMatrixFloatArray); - - GL15.glMatrixMode(glMatrixMode); - } - -} diff --git a/coreSubProjects b/coreSubProjects index 6413e17e4..b20cbab01 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 6413e17e4b80a48a58adea30df83cc7ef7598cad +Subproject commit b20cbab012b1edd0386b671625e5917a9d4678db diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index d9216458d..bcde63d5b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -20,7 +20,6 @@ package com.seibel.distanthorizons.fabric; import com.seibel.distanthorizons.common.AbstractModInitializer; -import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; @@ -197,21 +196,6 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy McObjectConverter.Convert(renderContext.matrixStack().last().pose()), McObjectConverter.Convert(renderContext.projectionMatrix()), renderContext.tickDelta()); - - - // experimental proof-of-concept option - if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) - { - float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta()); - - #if MC_VER == MC_1_16_5 - SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif MC_VER < MC_1_19_4 - renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray)); - #else - renderContext.projectionMatrix().set(matrixFloatArray); - #endif - } }); // Debug keyboard event diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 01a172de6..a04df23bd 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -29,7 +29,6 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import org.joml.Matrix4f; #endif -import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -141,20 +140,6 @@ public class MixinLevelRenderer if (renderType.equals(RenderType.solid())) { ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); - - // experimental proof-of-concept option - if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) - { - float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks); - - #if MC_VER == MC_1_16_5 - SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif MC_VER < MC_1_19_4 - projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); - #else - projectionMatrix.set(matrixFloatArray); - #endif - } } else if (renderType.equals(RenderType.translucent())) { diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index ad0dc6d61..e885b13e9 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -29,7 +29,6 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import org.joml.Matrix4f; #endif -import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -138,20 +137,6 @@ public class MixinLevelRenderer if (renderType.equals(RenderType.solid())) { ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); - - // experimental proof-of-concept option - if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) - { - float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks); - - #if MC_VER == MC_1_16_5 - SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray); - #elif MC_VER < MC_1_19_4 - projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); - #else - projectionMatrix.set(matrixFloatArray); - #endif - } } else if (renderType.equals(RenderType.translucent())) { From 0ee6673e6820d767bd55a00ee1564cc582cb8280 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 17 Mar 2024 16:15:27 -0500 Subject: [PATCH 138/301] update todo comments --- .../distanthorizons/common/AbstractModInitializer.java | 5 +---- coreSubProjects | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java index 1c9def3a3..746ced882 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/AbstractModInitializer.java @@ -166,10 +166,7 @@ public abstract class AbstractModInitializer LOGGER.info("Mod Post-Initialized"); } - private void initCommands() - { - // TODO - } + private void initCommands() { /* currently unimplemented */ } diff --git a/coreSubProjects b/coreSubProjects index b20cbab01..9d539c476 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b20cbab012b1edd0386b671625e5917a9d4678db +Subproject commit 9d539c476622baeeb13d2c0a53052b9f1e171885 From da280db0f8e4d1c1d1ba946c4b4c6c4b6034edb9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 18 Mar 2024 21:28:27 -0500 Subject: [PATCH 139/301] Fix lighting in superflat worlds --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 9d539c476..805429722 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9d539c476622baeeb13d2c0a53052b9f1e171885 +Subproject commit 805429722fc1d4c4152ea7a181855820c4980e11 From 592a1c360143daa104fb76831e752fb7e3f9bcae Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Mar 2024 06:48:31 -0500 Subject: [PATCH 140/301] up the version number 2.0.2 -> 2.0.3 --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 805429722..9f195231d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 805429722fc1d4c4152ea7a181855820c4980e11 +Subproject commit 9f195231db7056c3ede667e3385bd7e6ef169da2 diff --git a/gradle.properties b/gradle.properties index cc09a4c84..bc2d96c0b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.0.2-a-dev +mod_version=2.0.3-a-dev api_version=1.1.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons From 855d707b3e77ea32328b2f7e29678a14f65ee571 Mon Sep 17 00:00:00 2001 From: Yeshi Date: Tue, 19 Mar 2024 18:55:05 +0100 Subject: [PATCH 141/301] readme improvements --- Readme.md | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Readme.md b/Readme.md index 187478a33..316371c98 100644 --- a/Readme.md +++ b/Readme.md @@ -1,18 +1,16 @@ # Distant Horizons +_See farther without turning your game into a slide show._ -> A mod that adds a Level of Detail System to Minecraft - +
# What is Distant Horizons? -Distant Horizons is a Minecraft mod that adds a Level Of Detail (LOD) system to\ -render simplified chunks outside the normal render distance\ -allowing for an increased view distance without harming performance. +Distant Horizons is a mod which implements a [Level of Detail](https://en.wikipedia.org/wiki/Level_of_detail_(computer_graphics)) system to Minecraft.\ +This allows for far greater render distances without harming performance by gradually lowering the quality of distant terrain. -In other words: this mod lets you see farther without turning your game into a slide show.\ -If you want to see a quick demo, check out a video covering the mod here: +Below is a video demonstrating the system: -![Minecraft Level Of Detail (LOD) mod - Alpha 1.6.3](https://cdn.ko-fi.com/cdn/useruploads/png_ef4d209d-50d9-462f-b31f-92e42ec3e260cover.jpg?v=c1097a5b-029c-4484-bec3-80ff58c5d239) +![Distant Horizons - Alpha 2.0](https://i.ytimg.com/vi/SxQdbtjGEsc/hqdefault.jpg)
@@ -81,7 +79,8 @@ Modmenu: 1.16.22 - 1.18.1, 1.18 - 1.19.1, 1.19 - 1.19.3 -

+ +
### Plugin and Library versions @@ -101,7 +100,7 @@ Java Preprocessor plugin: Manifold Preprocessor Visit https://www.oracle.com/java/technologies/downloads/ for installers. * Git or someway to clone git projects.
Visit https://git-scm.com/ for installers. -* (Not required) Any Java IDE with plugins that support Manifold, for example Intellij IDEA. +* (Not required) Any Java IDE with plugins that support Manifold, for example IntelliJ IDEA. **If using IntelliJ:** 1. Install the Manifold plugin @@ -114,17 +113,20 @@ Java Preprocessor plugin: Manifold Preprocessor 3. Make sure eclipse has the JDK 17 installed. (This is needed so that eclipse can run minecraft) 4. Import the project into eclipse - +
## Switching Versions To switch between different Minecraft versions, change `mcVer=1.?` in the `gradle.properties` file. -If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle. (In IntellJ you will also need to do a gradle sync if it didn't happen automatically.) ->Note: There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions. To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s). (Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`). \ -> If anyone knows how to solve this issue please let us know here: \ -> https://gitlab.com/jeseibel/distant-horizons/-/issues/233 +If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle.\ +In IntelliJ, you will also need to do a gradle sync if it didn't happen automatically. +>There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions.\ +To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s).\ +(Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`.) +> If anyone knows how to solve this issue please let us know here: +> https://gitlab.com/jeseibel/distant-horizons/-/issues/233
@@ -138,7 +140,7 @@ From the File Explorer: 2. Download the core from https://gitlab.com/jeseibel/distant-horizons-core and extract into a folder called `coreSubProjects` 3. Open a terminal emulator in the project folder (On Windows you can type `cmd` in the title bar) 4. Run the commands: `./gradlew assemble` (You may need to use a `.\` on Windows) -5. Merge the jars wih `./gradlew mergeJars` +5. Merge the jars with `./gradlew mergeJars` 6. The compiled jar file will be in the folder `Merged` From the command line: @@ -150,9 +152,8 @@ From the command line: Run tests with: `./gradlew test` ->Note: You can add the arg: `-PmcVer=?` to tell gradle to build a selected MC version instead of having to modify the `gradle.properties` file. \ -> Example: `./gradlew assemble -PmcVer=1.18.2` - +>Note: You can add the argument `-PmcVer=?` to tell gradle to build a selected MC version instead of having to modify the `gradle.properties` file.\ +> For example: `./gradlew assemble -PmcVer=1.18.2`
@@ -162,7 +163,6 @@ Run tests with: `./gradlew test` You can also locally compile the DH jars without a Java environment by using Docker. Where `` is the version of Minecraft to compile for (ie `1.20.1`), or the keyword `all`. See [Versions](#minecraft-and-library-versions) for a list of all supported values. -
## Other commands @@ -171,6 +171,7 @@ You can also locally compile the DH jars without a Java environment by using Doc `./gradlew clean` to delete any compiled code. +
## Note to self @@ -178,7 +179,7 @@ The Minecraft source code is NOT added to your workspace in an editable way. Min Source code uses Mojang mappings & [Parchment](https://parchmentmc.org/) mappings. -To generate the source code run `./gradlew genSources`\ +To generate the source code run `./gradlew genSources` If your IDE fails to auto-detect the source jars when browsing Minecraft classes; manually select the JAR file ending with -sources.jar when prompted by your IDE.
(In IntelliJ it's at the top where it says "choose sources" when browsing a Minecraft class) @@ -186,11 +187,11 @@ If your IDE fails to auto-detect the source jars when browsing Minecraft classes ## Other Useful commands -Run the standalone jar: `./gradlew run`\ -Build the standalone jar: `./gradlew core:build`\ -Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build`\ -Only build Forge: `./gradlew fabric:assemble` or `./gradlew forge:build`\ -Run the Fabric client (for debugging): `./gradlew fabric:runClient`\ +Run the standalone jar: `./gradlew run` +Build the standalone jar: `./gradlew core:build` +Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build` +Only build Forge: `./gradlew forge:assemble` or `./gradlew forge:build` +Run the Fabric client (for debugging): `./gradlew fabric:runClient` Run the Forge client (for debugging): `./gradlew forge:runClient` To build all versions: `./buildAll` (all builds will end up in the `Merged` folder) @@ -205,7 +206,7 @@ https://github.com/PacifistMC/Forgix LZ4 for Java (data compression)\ https://github.com/lz4/lz4-java -NightConfig for Json & Toml (config handling)\ +NightConfig for JSON & TOML (config handling)\ https://github.com/TheElectronWill/night-config SVG Salamander for SVG support (not being used atm)\ From 5d60251da0df1812a6a14c5235c2f99b9f6b4ea8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Mar 2024 17:36:22 -0500 Subject: [PATCH 142/301] Cache the blockState and biome wrapper hashCodes --- .../common/wrappers/block/BiomeWrapper.java | 7 +++++-- .../common/wrappers/block/BlockStateWrapper.java | 4 +++- coreSubProjects | 2 +- 3 files changed, 9 insertions(+), 4 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 fab19b68f..dfec14fc9 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 @@ -88,7 +88,8 @@ public class BiomeWrapper implements IBiomeWrapper #endif /** technically final, but since it requires a method call to generate it can't be marked as such */ - private String serialString = null; + private String serialString; + private int hashCode; @@ -119,6 +120,7 @@ public class BiomeWrapper implements IBiomeWrapper { this.biome = biome; this.serialString = this.serialize(levelWrapper); + this.hashCode = Objects.hash(this.serialString); LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]"); } @@ -127,6 +129,7 @@ public class BiomeWrapper implements IBiomeWrapper { this.biome = null; this.serialString = EMPTY_STRING; + this.hashCode = Objects.hash(this.serialString); } @@ -168,7 +171,7 @@ public class BiomeWrapper implements IBiomeWrapper } @Override - public int hashCode() { return Objects.hash(this.getSerialString()); } + public int hashCode() { return this.hashCode; } @Override public String getSerialString() { return this.serialString; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index e44a30e0a..81362e030 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -83,6 +83,7 @@ public class BlockStateWrapper implements IBlockStateWrapper public final BlockState blockState; /** technically final, but since it requires a method call to generate it can't be marked as such */ private String serialString; + private final int hashCode; /** * Cached opacity value, -1 if not populated.
* Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE} @@ -121,6 +122,7 @@ public class BlockStateWrapper implements IBlockStateWrapper { this.blockState = blockState; this.serialString = this.serialize(levelWrapper); + this.hashCode = Objects.hash(this.serialString); this.irisBlockMaterialId = this.calculateIrisBlockMaterialId(); LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]"); } @@ -245,7 +247,7 @@ public class BlockStateWrapper implements IBlockStateWrapper } @Override - public int hashCode() { return Objects.hash(this.getSerialString()); } + public int hashCode() { return this.hashCode; } @Override diff --git a/coreSubProjects b/coreSubProjects index 9f195231d..a1950ebcc 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9f195231db7056c3ede667e3385bd7e6ef169da2 +Subproject commit a1950ebccc68dee9aa9a505abb5e6b81529e01fc From c00e3d7393cb40b3fe498d8cb9a4ce51cf530be2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Mar 2024 20:07:35 -0500 Subject: [PATCH 143/301] Change the SQLite journal mode DELETE -> TRUNCATE --- .gitignore | 1 + coreSubProjects | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 16bdd9507..bb4078a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ build.properties # Sqlite databases *.sqlite +*.sqlite-journal diff --git a/coreSubProjects b/coreSubProjects index a1950ebcc..9fb5182b7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a1950ebccc68dee9aa9a505abb5e6b81529e01fc +Subproject commit 9fb5182b785780a8f6cc55fd721003293eed6291 From 8199b4408a05e3c494d92f09ef51bed284a567bb Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Mar 2024 20:53:15 -0500 Subject: [PATCH 144/301] Reduce string concatenations in assertions --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 9fb5182b7..d926d11d3 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9fb5182b785780a8f6cc55fd721003293eed6291 +Subproject commit d926d11d3cd7952f163d7921095cff76cc2cdad0 From 73ba1c8b56515dd76131a3741a9e8d219f1c67a7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 19 Mar 2024 21:10:31 -0500 Subject: [PATCH 145/301] Fix transactionScript auto update variable flipped --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index d926d11d3..3b9962d7d 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit d926d11d3cd7952f163d7921095cff76cc2cdad0 +Subproject commit 3b9962d7dcb2ef78293c9643b6c4950541afb4d9 From cd5c3d9f13188f56bc7c337989d9ed79d759f473 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 20 Mar 2024 07:25:42 -0500 Subject: [PATCH 146/301] Compress the column gen step in the database --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 3b9962d7d..4cdc6c963 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 3b9962d7dcb2ef78293c9643b6c4950541afb4d9 +Subproject commit 4cdc6c96323097ad57cb0509f67267666dc2fd11 From 9cd48fb5d7f9dcfe56bdea4dc56f23b7bcb549d3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 23 Mar 2024 16:18:40 -0500 Subject: [PATCH 147/301] Comment out trace logs These logs aren't printed and will just increase GC pressure for strings --- .../distanthorizons/common/wrappers/block/BiomeWrapper.java | 3 ++- .../common/wrappers/block/BlockStateWrapper.java | 3 ++- coreSubProjects | 2 +- .../com/seibel/distanthorizons/fabric/FabricClientProxy.java | 4 ++-- .../com/seibel/distanthorizons/forge/ForgeClientProxy.java | 4 ++-- .../seibel/distanthorizons/neoforge/NeoforgeClientProxy.java | 4 ++-- 6 files changed, 11 insertions(+), 9 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 dfec14fc9..d685e36c2 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 @@ -121,7 +121,8 @@ public class BiomeWrapper implements IBiomeWrapper this.biome = biome; this.serialString = this.serialize(levelWrapper); this.hashCode = Objects.hash(this.serialString); - LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]"); + + //LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]"); } /** should only be used to create {@link BiomeWrapper#EMPTY_WRAPPER} */ diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 81362e030..3e3a901dd 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -124,7 +124,8 @@ public class BlockStateWrapper implements IBlockStateWrapper this.serialString = this.serialize(levelWrapper); this.hashCode = Objects.hash(this.serialString); this.irisBlockMaterialId = this.calculateIrisBlockMaterialId(); - LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]"); + + //LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]"); } diff --git a/coreSubProjects b/coreSubProjects index 4cdc6c963..a1c85d91f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4cdc6c96323097ad57cb0509f67267666dc2fd11 +Subproject commit a1c85d91fc4c2aa2398f11ffc0f78f1305ad01ab diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index bcde63d5b..74d1c262c 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -130,7 +130,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy ChunkAccess chunk = level.getChunk(blockPos); if (chunk != null) { - LOGGER.trace("attack block at blockPos: " + blockPos); + //LOGGER.trace("attack block at blockPos: " + blockPos); IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); SharedApi.INSTANCE.chunkBlockChangedEvent( @@ -160,7 +160,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy ChunkAccess chunk = level.getChunk(hitResult.getBlockPos()); if (chunk != null) { - LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos()); + //LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos()); IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level); SharedApi.INSTANCE.chunkBlockChangedEvent( 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 9b1b03c49..231368363 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -178,7 +178,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy return; } - LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); + //LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); @@ -197,7 +197,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy return; } - LOGGER.trace("break or block attack at blockPos: " + event.getPos()); + //LOGGER.trace("break or block attack at blockPos: " + event.getPos()); #if MC_VER < MC_1_19_2 LevelAccessor level = event.getWorld(); diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index 69da1d5e1..b58d758a1 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -151,7 +151,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy return; } - LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); + //LOGGER.trace("interact or block place event at blockPos: " + event.getPos()); LevelAccessor level = event.getLevel(); @@ -166,7 +166,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy return; } - LOGGER.trace("break or block attack at blockPos: " + event.getPos()); + //LOGGER.trace("break or block attack at blockPos: " + event.getPos()); LevelAccessor level = event.getLevel(); From 734bb4afb8bcfac3cd9638c2a7f8686d808a1719 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 23 Mar 2024 16:23:40 -0500 Subject: [PATCH 148/301] minor biome/block wrapper changes --- .../distanthorizons/common/wrappers/block/BiomeWrapper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 d685e36c2..366087528 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 @@ -56,8 +56,10 @@ import net.minecraft.world.level.biome.Biomes; /** This class wraps the minecraft BlockPos.Mutable (and BlockPos) class */ public class BiomeWrapper implements IBiomeWrapper { + // must be defined before AIR, otherwise a null pointer will be thrown private static final Logger LOGGER = LogManager.getLogger(); + #if MC_VER < MC_1_18_2 public static final ConcurrentMap WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #else @@ -65,7 +67,7 @@ public class BiomeWrapper implements IBiomeWrapper #endif public static final String EMPTY_STRING = "EMPTY"; - public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(); + public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); /** keep track of broken biomes so we don't log every time */ private static final HashSet brokenResourceLocationStrings = new HashSet<>(); @@ -89,7 +91,7 @@ public class BiomeWrapper implements IBiomeWrapper /** technically final, but since it requires a method call to generate it can't be marked as such */ private String serialString; - private int hashCode; + private final int hashCode; From 52f15a86fde081682b000b9db78a55ed6af56e39 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 23 Mar 2024 17:56:29 -0500 Subject: [PATCH 149/301] add todo about error in ClientBlockStateCache --- .../common/wrappers/block/cache/ClientBlockStateCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9bb61fcac..b816896ea 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 @@ -204,7 +204,7 @@ public class ClientBlockStateCache for (Direction direction : DIRECTION_ORDER) { quads = Minecraft.getInstance().getModelManager().getBlockModelShaper(). - getBlockModel(blockState).getQuads(blockState, direction, random); + getBlockModel(blockState).getQuads(blockState, direction, random); // TODO getQuads sometimes throws a "makeThreadingException", is there anything we can do about that? Note: this isn't a critical issue, it just prints an ugly error and the render data will need to be regenered. if (quads != null && !quads.isEmpty() && !(blockState.getBlock() instanceof RotatedPillarBlock && direction == Direction.UP)) break; From 3cc663ee95c64ab7eba3285390d404eb06cf0d63 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 23 Mar 2024 18:09:10 -0500 Subject: [PATCH 150/301] remove render data file handling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a1c85d91f..661f286b7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a1c85d91fc4c2aa2398f11ffc0f78f1305ad01ab +Subproject commit 661f286b77228fb051d07edd93abb904f4501795 From fcca51a8d97a52cfa7b775aaa04b9ede622fb1e1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 24 Mar 2024 11:53:46 -0500 Subject: [PATCH 151/301] Fix missing indium messy crash error when java.awt is headless --- coreSubProjects | 2 +- .../distanthorizons/fabric/FabricMain.java | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 661f286b7..bbe5ae9b7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 661f286b77228fb051d07edd93abb904f4501795 +Subproject commit bbe5ae9b7c6dd1ec29ad17b2e0a92563e8fd132e diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 73ef942b3..bf77cd8f6 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -25,6 +25,7 @@ import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.config.ConfigBase; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*; import com.seibel.distanthorizons.coreapi.ModInfo; @@ -37,8 +38,10 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.minecraft.commands.CommandSourceStack; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; +import org.apache.logging.log4j.Logger; import javax.swing.*; +import java.awt.*; import java.util.function.Consumer; /** @@ -50,6 +53,8 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti { private static final ResourceLocation INITIAL_PHASE = ResourceLocation.tryParse("distanthorizons:dedicated_server_initial"); + private static final Logger LOGGER = DhLoggerBuilder.getLogger(); + @Override @@ -72,10 +77,13 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti // If sodium is installed Indium is also necessary in order to use the Fabric rendering API if (!modChecker.isModLoaded("indium")) { - // People don't read the crash logs!!! - // So, just put a notification, so they hopefully realise what's the problem (and dont just open issues) - System.setProperty("java.awt.headless", "false"); // Required to make it work - JOptionPane.showMessageDialog(null, ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium", ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE); + String indiumMissingMessage = ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium"; + LOGGER.fatal(indiumMissingMessage); + + if (!GraphicsEnvironment.isHeadless()) + { + JOptionPane.showMessageDialog(null, indiumMissingMessage, ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE); + } IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); String errorMessage = "loading Distant Horizons. Distant Horizons requires Indium in order to run with Sodium."; From 778144a553bbd125e216665dbd5139661aba2b8e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 28 Mar 2024 07:43:32 -0500 Subject: [PATCH 152/301] Add WorldCompressionMode config, default to VISUALLY_EQUAL --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index bbe5ae9b7..6a3261394 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit bbe5ae9b7c6dd1ec29ad17b2e0a92563e8fd132e +Subproject commit 6a3261394fd8e7282e03786aa51dd9604995dc82 From cf1402edb93d3f4cd68ffb794894c9bdf5d65fe8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 28 Mar 2024 07:47:17 -0500 Subject: [PATCH 153/301] Remove the DhRenderData DB table --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 6a3261394..e7eb2ff9c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 6a3261394fd8e7282e03786aa51dd9604995dc82 +Subproject commit e7eb2ff9cc35e58dfb5112ee394f2703d61b3cbd From 1bda767cd7a746357594c9cbf3c5a8e968f0d2fa Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 28 Mar 2024 17:14:56 -0500 Subject: [PATCH 154/301] Add Cola's RenderDataTransformer fixes --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index e7eb2ff9c..543c3ffc5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e7eb2ff9cc35e58dfb5112ee394f2703d61b3cbd +Subproject commit 543c3ffc540c75fd60585dba70f376d0bb7c6365 From 138972cf187ccdb947f254dd1e0a76fda215afa0 Mon Sep 17 00:00:00 2001 From: cola98765 Date: Fri, 29 Mar 2024 14:54:06 +0000 Subject: [PATCH 155/301] Rework to "calculateColorFromTexture" --- .../block/cache/ClientBlockStateCache.java | 148 ++++++++++++++---- 1 file changed, 117 insertions(+), 31 deletions(-) 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 b816896ea..00ae43a89 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 @@ -92,15 +92,93 @@ public class ClientBlockStateCache Default, Flower, Leaves, - Chisel; + Chisel, + Glass; static ColorMode getColorMode(Block b) { if (b instanceof LeavesBlock) return Leaves; if (b instanceof FlowerBlock) return Flower; + if (b.toString().contains("glass")) return Glass; if (b.toString().equals("Block{chiselsandbits:chiseled}")) return Chisel; return Default; } } + + //Way to efficiently do this was suggested by IMS from sodium. This is where those numbers and support code was lifted from. + private static final int MIN_BITS = 0x39000000; // 2^(-13) + private static final int MAX_BITS = 0x3f7fffff; // 1.0 - f32::EPSILON + private static final float MIN_BOUND = Float.intBitsToFloat(MIN_BITS); + private static final float MAX_BOUND = Float.intBitsToFloat(MAX_BITS); + + private static final int[] linearToSrgbTable = new int[] { + 0x0073000d, 0x007a000d, 0x0080000d, 0x0087000d, 0x008d000d, 0x0094000d, 0x009a000d, 0x00a1000d, + 0x00a7001a, 0x00b4001a, 0x00c1001a, 0x00ce001a, 0x00da001a, 0x00e7001a, 0x00f4001a, 0x0101001a, + 0x010e0033, 0x01280033, 0x01410033, 0x015b0033, 0x01750033, 0x018f0033, 0x01a80033, 0x01c20033, + 0x01dc0067, 0x020f0067, 0x02430067, 0x02760067, 0x02aa0067, 0x02dd0067, 0x03110067, 0x03440067, + 0x037800ce, 0x03df00ce, 0x044600ce, 0x04ad00ce, 0x051400ce, 0x057b00c5, 0x05dd00bc, 0x063b00b5, + 0x06970158, 0x07420142, 0x07e30130, 0x087b0120, 0x090b0112, 0x09940106, 0x0a1700fc, 0x0a9500f2, + 0x0b0f01cb, 0x0bf401ae, 0x0ccb0195, 0x0d950180, 0x0e56016e, 0x0f0d015e, 0x0fbc0150, 0x10630143, + 0x11070264, 0x1238023e, 0x1357021d, 0x14660201, 0x156601e9, 0x165a01d3, 0x174401c0, 0x182401af, + 0x18fe0331, 0x1a9602fe, 0x1c1502d2, 0x1d7e02ad, 0x1ed4028d, 0x201a0270, 0x21520256, 0x227d0240, + 0x239f0443, 0x25c003fe, 0x27bf03c4, 0x29a10392, 0x2b6a0367, 0x2d1d0341, 0x2ebe031f, 0x304d0300, + 0x31d105b0, 0x34a80555, 0x37520507, 0x39d504c5, 0x3c37048b, 0x3e7c0458, 0x40a8042a, 0x42bd0401, + 0x44c20798, 0x488e071e, 0x4c1c06b6, 0x4f76065d, 0x52a50610, 0x55ac05cc, 0x5892058f, 0x5b590559, + 0x5e0c0a23, 0x631c0980, 0x67db08f6, 0x6c55087f, 0x70940818, 0x74a007bd, 0x787d076c, 0x7c330723, + }; + + private static final float[] srgbToLinearTable = new float[] { + 0.0f, 0.000303527f, 0.000607054f, 0.00091058103f, 0.001214108f, 0.001517635f, 0.0018211621f, 0.002124689f, + 0.002428216f, 0.002731743f, 0.00303527f, 0.0033465356f, 0.003676507f, 0.004024717f, 0.004391442f, + 0.0047769533f, 0.005181517f, 0.0056053917f, 0.0060488326f, 0.006512091f, 0.00699541f, 0.0074990317f, + 0.008023192f, 0.008568125f, 0.009134057f, 0.009721218f, 0.010329823f, 0.010960094f, 0.011612245f, + 0.012286487f, 0.012983031f, 0.013702081f, 0.014443844f, 0.015208514f, 0.015996292f, 0.016807375f, + 0.017641952f, 0.018500218f, 0.019382361f, 0.020288562f, 0.02121901f, 0.022173883f, 0.023153365f, + 0.02415763f, 0.025186857f, 0.026241222f, 0.027320892f, 0.028426038f, 0.029556843f, 0.03071345f, 0.03189604f, + 0.033104774f, 0.03433981f, 0.035601325f, 0.036889452f, 0.038204376f, 0.039546248f, 0.04091521f, 0.042311423f, + 0.043735042f, 0.045186214f, 0.046665095f, 0.048171833f, 0.049706575f, 0.051269468f, 0.052860655f, 0.05448028f, + 0.056128494f, 0.057805434f, 0.05951124f, 0.06124607f, 0.06301003f, 0.06480328f, 0.06662595f, 0.06847818f, + 0.07036011f, 0.07227186f, 0.07421358f, 0.07618539f, 0.07818743f, 0.08021983f, 0.082282715f, 0.084376216f, + 0.086500466f, 0.088655606f, 0.09084173f, 0.09305898f, 0.095307484f, 0.09758736f, 0.09989874f, 0.10224175f, + 0.10461649f, 0.10702311f, 0.10946172f, 0.111932434f, 0.11443538f, 0.116970696f, 0.11953845f, 0.12213881f, + 0.12477186f, 0.12743773f, 0.13013652f, 0.13286836f, 0.13563336f, 0.13843165f, 0.14126332f, 0.1441285f, + 0.1470273f, 0.14995982f, 0.15292618f, 0.1559265f, 0.15896086f, 0.16202943f, 0.16513224f, 0.16826946f, + 0.17144115f, 0.17464745f, 0.17788847f, 0.1811643f, 0.18447503f, 0.1878208f, 0.19120172f, 0.19461787f, + 0.19806935f, 0.2015563f, 0.20507877f, 0.2086369f, 0.21223079f, 0.21586053f, 0.21952623f, 0.22322798f, + 0.22696589f, 0.23074007f, 0.23455065f, 0.23839766f, 0.2422812f, 0.2462014f, 0.25015837f, 0.25415218f, + 0.2581829f, 0.26225072f, 0.26635566f, 0.27049786f, 0.27467737f, 0.27889434f, 0.2831488f, 0.2874409f, + 0.2917707f, 0.29613832f, 0.30054384f, 0.30498737f, 0.30946895f, 0.31398875f, 0.31854683f, 0.32314324f, + 0.32777813f, 0.33245158f, 0.33716366f, 0.34191445f, 0.3467041f, 0.3515327f, 0.35640025f, 0.36130688f, + 0.3662527f, 0.37123778f, 0.37626222f, 0.3813261f, 0.38642952f, 0.39157256f, 0.3967553f, 0.40197787f, + 0.4072403f, 0.4125427f, 0.41788515f, 0.42326775f, 0.42869055f, 0.4341537f, 0.43965724f, 0.44520125f, + 0.45078585f, 0.45641106f, 0.46207705f, 0.46778384f, 0.47353154f, 0.47932023f, 0.48514998f, 0.4910209f, + 0.49693304f, 0.5028866f, 0.50888145f, 0.5149178f, 0.5209957f, 0.52711535f, 0.5332766f, 0.5394797f, + 0.5457247f, 0.5520116f, 0.5583406f, 0.5647117f, 0.57112503f, 0.57758063f, 0.5840786f, 0.590619f, 0.597202f, + 0.60382754f, 0.61049575f, 0.61720675f, 0.62396055f, 0.63075733f, 0.637597f, 0.6444799f, 0.6514058f, + 0.65837497f, 0.66538745f, 0.67244333f, 0.6795426f, 0.68668544f, 0.69387203f, 0.70110214f, 0.70837605f, + 0.7156938f, 0.72305536f, 0.730461f, 0.7379107f, 0.7454045f, 0.75294244f, 0.76052475f, 0.7681514f, 0.77582246f, + 0.78353804f, 0.79129815f, 0.79910296f, 0.8069525f, 0.8148468f, 0.822786f, 0.8307701f, 0.83879924f, 0.84687346f, + 0.8549928f, 0.8631574f, 0.87136734f, 0.8796226f, 0.8879232f, 0.89626956f, 0.90466136f, 0.913099f, 0.92158204f, + 0.93011117f, 0.9386859f, 0.9473069f, 0.9559735f, 0.9646866f, 0.9734455f, 0.98225087f, 0.9911022f, 1.0f + }; + + private static int linearToSrgb(float c) { + if (!(c > MIN_BOUND)) { + c = MIN_BOUND; + } + + if (c > MAX_BOUND) { + c = MAX_BOUND; + } + int inputBits = Float.floatToRawIntBits(c); + int entry = linearToSrgbTable[((inputBits - MIN_BITS) >> 20)]; + + int bias = (entry >>> 16) << 9; + int scale = entry & 0xffff; + int t = (inputBits >>> 12) & 0xff; + + return (bias + (scale * t)) >>> 16; + } + ////////////// private static int getWidth(TextureAtlasSprite texture) { @@ -119,21 +197,24 @@ public class ClientBlockStateCache return texture.contents().height(); #endif } + //TODO: Perhaps make this not just use the first frame? private static int calculateColorFromTexture(TextureAtlasSprite texture, ColorMode colorMode) { int count = 0; - double alpha = 0; + int alpha = 0; double red = 0; double green = 0; double blue = 0; int tempColor; + //make Chiseled block not render. Since ColorMode is set per block, you only need to check it once + if (colorMode != ColorMode.Chisel) { // textures normally use u and v instead of x and y - for (int u = 0; u < getWidth(texture); u++) + for (int v = 0; v < getHeight(texture); v++) { - for (int v = 0; v < getHeight(texture); v++) + for (int u = 0; u < getWidth(texture); u++) { //note: Minecraft color format is: 0xAA BB GG RR //________ DH mod color format is: 0xAA RR GG BB @@ -141,40 +222,39 @@ public class ClientBlockStateCache //_ OpenGL RGBA format Java Order: 0xAA BB GG RR tempColor = TextureAtlasSpriteWrapper.getPixelRGBA(texture, 0, u, v); - double r = ((tempColor & 0x000000FF)) / 255.; - double g = ((tempColor & 0x0000FF00) >>> 8) / 255.; - double b = ((tempColor & 0x00FF0000) >>> 16) / 255.; - double a = ((tempColor & 0xFF000000) >>> 24) / 255.; + int r = (tempColor & 0x000000FF); + int g = (tempColor & 0x0000FF00) >>> 8; + int b = (tempColor & 0x00FF0000) >>> 16; + int a = (tempColor & 0xFF000000) >>> 24; int scale = 1; - if (colorMode == ColorMode.Leaves) { - r *= a; - g *= a; - b *= a; - a = 1.; + //switch (//FIXME add config option) + // case BLACK: + a = 255; //simulate black background of fast leaves + // break; + // case IGNORE: + // continue; //same long grass + // break; + // case TRANSPARENT: + // break; //do nothing, let it count towards transparency + } - else if (a == 0.) + else if (a == 0 && colorMode != ColorMode.Glass) { continue; } - else if (colorMode == ColorMode.Flower && (g + 0.1 < b || g + 0.1 < r)) + else if (colorMode == ColorMode.Flower && (g + 25 < b || g + 25 < r)) { scale = FLOWER_COLOR_SCALE; } - //make Chiseled block not render - else if (colorMode == ColorMode.Chisel) - { - r = 0; - g = 0; - b = 0; - a = 0; - } count += scale; - alpha += a * a * scale; - red += r * r * scale; - green += g * g * scale; - blue += b * b * scale; + //apparently alpha is linear + alpha += a * scale; + //gamma correction is complicated + red += srgbToLinearTable[r] * a * scale; + green += srgbToLinearTable[g] * a * scale; + blue += srgbToLinearTable[b] * a * scale; } } } @@ -186,10 +266,16 @@ public class ClientBlockStateCache { // determine the average color tempColor = ColorUtil.rgbToInt( - (int) (Math.sqrt(alpha / count) * 255.), - (int) (Math.sqrt(red / count) * 255.), - (int) (Math.sqrt(green / count) * 255.), - (int) (Math.sqrt(blue / count) * 255.)); + alpha / count, + linearToSrgb((float) (red / (double) alpha)), + linearToSrgb((float) (green / (double) alpha)), + linearToSrgb((float) (blue / (double) alpha))); + } + //check if not missing texture + if (tempColor == ColorUtil.rgbToInt(255, 182, 0, 182)) + { + //make it not render at all + tempColor = ColorUtil.rgbToInt(0, 255, 255, 255); } return tempColor; } From 5bbeceee565314394149e32995c28edd9a1a59ef Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 1 Apr 2024 20:28:38 -0500 Subject: [PATCH 156/301] Add data source pooling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 543c3ffc5..2cce71cf2 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 543c3ffc540c75fd60585dba70f376d0bb7c6365 +Subproject commit 2cce71cf286f1e03f0e089b1f958499f6df1420b From c51255f379ff59acb5179dbb7f4e99b606a9daa9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 3 Apr 2024 07:43:12 -0500 Subject: [PATCH 157/301] Add fastutil to gradle (specifically to fix MC 1.16) --- build.gradle | 3 ++- coreSubProjects | 2 +- gradle.properties | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 7b2622872..69905fd02 100644 --- a/build.gradle +++ b/build.gradle @@ -221,6 +221,8 @@ subprojects { p -> // NightConfig (includes Toml & Json) forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}") + + forgeShadowMe("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") // SVG (not needed atm) // forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") @@ -600,7 +602,6 @@ allprojects { p -> implementation("com.google.code.findbugs:jsr305:3.0.2") implementation("com.google.common:google-collect:0.5") implementation("com.google.guava:guava:31.1-jre") - implementation("it.unimi.dsi:fastutil:8.5.11") } } diff --git a/coreSubProjects b/coreSubProjects index 2cce71cf2..149148732 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2cce71cf286f1e03f0e089b1f958499f6df1420b +Subproject commit 1491487328252858355f5cab818a8e563053581c diff --git a/gradle.properties b/gradle.properties index bc2d96c0b..868c64943 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,6 +24,7 @@ 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 #svgSalamander_version=1.1.3 # Minecraft related libaries (included in MC's jar) From e5c948ce9c7c9e828327d5dffe22ce8d7f47e95d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 3 Apr 2024 22:07:29 -0500 Subject: [PATCH 158/301] Improve initial LOD loading speed --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 149148732..4e1155f8a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1491487328252858355f5cab818a8e563053581c +Subproject commit 4e1155f8a7b0d877938a39fda68b83f3a4f8c90b From d349d0c4539b165dc54fd77612a4e9bea1659b95 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 4 Apr 2024 07:09:56 -0500 Subject: [PATCH 159/301] Make rendering speed worse but improve LOD loading speed --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 4e1155f8a..42675abef 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4e1155f8a7b0d877938a39fda68b83f3a4f8c90b +Subproject commit 42675abef13e15766606265cabfb94fdda984200 From 10ab638643c26adbc982b16250ba37b2ed30173a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 4 Apr 2024 07:50:21 -0500 Subject: [PATCH 160/301] Change Sqlite Journaling to WAL to potentially improve concurrent performance --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 42675abef..a1a45f50b 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 42675abef13e15766606265cabfb94fdda984200 +Subproject commit a1a45f50bf7e978545fec2820f86290e7028b415 From 6b442f03c1cd1776178be2a0c0b58b99bb4972d0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 08:46:47 -0500 Subject: [PATCH 161/301] Update ELodShading names and descriptions --- .../common/wrappers/minecraft/MinecraftClientWrapper.java | 6 +++--- coreSubProjects | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index f0d3dc654..ba52253ae 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -117,7 +117,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra switch (lodShading) { default: - case MINECRAFT: + case AUTO: if (this.mc.level != null) { Direction mcDir = McObjectConverter.Convert(lodDirection); @@ -128,7 +128,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra return 0.0f; } - case OLD_LIGHTING: + case ENABLED: switch (lodDirection) { case DOWN: @@ -144,7 +144,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra return 0.6F; } - case NONE: + case DISABLED: return 1.0F; } } diff --git a/coreSubProjects b/coreSubProjects index a1a45f50b..f09818e56 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a1a45f50bf7e978545fec2820f86290e7028b415 +Subproject commit f09818e564da8d17cb858172469949af9a4356e9 From 825b1ab4db548431ab68ca4949585112e6882352 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 08:51:06 -0500 Subject: [PATCH 162/301] Re-add a couple readme breakpoints and remove a unneeded note --- Readme.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Readme.md b/Readme.md index 316371c98..ac4f117ed 100644 --- a/Readme.md +++ b/Readme.md @@ -122,12 +122,6 @@ To switch between different Minecraft versions, change `mcVer=1.?` in the `gradl If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle.\ In IntelliJ, you will also need to do a gradle sync if it didn't happen automatically. ->There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions.\ -To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s).\ -(Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`.) -> If anyone knows how to solve this issue please let us know here: -> https://gitlab.com/jeseibel/distant-horizons/-/issues/233 -
## Compiling @@ -179,7 +173,7 @@ The Minecraft source code is NOT added to your workspace in an editable way. Min Source code uses Mojang mappings & [Parchment](https://parchmentmc.org/) mappings. -To generate the source code run `./gradlew genSources` +To generate the source code run `./gradlew genSources`
If your IDE fails to auto-detect the source jars when browsing Minecraft classes; manually select the JAR file ending with -sources.jar when prompted by your IDE.
(In IntelliJ it's at the top where it says "choose sources" when browsing a Minecraft class) @@ -187,12 +181,12 @@ If your IDE fails to auto-detect the source jars when browsing Minecraft classes ## Other Useful commands -Run the standalone jar: `./gradlew run` -Build the standalone jar: `./gradlew core:build` -Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build` -Only build Forge: `./gradlew forge:assemble` or `./gradlew forge:build` -Run the Fabric client (for debugging): `./gradlew fabric:runClient` -Run the Forge client (for debugging): `./gradlew forge:runClient` +Run the standalone jar: `./gradlew run`
+Build the standalone jar: `./gradlew core:build`
+Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build`
+Only build Forge: `./gradlew forge:assemble` or `./gradlew forge:build`
+Run the Fabric client (for debugging): `./gradlew fabric:runClient`
+Run the Forge client (for debugging): `./gradlew forge:runClient`
To build all versions: `./buildAll` (all builds will end up in the `Merged` folder) From 2db20f8f24fb6b1f5c8889cda61cdfa70c1b7474 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 09:53:34 -0500 Subject: [PATCH 163/301] Add Sqlite Write Ahead Log to Sqlite --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index bb4078a9e..487c0ff2e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ build.properties # Sqlite databases *.sqlite *.sqlite-journal +*.sqlite-shm +*.sqlite-wal From 9af71ac0ea1e46c7cd18f812f91aa05943ec53c0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 10:06:09 -0500 Subject: [PATCH 164/301] Fix API enums missing "DhApi" prefix and remove unused Enums/code --- .../common/wrappers/gui/ClassicConfigGUI.java | 4 ++-- .../common/wrappers/gui/updater/UpdateModScreen.java | 8 ++------ .../common/wrappers/minecraft/MinecraftClientWrapper.java | 4 ++-- coreSubProjects | 2 +- .../fabric/mixins/client/MixinMinecraft.java | 5 ++--- .../forge/mixins/client/MixinMinecraft.java | 5 ++--- .../neoforge/mixins/client/MixinMinecraft.java | 4 ++-- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 7577120fb..5ee0bab21 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -16,7 +16,7 @@ import java.util.regex.Pattern; // Logger (for debug stuff) import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui; -import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.config.ConfigBase; import com.seibel.distanthorizons.core.config.types.*; @@ -244,7 +244,7 @@ public class ClassicConfigGUI } // Changelog button - if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE) + if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE) { this.addBtn(new TexturedButtonWidget( // Where the button is on the screen diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 1662849bd..0af31a6a1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -1,23 +1,19 @@ package com.seibel.distanthorizons.common.wrappers.gui.updater; -import com.mojang.blaze3d.platform.NativeImage; -import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.DhScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.core.jar.ModJarInfo; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; -import com.seibel.distanthorizons.core.jar.JarUtils; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; -import net.minecraft.client.Minecraft; #if MC_VER >= MC_1_20_1 import net.minecraft.client.gui.GuiGraphics; #else import com.mojang.blaze3d.vertex.PoseStack; #endif import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.resources.ResourceLocation; import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*; @@ -92,7 +88,7 @@ public class UpdateModScreen extends DhScreen e.printStackTrace(); } - if (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE) + if (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE) { this.addBtn(new TexturedButtonWidget( // Where the button is on the screen diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index ba52253ae..e7df9f1bc 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.UUID; import com.mojang.blaze3d.platform.NativeImage; -import com.seibel.distanthorizons.api.enums.config.ELodShading; +import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; @@ -113,7 +113,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra @Override public float getShade(EDhDirection lodDirection) { - ELodShading lodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get(); + EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get(); switch (lodShading) { default: diff --git a/coreSubProjects b/coreSubProjects index f09818e56..b4b7738aa 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f09818e564da8d17cb858172469949af9a4356e9 +Subproject commit b4b7738aa64e23a0282994a3c9e7558766a8b40e diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 3e7e1c12b..388c0f201 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.fabric.mixins.client; -import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; @@ -9,7 +9,6 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -77,7 +76,7 @@ public class MixinMinecraft Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); }; } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index b8c25e6e1..bcf833e3e 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.forge.mixins.client; -import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; @@ -9,7 +9,6 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -77,7 +76,7 @@ public class MixinMinecraft Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); }; } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java index 9ad50c0dd..b9a266764 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.neoforge.mixins.client; -import com.seibel.distanthorizons.api.enums.config.EUpdateBranch; +import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch; import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; @@ -76,7 +76,7 @@ public class MixinMinecraft Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); }; } From 09c788e495258b57a58f7eaed72f22b0f7645af4 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 10:28:50 -0500 Subject: [PATCH 165/301] Fix removed Screen imports --- .../distanthorizons/fabric/mixins/client/MixinMinecraft.java | 3 ++- .../distanthorizons/forge/mixins/client/MixinMinecraft.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 388c0f201..6501977dd 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -9,6 +9,7 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -50,7 +51,7 @@ public class MixinMinecraft { instance.setScreen(new UpdateModScreen( new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); } else diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index bcf833e3e..699b8017f 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -9,6 +9,7 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -50,7 +51,7 @@ public class MixinMinecraft { instance.setScreen(new UpdateModScreen( new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); } else From dbc9cbb418cfa583e370509219045e5ca6631e30 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Apr 2024 12:37:44 -0500 Subject: [PATCH 166/301] Have grass fade to dirt for walls --- .../wrappers/block/BlockStateWrapper.java | 7 +++++- .../wrappers/world/ClientLevelWrapper.java | 23 +++++++++++++++++++ coreSubProjects | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 3e3a901dd..4b2d1e0c5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -69,6 +69,8 @@ public class BlockStateWrapper implements IBlockStateWrapper public static final String AIR_STRING = "AIR"; public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null); + public static final String DIRT_RESOURCE_LOCATION_STRING = "minecraft:dirt"; + // TODO: Make this changeable through the config public static final String[] RENDERER_IGNORED_BLOCKS_RESOURCE_LOCATIONS = { AIR_STRING, "minecraft:barrier", "minecraft:structure_void", "minecraft:light", "minecraft:tripwire" }; public static HashSet rendererIgnoredBlocks = null; @@ -521,9 +523,12 @@ public class BlockStateWrapper implements IBlockStateWrapper { return IrisBlockMaterial.METAL; } + else if (serialString.contains("grass_block")) + { + return IrisBlockMaterial.GRASS; + } else if ( serialString.contains("dirt") - || serialString.contains("grass_block") || serialString.contains("gravel") || serialString.contains("mud") || serialString.contains("podzol") 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 989d017bc..b51737876 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 @@ -30,6 +30,7 @@ import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; public class ClientLevelWrapper implements IClientLevelWrapper @@ -41,6 +42,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper private final ClientLevel level; private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this); + private BlockStateWrapper dirtBlockWrapper; + //=============// @@ -116,6 +119,26 @@ public class ClientLevelWrapper implements IClientLevelWrapper return this.blockMap.getColor(((BlockStateWrapper) blockState).blockState, (BiomeWrapper) biome, pos); } + @Override + public int getDirtBlockColor() + { + if (this.dirtBlockWrapper == null) + { + try + { + this.dirtBlockWrapper = (BlockStateWrapper) BlockStateWrapper.deserialize(BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING, this); + } + catch (IOException e) + { + // shouldn't happen, but just in case + LOGGER.warn("Unable to get dirt color with resource location ["+BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING+"] with level ["+this+"].", e); + return -1; + } + } + + return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO); + } + @Override public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); } diff --git a/coreSubProjects b/coreSubProjects index b4b7738aa..10d9282df 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b4b7738aa64e23a0282994a3c9e7558766a8b40e +Subproject commit 10d9282df77f649a8e563d007e1197b6193c8efd From 8f2df2396de235045a8fb727be6da8e877f79e17 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 7 Apr 2024 21:42:39 -0500 Subject: [PATCH 167/301] Improve grass side rendering and add a config --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 10d9282df..1ff4a56e2 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 10d9282df77f649a8e563d007e1197b6193c8efd +Subproject commit 1ff4a56e2d8848a364276c1a035c824d3ee526e8 From 26da69c875d73bee5f8dede4cf1fe92cd1dd2142 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 8 Apr 2024 07:17:30 -0500 Subject: [PATCH 168/301] Remove deprecated DhApiScreenResizeEvent --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 1ff4a56e2..d8bac9df8 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1ff4a56e2d8848a364276c1a035c824d3ee526e8 +Subproject commit d8bac9df8cc834dec5315ca8e0e5ac9ed3fd3af4 From 23a107682c6ced80ddc1ab798ed07240ed7f51a1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 8 Apr 2024 07:23:49 -0500 Subject: [PATCH 169/301] Mark Iris 1.7.0 and older as incompatible --- versionProperties/1.20.4.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 1f588d1db..7ee65a149 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -20,7 +20,7 @@ fabric_api_version=0.91.2+1.20.4 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "<1.7.0" } fabric_recommend_list={ "indium": "*" } # Fabric mod run From f82b7ec6086ed6729529b07567d33373447d2066 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 9 Apr 2024 07:48:39 -0500 Subject: [PATCH 170/301] Improve file handler speed --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index d8bac9df8..a0e7bb94c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit d8bac9df8cc834dec5315ca8e0e5ac9ed3fd3af4 +Subproject commit a0e7bb94c63935f446b1be727ae98d72571f0fef From c815591565bdcfcf8f757b55bbf497165b23ce40 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 10 Apr 2024 07:11:30 -0500 Subject: [PATCH 171/301] Fix Z-fighting at very high heights --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a0e7bb94c..35681fe9a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a0e7bb94c63935f446b1be727ae98d72571f0fef +Subproject commit 35681fe9a54f750f11086cf587a41a3292c8164d From 69483067b4ea6b81a6dcff59eb129436408bf6ea Mon Sep 17 00:00:00 2001 From: cola98765 Date: Wed, 10 Apr 2024 13:40:32 +0000 Subject: [PATCH 172/301] Made leaves color like if they are in fancy setting. Still no config, but with all other changes to colors this might fit better. --- .../wrappers/block/cache/ClientBlockStateCache.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 00ae43a89..a67a8260e 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 @@ -231,10 +231,16 @@ public class ClientBlockStateCache { //switch (//FIXME add config option) // case BLACK: - a = 255; //simulate black background of fast leaves + // a = 255; //simulate black background of fast leaves // break; // case IGNORE: - // continue; //same long grass + if (a == 0) { + continue; //same long grass + } + else + { + a = 255 //just in case there are semi transparent pixels + } // break; // case TRANSPARENT: // break; //do nothing, let it count towards transparency From 6e2eb7d1ac2ef08d672df2cdfc67f20680402c9e Mon Sep 17 00:00:00 2001 From: cola98765 Date: Wed, 10 Apr 2024 13:42:15 +0000 Subject: [PATCH 173/301] I may be dumb --- .../common/wrappers/block/cache/ClientBlockStateCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a67a8260e..01b89f04f 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 @@ -239,7 +239,7 @@ public class ClientBlockStateCache } else { - a = 255 //just in case there are semi transparent pixels + a = 255; //just in case there are semi transparent pixels } // break; // case TRANSPARENT: From 59555d1ca85123800870ff04c3013bb39702ab93 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 11:19:11 -0500 Subject: [PATCH 174/301] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 35681fe9a..4a40e19b3 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 35681fe9a54f750f11086cf587a41a3292c8164d +Subproject commit 4a40e19b3464b9b8eced110e9f0f706d1b78e30b From f40f7afab319caadf124e62430e8ad74f20b63d7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 12:14:59 -0500 Subject: [PATCH 175/301] speed up initial loading when DB migration is necessary --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 4a40e19b3..94304eb05 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4a40e19b3464b9b8eced110e9f0f706d1b78e30b +Subproject commit 94304eb055969e1262feba280fcceea96e3bcdd5 From b2986ec782738e08f227e6450c6689da2d9d7338 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 13:35:22 -0500 Subject: [PATCH 176/301] Fix fabric unnecessarily unloading levels when respawning --- coreSubProjects | 2 +- .../client/MixinClientPacketListener.java | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 94304eb05..169429fe4 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 94304eb055969e1262feba280fcceea96e3bcdd5 +Subproject commit 169429fe487c3dae44c387af43c4449c9815db04 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java index 2e7716b87..2430745bb 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java @@ -7,6 +7,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientPacketListener; 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; @@ -23,13 +24,29 @@ public class MixinClientPacketListener @Shadow private ClientLevel level; + @Unique + private ClientLevel previousLevel; + + @Inject(method = "handleLogin", at = @At("RETURN")) void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); } @Inject(method = "handleRespawn", at = @At("HEAD")) - void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level)); } + void onHandleRespawnStart(CallbackInfo ci) { this.previousLevel = this.level; } @Inject(method = "handleRespawn", at = @At("RETURN")) - void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); } + void onHandleRespawnEnd(CallbackInfo ci) + { + // If the player changes dimensions the "this.level" will be changed halfway through the respawn method. + // By checking if the object references are the same, we can see if the previous level should be unloaded + // or if the player just respawned in the same level. + if (this.previousLevel != this.level) + { + ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.previousLevel)); + ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); + } + + this.previousLevel = null; + } #if MC_VER < MC_1_19_4 @Inject(method = "cleanup", at = @At("HEAD")) From a680596b3efeaa071c8dd595e8e86bc507dd737a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 14:25:34 -0500 Subject: [PATCH 177/301] log migration status in F3 menu and chat --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 169429fe4..7d4d89922 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 169429fe487c3dae44c387af43c4449c9815db04 +Subproject commit 7d4d899226d5586f70e55db8ae2b7255678e3bdc From adb70857fed8e888cfbd3d9dfb2c7c07efa69827 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 17:53:32 -0500 Subject: [PATCH 178/301] Fix migration messages --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 7d4d89922..6e0071a04 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7d4d899226d5586f70e55db8ae2b7255678e3bdc +Subproject commit 6e0071a04695f6131b333e95ae86b3b4045187e5 From a8a22fd9fea430c1c953518ae37bf3373861ba91 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 21:15:37 -0500 Subject: [PATCH 179/301] Fix Iris incompatibility check for 1.20.4 and add for 1.20.2 and lower --- versionProperties/1.16.5.properties | 2 +- versionProperties/1.17.1.properties | 2 +- versionProperties/1.18.2.properties | 2 +- versionProperties/1.19.2.properties | 2 +- versionProperties/1.19.4.properties | 2 +- versionProperties/1.20.1.properties | 2 +- versionProperties/1.20.2.properties | 2 +- versionProperties/1.20.4.properties | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index dae7f1dc0..9740ae07d 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -21,7 +21,7 @@ fabric_api_version=0.42.0+1.16 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "*" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 4b5b8dfc9..bd823e4ae 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -21,7 +21,7 @@ fabric_api_version=0.46.1+1.17 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "*" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index e168e4f1b..a14c7cacb 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -22,7 +22,7 @@ fabric_api_version=0.76.0+1.18.2 immersive_portals_version=v1.4.11-1.18 canvas_version=mc118:1.0.2616 - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "*" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index 34e38b150..0e0576876 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -21,7 +21,7 @@ fabric_api_version=0.76.1+1.19.2 immersive_portals_version= canvas_version=mc119-1.0.2480 - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "*" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index c3a91dfda..c5c107ea3 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -20,7 +20,7 @@ fabric_api_version=0.87.1+1.19.4 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "*" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index ba4d8188b..27d2166ad 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -20,7 +20,7 @@ fabric_api_version=0.90.4+1.20.1 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "<=1.6.20" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 1f15abab5..6678cd53e 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -20,7 +20,7 @@ fabric_api_version=0.90.4+1.20.2 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ } + fabric_incompatibility_list={ "iris": "<=1.6.20" } fabric_recommend_list={ "indium": "*" } # Fabric mod run diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 7ee65a149..e8e2d6125 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -20,7 +20,7 @@ fabric_api_version=0.91.2+1.20.4 immersive_portals_version= canvas_version= - fabric_incompatibility_list={ "iris": "<1.7.0" } + fabric_incompatibility_list={ "iris": "<=1.6.20" } fabric_recommend_list={ "indium": "*" } # Fabric mod run From c1bd3585022bde817d7707e6ab4e886974754f07 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Apr 2024 21:24:58 -0500 Subject: [PATCH 180/301] fix fastutil not being relocated --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 69905fd02..2ff04b96a 100644 --- a/build.gradle +++ b/build.gradle @@ -222,6 +222,7 @@ 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) @@ -310,6 +311,9 @@ 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 8a9bfa3d333e5e8573984a1ca566ec0f455557f6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Apr 2024 21:16:50 -0500 Subject: [PATCH 181/301] fix unnecessary issues with javax and jetbrain compile time annotations --- .gitignore | 2 +- build.gradle | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f8cd8af3e..e876e032c 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,5 @@ build.properties *.sqlite-shm *.sqlite-wal -# Don't add access transformers to git as it's dynamically generated +# Don't add access transformers to git as they're dynamically generated accesstransformer.cfg diff --git a/build.gradle b/build.gradle index 558f5b397..904a2bc1e 100644 --- a/build.gradle +++ b/build.gradle @@ -193,6 +193,10 @@ subprojects { p -> implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") + + // javax.annotation's (IE @Nullable) + // only needed at compile time to prevent issues between javax.annotation's and org.jetbrains.annotations + implementation("com.google.code.findbugs:jsr305:3.0.2") // JOML if (project.hasProperty("embed_joml") && embed_joml == "true") From da72f783edb9ad18a5d35d560adbaec227490220 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Apr 2024 21:17:02 -0500 Subject: [PATCH 182/301] minor forge modinfo fix --- .../main/java/com/seibel/distanthorizons/forge/ForgeMain.java | 2 +- versionProperties/1.20.4.properties | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index c7d531521..3a853f08e 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -70,7 +70,7 @@ import java.util.function.Consumer; * If you are looking for the real start of the mod * check out the ClientProxy. */ -@Mod("distanthorizons") // TODO: Change it back to ModInfo.ID when forge works +@Mod(ModInfo.ID) public class ForgeMain extends AbstractModInitializer { public ForgeMain() diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index a7a9fb886..128c77dd8 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -4,7 +4,8 @@ minecraft_version=1.20.4 parchment_version=1.20.2:2023.12.10 compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 -builds_for=fabric,neoforge,forge +builds_for=fabric,forge +# neoforge can be added once the issue with mixins has been resolved # Fabric loader fabric_loader_version=0.15.1 From 55e5c64c688aa4f354f594f6b3b0c1f703682414 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Apr 2024 21:17:15 -0500 Subject: [PATCH 183/301] update manifold 2024.1.0 -> 2024.1.9 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4636bc7cd..547ae5860 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues mod_discord=https://discord.gg/xAB8G4cENx # Global Plugin Versions -manifold_version=2024.1.0 +manifold_version=2024.1.9 nightconfig_version=3.6.6 lz4_version=1.8.0 zstd_version=1.5.5-11 From c0ccef7e82af8d8c9f99c39185b82ed77329999f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 16 Apr 2024 07:32:21 -0500 Subject: [PATCH 184/301] Fix common complaining about missing "prepareWorkspace" task --- common/build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/build.gradle b/common/build.gradle index d4bf54ebe..648d1e67b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -13,4 +13,9 @@ unimined.minecraft { dependencies { -} \ No newline at end of file +} + + +tasks.register('prepareWorkspace') { + // the build system complains if prepareWorkspace isn't present +} From d17897f27679f8992fd4325981a2596aa56c9bd3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 18 Apr 2024 07:47:47 -0500 Subject: [PATCH 185/301] Fix transparent blocks glowing (thanks IMS) --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 6e0071a04..a2e2559b2 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 6e0071a04695f6131b333e95ae86b3b4045187e5 +Subproject commit a2e2559b2630e9da21c805aeda4a1174ebf81ab9 From 982ae0c0a0f37b642175302c9026ab4c891e34bd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 18 Apr 2024 21:06:32 -0500 Subject: [PATCH 186/301] speed up initial LOD loading --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a2e2559b2..031742a95 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a2e2559b2630e9da21c805aeda4a1174ebf81ab9 +Subproject commit 031742a951229696808d335b2042f53daade9182 From ed28bcd0ba9462bf97175b8b33a94e1a0d60d309 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 18 Apr 2024 21:07:09 -0500 Subject: [PATCH 187/301] fix forge issues with already deleted lib folders --- forge/build.gradle | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/forge/build.gradle b/forge/build.gradle index 18ae90bde..57801c58f 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -62,9 +62,16 @@ afterEvaluate { // TODO can we just ignore these folders instead? // deleting them may cause issues if the OS locks the files // and it feels hacky - delete file("../common/build/libs") - delete file("../coreSubProjects/core/build/libs") - delete file("../coreSubProjects/api/build/libs") + try + { + delete file("../common/build/libs") + delete file("../coreSubProjects/core/build/libs") + delete file("../coreSubProjects/api/build/libs") + } + catch (ignored) + { + println('lib directories already deleted') + } } } From d7f789c402bf9d41427e436a33f85e50ed4efb04 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Apr 2024 11:23:47 -0500 Subject: [PATCH 188/301] Fix fastutil shading fastutil is already in MC and used by some world gen so shading it causes issues. --- build.gradle | 7 +------ coreSubProjects | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 904a2bc1e..b0d5fd26a 100644 --- a/build.gradle +++ b/build.gradle @@ -216,9 +216,6 @@ subprojects { p -> shadowMc("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") shadowMc("com.electronwill.night-config:json:${rootProject.nightconfig_version}") - // Fastutil - shadowMc("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") - // SVG (not needed atm) //shadowMc("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" @@ -595,6 +589,7 @@ allprojects { p -> runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" implementation "org.joml:joml:${rootProject.joml_version}" + implementation "it.unimi.dsi:fastutil:${rootProject.fastutil_version}" // Some other dependencies diff --git a/coreSubProjects b/coreSubProjects index 031742a95..22f4757aa 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 031742a951229696808d335b2042f53daade9182 +Subproject commit 22f4757aae28aab5a29ec5a8c212681ad7510403 From a96c08cad4f268a4bac987aeb03b5c2102d5c6d9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Apr 2024 12:16:33 -0500 Subject: [PATCH 189/301] Clean up DhLitWorldGenRegion --- .../mimicObject/DhLitWorldGenRegion.java | 136 ++++++++++-------- coreSubProjects | 2 +- 2 files changed, 79 insertions(+), 59 deletions(-) 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 b73e18c43..696304b69 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 @@ -25,9 +25,11 @@ import java.util.concurrent.locks.ReentrantLock; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.util.LodUtil; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.SpawnerBlock; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -59,19 +61,23 @@ public class DhLitWorldGenRegion extends WorldGenRegion { private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); + private static ChunkStatus debugTriggeredForStatus = null; + + public final DummyLightEngine lightEngine; public final BatchGenerationEnvironment.EmptyChunkGenerator generator; public final int writeRadius; public final int size; + private final ChunkPos firstPos; private final List cache; - Long2ObjectOpenHashMap chunkMap = new Long2ObjectOpenHashMap(); + private final Long2ObjectOpenHashMap chunkMap = new Long2ObjectOpenHashMap(); /** * Present to reduce the chance that we accidentally break underlying MC code that isn't thread safe, * specifically: "it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.getAndMoveToFirst()" */ - ReentrantLock getChunkLock = new ReentrantLock(); + private final ReentrantLock getChunkLock = new ReentrantLock(); #if MC_VER < MC_1_18_2 private ChunkPos overrideCenterPos = null; @@ -198,12 +204,9 @@ public class DhLitWorldGenRegion extends WorldGenRegion #endif } - // Skip BlockEntity stuff. It aren't really needed + /** Skip BlockEntity stuff. They aren't needed for our use case. */ @Override - public boolean addFreshEntity(Entity entity) - { - return true; - } + public boolean addFreshEntity(@NotNull Entity entity) { return true; } // Allays have empty chunks even if it's outside the worldGenRegion // @Override @@ -214,13 +217,13 @@ public class DhLitWorldGenRegion extends WorldGenRegion // Override to ensure no other mod mixins cause skipping the overrided // getChunk(...) @Override - public ChunkAccess getChunk(int i, int j) + public @NotNull ChunkAccess getChunk(int chunkX, int chunkZ) { try { // lock is to prevent issues with underlying MC code that doesn't support multithreading this.getChunkLock.lock(); - return this.getChunk(i, j, ChunkStatus.EMPTY); + return this.getChunk(chunkX, chunkZ, ChunkStatus.EMPTY); } finally { @@ -231,13 +234,19 @@ public class DhLitWorldGenRegion extends WorldGenRegion // Override to ensure no other mod mixins cause skipping the overrided // getChunk(...) @Override - public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus) + public @NotNull ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus) { try { // lock is to prevent issues with underlying MC code that doesn't support multithreading this.getChunkLock.lock(); - return this.getChunk(i, j, chunkStatus, true); + + ChunkAccess chunk = this.getChunk(chunkX, chunkZ, chunkStatus, false); + if (chunk == null) + { + LodUtil.assertNotReach("getChunk shouldn't return null values"); + } + return chunk; } finally { @@ -245,28 +254,12 @@ public class DhLitWorldGenRegion extends WorldGenRegion } } - // Use this instead of super.getChunk() to bypass C2ME concurrency checks - private ChunkAccess superGetChunk(int x, int z, ChunkStatus cs) - { - int k = x - firstPos.x; - int l = z - firstPos.z; - return cache.get(k + l * size); - } - - // Use this instead of super.hasChunk() to bypass C2ME concurrency checks - public boolean superHasChunk(int x, int z) - { - int k = x - firstPos.x; - int l = z - firstPos.z; - return l >= 0 && l < size && k >= 0 && k < size; - } - - // Allow creating empty chunks even if it's outside the worldGenRegion + /** Allows creating empty chunks even if they're outside the worldGenRegion */ @Override @Nullable - public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl) + public ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus, boolean returnNullIfChunkDoesntHaveStatus) { - ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl); + ChunkAccess chunk = this.getChunkAccess(chunkX, chunkZ, chunkStatus, returnNullIfChunkDoesntHaveStatus); if (chunk instanceof LevelChunk) { chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER >= MC_1_18_2 , true #endif ); @@ -274,67 +267,94 @@ public class DhLitWorldGenRegion extends WorldGenRegion return chunk; } - private static ChunkStatus debugTriggeredForStatus = null; - - private ChunkAccess getChunkAccess(int i, int j, ChunkStatus chunkStatus, boolean bl) + private ChunkAccess getChunkAccess(int chunkX, int chunkZ, ChunkStatus chunkStatus, boolean nonNull) { - ChunkAccess chunk = superHasChunk(i, j) ? superGetChunk(i, j, ChunkStatus.EMPTY) : null; + ChunkAccess chunk = this.superHasChunk(chunkX, chunkZ) ? this.superGetChunk(chunkX, chunkZ) : null; if (chunk != null && chunk.getStatus().isOrAfter(chunkStatus)) { return chunk; } - if (!bl) + else if (!nonNull) + { + // no chunk found with the necessary status and null return values are allowed return null; + } + + + // we need a non-null chunk if (chunk == null) { - chunk = chunkMap.get(ChunkPos.asLong(i, j)); + // check memory + chunk = this.chunkMap.get(ChunkPos.asLong(chunkX, chunkZ)); if (chunk == null) { - chunk = generator.generate(i, j); + // chunk isn't in memory, generate a new one + chunk = this.generator.generate(chunkX, chunkZ); if (chunk == null) + { throw new NullPointerException("The provided generator should not return null!"); - chunkMap.put(ChunkPos.asLong(i, j), chunk); + } + this.chunkMap.put(ChunkPos.asLong(chunkX, chunkZ), chunk); } } + if (chunkStatus != ChunkStatus.EMPTY && chunkStatus != debugTriggeredForStatus) { LOGGER.info("WorldGen requiring " + chunkStatus + " outside expected range detected. Force passing EMPTY chunk and seeing if it works."); debugTriggeredForStatus = chunkStatus; } + return chunk; } - /** Overriding allows us to use our own lighting engine */ - @Override - public LevelLightEngine getLightEngine() { return this.lightEngine; } - - /** Overriding allows us to use our own lighting engine */ - @Override - public int getBrightness(LightLayer lightLayer, BlockPos blockPos) { return 0; } - - /** Overriding allows us to use our own lighting engine */ - @Override - public int getRawBrightness(BlockPos blockPos, int i) { return 0; } - - /** Overriding allows us to use our own lighting engine */ - @Override - public boolean canSeeSky(BlockPos blockPos) + /** Use this instead of super.hasChunk() to bypass C2ME concurrency checks */ + public boolean superHasChunk(int x, int z) { - return (getBrightness(LightLayer.SKY, blockPos) >= getMaxLightLevel()); + int k = x - this.firstPos.x; + int l = z - this.firstPos.z; + return l >= 0 && l < this.size && k >= 0 && k < this.size; } - public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) + /** Use this instead of super.getChunk() to bypass C2ME concurrency checks */ + private ChunkAccess superGetChunk(int x, int z) { - return calculateBlockTint(blockPos, colorResolver); + int k = x - this.firstPos.x; + int l = z - this.firstPos.z; + return this.cache.get(k + l * this.size); + } + + + /** Overriding allows us to use our own lighting engine */ + @Override + public @NotNull LevelLightEngine getLightEngine() { return this.lightEngine; } + + /** Overriding allows us to use our own lighting engine */ + @Override + public int getBrightness(@NotNull LightLayer lightLayer, @NotNull BlockPos blockPos) { return 0; } + + /** Overriding allows us to use our own lighting engine */ + @Override + public int getRawBrightness(@NotNull BlockPos blockPos, int i) { return 0; } + + /** Overriding allows us to use our own lighting engine */ + @Override + public boolean canSeeSky(@NotNull BlockPos blockPos) + { + return (this.getBrightness(LightLayer.SKY, blockPos) >= this.getMaxLightLevel()); + } + + public int getBlockTint(@NotNull BlockPos blockPos, @NotNull ColorResolver colorResolver) + { + return this.calculateBlockTint(blockPos, colorResolver); } private Biome _getBiome(BlockPos pos) { #if MC_VER >= MC_1_18_2 - return getBiome(pos).value(); + return this.getBiome(pos).value(); #else - return getBiome(pos); + return this.getBiome(pos); #endif } diff --git a/coreSubProjects b/coreSubProjects index 22f4757aa..3826c83d8 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 22f4757aae28aab5a29ec5a8c212681ad7510403 +Subproject commit 3826c83d898e6cdb8bdaf88385838a5edd254a3c From befa3b375ec4e1dafb314bfbfc46e660dfdd25c6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Apr 2024 12:36:33 -0500 Subject: [PATCH 190/301] Fix compiling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 3826c83d8..88ff9e7cd 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 3826c83d898e6cdb8bdaf88385838a5edd254a3c +Subproject commit 88ff9e7cde382deb511563b3af330ab45deaceee From 18859d22a8be26925f24c40030255c04ee448595 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 20 Apr 2024 15:36:42 -0500 Subject: [PATCH 191/301] Fix getChunk null assertion --- .../mimicObject/DhLitWorldGenRegion.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 696304b69..f8cdef103 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 @@ -241,7 +241,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion // lock is to prevent issues with underlying MC code that doesn't support multithreading this.getChunkLock.lock(); - ChunkAccess chunk = this.getChunk(chunkX, chunkZ, chunkStatus, false); + ChunkAccess chunk = this.getChunk(chunkX, chunkZ, chunkStatus, true); if (chunk == null) { LodUtil.assertNotReach("getChunk shouldn't return null values"); @@ -257,9 +257,9 @@ public class DhLitWorldGenRegion extends WorldGenRegion /** Allows creating empty chunks even if they're outside the worldGenRegion */ @Override @Nullable - public ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus, boolean returnNullIfChunkDoesntHaveStatus) + public ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus, boolean returnNonNull) { - ChunkAccess chunk = this.getChunkAccess(chunkX, chunkZ, chunkStatus, returnNullIfChunkDoesntHaveStatus); + ChunkAccess chunk = this.getChunkAccess(chunkX, chunkZ, chunkStatus, returnNonNull); if (chunk instanceof LevelChunk) { chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER >= MC_1_18_2 , true #endif ); @@ -267,14 +267,18 @@ public class DhLitWorldGenRegion extends WorldGenRegion return chunk; } - private ChunkAccess getChunkAccess(int chunkX, int chunkZ, ChunkStatus chunkStatus, boolean nonNull) + /** + * @param returnNonNull if true this method will always return a non-null chunk, + * if false it will return null if no chunk exists at the given position with the given status + */ + private ChunkAccess getChunkAccess(int chunkX, int chunkZ, ChunkStatus chunkStatus, boolean returnNonNull) { ChunkAccess chunk = this.superHasChunk(chunkX, chunkZ) ? this.superGetChunk(chunkX, chunkZ) : null; if (chunk != null && chunk.getStatus().isOrAfter(chunkStatus)) { return chunk; } - else if (!nonNull) + else if (!returnNonNull) { // no chunk found with the necessary status and null return values are allowed return null; From ffda83c25ddcb2c39551edfc1a86dc4852804bae Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:53:32 +1000 Subject: [PATCH 192/301] Add core to gradle --- build.gradle | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/build.gradle b/build.gradle index b0d5fd26a..809265b1a 100644 --- a/build.gradle +++ b/build.gradle @@ -173,7 +173,7 @@ subprojects { p -> } } - dependencies { + dependencies { // TODO: Move the libraries only used in core to the core's build.gradle (Remember to also move the shadowJar stuff over there) //=====================// // shared dependencies // //=====================// @@ -237,7 +237,7 @@ subprojects { p -> // Add core if (isMinecraftSubProject) { - compileOnly(project(":core")) { + compileOnly(project(path: ':core', configuration: 'shadowedArtifact')) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" @@ -561,45 +561,6 @@ allprojects { p -> // TODO: If neoforged is ever needed, should we use that, or call it a forge mod? } - // Adds some dependencies that are in vanilla but not in core - if (p == project(":core")) { - OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem; - - // Set the OS lwjgl is using to the current os - project.ext.lwjglNatives = "natives-" + os.toFamilyName() - - // TODO: Include Minecraft in core-projects but dont include MC code stuff - dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core - // Imports most of lwjgl's libraries (well, only the ones that we need) - implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions - - // REMEMBER: Dont shadow stuff here, these are just the libs that are included in Minecraft so that the core can use - implementation "org.lwjgl:lwjgl" - implementation "org.lwjgl:lwjgl-assimp" - implementation "org.lwjgl:lwjgl-glfw" - implementation "org.lwjgl:lwjgl-openal" - implementation "org.lwjgl:lwjgl-opengl" - implementation "org.lwjgl:lwjgl-stb" - implementation "org.lwjgl:lwjgl-tinyfd" - runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" - runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" - implementation "org.joml:joml:${rootProject.joml_version}" - implementation "it.unimi.dsi:fastutil:${rootProject.fastutil_version}" - - - // Some other dependencies - implementation("org.jetbrains:annotations:16.0.2") - implementation("com.google.code.findbugs:jsr305:3.0.2") - implementation("com.google.common:google-collect:0.5") - implementation("com.google.guava:guava:31.1-jre") - } - } - // TODO: Remove this as no loader needs this // - Fabric can rename which aw they use From 6c4740e8aad402dea25e1db3e5c35952c8ce084b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 24 Apr 2024 22:05:59 -0500 Subject: [PATCH 193/301] Remove Unimined and restore Architectury build system --- build.gradle | 294 ++++++++++++++++------------ common/build.gradle | 35 ++-- coreSubProjects | 2 +- fabric/build.gradle | 104 +++++----- forge/build.gradle | 176 ++++++++--------- neoforge/build.gradle | 131 +++++++++---- settings.gradle | 17 +- versionProperties/1.20.4.properties | 2 +- 8 files changed, 420 insertions(+), 341 deletions(-) diff --git a/build.gradle b/build.gradle index 809265b1a..2569c174a 100644 --- a/build.gradle +++ b/build.gradle @@ -7,16 +7,11 @@ plugins { // Plugin to create merged jars id "io.github.pacifistmc.forgix" version "1.2.6" - // Unimined is our all in one solution to minecraft loaders -// id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false // Unstable Release (TODO: Check back to see when the unstable branch fixes forge run without the jank) - id "xyz.wagyourtail.unimined" version "1.1.2-SNAPSHOT" apply false // LTS Release -} + // Manifold preprocessor + id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" - -// Transfers the values set in settings.gradle to the rest of the project -project.gradle.ext.getProperties().each { prop -> - rootProject.ext.set(prop.key, prop.value) -// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" + // Architectury is used here only as a replacement for forge's own loom + id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false } @@ -54,6 +49,14 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) new File(projectDir, "build.properties").text = sb.toString() } + + +// Transfers the values set in settings.gradle to the rest of the project +project.gradle.ext.getProperties().each { prop -> + rootProject.ext.set(prop.key, prop.value) +// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" +} +// Sets up manifold stuff writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex) @@ -61,7 +64,6 @@ writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex) // Sets up the version string (the name we use for our jar) rootProject.versionStr = rootProject.mod_version + "-" + rootProject.minecraft_version // + "-" + new Date().format("yyyy_MM_dd_HH_mm") - // Forgix settings (used for merging jars) forgix { group = "com.seibel.distanthorizons" @@ -92,7 +94,7 @@ forgix { } subprojects { p -> - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":forge") || p == project("WhateverLoaderWeAddLaterOn")" + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverWeAddLaterOn")" // Useful later on so we dont have duplicated code def isMinecraftSubProject = p != project(":core") && p != project(":api") @@ -100,68 +102,72 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" - if (p == project(":core")) + if (isMinecraftSubProject) + apply plugin: "systems.manifold.manifold-gradle-plugin" + if (p == project(":core")) apply plugin: "application" - if (isMinecraftSubProject) { - apply plugin: "xyz.wagyourtail.unimined" + // Apply forge's loom + if ( + (findProject(":forge") && p == project(":forge")) || + (findProject(":neoforge") && p == project(":neoforge")) + ) + apply plugin: "dev.architectury.loom" - unimined.minecraft(sourceSets.main, true) { - version = rootProject.minecraft_version - - def parchmentVersionParts = rootProject.parchment_version.split(":") - mappings { - mojmap() - parchment(parchmentVersionParts[0], parchmentVersionParts[1]) - devNamespace "mojmap" - } - - runs { - config("client") { - workingDir = rootProject.file("run") - } - config("server") { - workingDir = rootProject.file("run") // TODO: When running the server, would it be a better idea to change this to a different dir? - disabled = true // TODO: Once server-side support is added, remove this - } - } - } - if (p != project(":common")) { - tasks.withType(JavaCompile).configureEach { - source(project(":common").sourceSets.main.java) - source(project(":api").sourceSets.main.java) - source(project(":core").sourceSets.main.java) - } - } - } - - tasks.withType(GenerateModuleMetadata) { - enabled = false - } - - // Disable testing for projects that aren't the core or api project. - // If not done compiling will fail due to an issue with Manifold - if (isMinecraftSubProject) { - test { - enabled = false - } - compileTestJava { - enabled = false - } + // Set the manifold version (may not be required tough) + manifold { + manifoldVersion = rootProject.manifold_version } // set up custom configurations (configurations are a way to handle dependencies) configurations { // extends the shadowJar configuration - shadowMc // Configuration that doesn't contain coreProjects - + shadowMe // have implemented dependencies automatically embedded in the final jar - implementation.extendsFrom(shadowMc) + implementation.extendsFrom(shadowMe) - // Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way) - minecraftLibraries.extendsFrom(shadowMc) + // Configuration fpr core & api + coreProjects + shadowMe.extendsFrom(coreProjects) + + + // FIXME this additional configuration is necessary because forge + // needs forgeRuntimeLibrary, although adding it to shadowMe + // causes runtime issues where the libraries aren't properly added + forgeShadowMe + // this should match shadowMe pretty closely + implementation.extendsFrom(forgeShadowMe) + shadowMe.extendsFrom(forgeShadowMe) + forgeRuntimeLibrary.extendsFrom(forgeShadowMe) + + + if (isMinecraftSubProject && p != project(":common")) { + // Shadow common + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + if (findProject(":forge")) + developmentForge.extendsFrom common + if (findProject(":neoforge")) + developmentNeoForge.extendsFrom common + compileClasspath.extendsFrom coreProjects + runtimeClasspath.extendsFrom coreProjects + if (findProject(":forge")) + developmentForge.extendsFrom coreProjects + if (findProject(":neoforge")) + developmentNeoForge.extendsFrom coreProjects + + if (findProject(":fabricLike") && p != project(":fabricLike")) { + // Shadow fabricLike + fabricLike + shadowFabricLike + compileClasspath.extendsFrom fabricLike + runtimeClasspath.extendsFrom fabricLike + } + } } @@ -173,7 +179,7 @@ subprojects { p -> } } - dependencies { // TODO: Move the libraries only used in core to the core's build.gradle (Remember to also move the shadowJar stuff over there) + dependencies { //=====================// // shared dependencies // //=====================// @@ -184,47 +190,46 @@ subprojects { p -> } // Log4j - // TODO: Change to shadowCore later to work in the standalone jar + // TODO: Change to shadowMe later to work in the standalone jar // 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}") + // JOML + if (project.hasProperty("embed_joml") && embed_joml == "true") + forgeShadowMe("org.joml:joml:${rootProject.joml_version}") + else + implementation("org.joml:joml:${rootProject.joml_version}") + // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") - - // javax.annotation's (IE @Nullable) - // only needed at compile time to prevent issues between javax.annotation's and org.jetbrains.annotations - implementation("com.google.code.findbugs:jsr305:3.0.2") - // JOML - if (project.hasProperty("embed_joml") && embed_joml == "true") - shadowMc("org.joml:joml:${rootProject.joml_version}") - else - implementation("org.joml:joml:${rootProject.joml_version}") - // Compression - shadowMc("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 - shadowMc("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd - shadowMc("org.tukaani:xz:${rootProject.xz_version}") // LZMA - + 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 - shadowMc("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") + forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") // NightConfig (includes Toml & Json) - shadowMc("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") - shadowMc("com.electronwill.night-config:json:${rootProject.nightconfig_version}") + 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) - //shadowMc("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") +// forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") // Netty // Breaks 1.16.5 - //shadowMc("io.netty:netty-all:${rootProject.netty_version}") + //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 - shadowMc("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { + forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") { exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it } @@ -237,12 +242,11 @@ subprojects { p -> // Add core if (isMinecraftSubProject) { - compileOnly(project(path: ':core', configuration: 'shadowedArtifact')) { + coreProjects(project(":core")) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" - // Removed dependencies transitive false } @@ -250,12 +254,11 @@ subprojects { p -> // Add the api if (p != project(":api")) { - implementation(project(":api")) { + coreProjects(project(":api")) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" exclude group: "org.junit.jupiter", module: "junit-jupiter-engine" exclude group: "junit", module: "junit" - // Removed dependencies transitive false } @@ -264,19 +267,29 @@ subprojects { p -> // Add common if (isMinecraftSubProject && p != project(":common")) { // Common - compileOnly(project(":common")) { transitive false } + common(project(":common")) { transitive false } + shadowCommon(project(":common")) { transitive false } + + // FabricLike + if (findProject(":fabricLike") && p != project(":fabricLike")) { + fabricLike(project(path: ":fabricLike")) { transitive false } + shadowFabricLike(project(path: ":fabricLike")) { transitive false } + } } } shadowJar { - configurations = [project.configurations.shadowMc] - + configurations = [project.configurations.shadowMe] if (isMinecraftSubProject && p != project(":common")) { + configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location + + if (findProject(":fabricLike") && p != project(":fabricLike")) { + configurations.push(project.configurations.shadowFabricLike) // Shadow the fabricLike subproject + relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location + } } - - def librariesLocation = "distanthorizons.libraries" // LWJGL @@ -294,6 +307,9 @@ 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" @@ -311,33 +327,20 @@ subprojects { p -> // Put stuff from gradle.properties into the mod info processResources { - duplicatesStrategy = DuplicatesStrategy.WARN - // Include all the resources - from project(":common").sourceSets.main.resources - from project(":core").sourceSets.main.resources - from project(":api").sourceSets.main.resources - - // Copy accessWideners - // FIXME: remove copyCommonLoaderResources and use this instead (and if you are removing that task, also remove copyCoreResources while your at it) -// from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") -// into(file(p.file("build/resources/main"))) - rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" + def resourceTargets = [ // Location of where to inject the properties + // Holds info like git commit + // TODO: For some reason this script doesnt work with the core project + "build_info.json", - // Location of where to inject the properties - def resourceTargets = [ - // Holds info like git commit - // TODO: For some reason this script doesnt work with the core project - "build_info.json", + // Properties for each of the loaders + "fabric.mod.json", + "quilt.mod.json", + "META-INF/mods.toml", - // Properties for each of the loaders - "fabric.mod.json", - "quilt.mod.json", - "META-INF/mods.toml", - - // The mixins for each of the loaders - "DistantHorizons."+ p.name +".fabricLike.mixins.json" + // The mixins for each of the loaders + "DistantHorizons."+ p.name +".fabricLike.mixins.json" ] - def buildResourceTargets = ["$buildDir/resources/main/"] // Location of the built resources folder + def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder // Fix forge version numbering system as it is weird // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] @@ -345,7 +348,7 @@ subprojects { p -> // println compatible_forgemc_versions // Quilt's custom contributors system - // has to be in the format: + // This has to be like // "Person": "Developer", "Another person": "Developer" def quilt_contributors = [] def mod_author_list = mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",") @@ -397,14 +400,12 @@ subprojects { p -> // replace any properties in the sub-projects with the values defined here inputs.properties replaceProperties - replaceProperties.put("project", project) + replaceProperties.put "project", project filesMatching(resourceTargets) { expand replaceProperties } - - // copy all our resources into the loader specific resource directory - buildResourceTargets.each { target -> + intoTargets.each { target -> if (file(target).exists()) { copy { from(sourceSets.main.resources) { @@ -561,23 +562,64 @@ allprojects { p -> // TODO: If neoforged is ever needed, should we use that, or call it a forge mod? } + // Adds some dependencies that are in vanilla but not in core + if (p == project(":core")) { + OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem; + + // Set the OS lwjgl is using to the current os + project.ext.lwjglNatives = "natives-" + os.toFamilyName() + + dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core + // Imports most of lwjgl's libraries (well, only the ones that we need) + implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions + + // REMEMBER: Dont shadow stuff here, these are just the libs that are included in Minecraft so that the core can use + implementation "org.lwjgl:lwjgl" + implementation "org.lwjgl:lwjgl-assimp" + implementation "org.lwjgl:lwjgl-glfw" + implementation "org.lwjgl:lwjgl-openal" + implementation "org.lwjgl:lwjgl-opengl" + implementation "org.lwjgl:lwjgl-stb" + implementation "org.lwjgl:lwjgl-tinyfd" + runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" + implementation "org.joml:joml:${rootProject.joml_version}" + + + // Some other dependencies + implementation("org.jetbrains:annotations:16.0.2") + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.common:google-collect:0.5") + implementation("com.google.guava:guava:31.1-jre") + } + } + - // TODO: Remove this as no loader needs this - // - Fabric can rename which aw they use - // - (Neo)Forge converts the aw to their own at, which is stored at a different place task copyCommonLoaderResources(type: Copy) { from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") into(file(p.file("build/resources/main"))) rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" + + + // Move the fabricLike mixin to its different places for each subproject + if (findProject(":fabricLike")) { + from project(":fabricLike").file("src/main/resources/DistantHorizons.fabricLike.mixins.json") + into(file(p.file("build/resources/main"))) + rename "DistantHorizons.fabricLike.mixins.json", "DistantHorizons." + p.name + ".fabricLike.mixins.json" + } } - // TODO: Remove this later as we no longer need this. We are now including the resources in the processResources section task copyCoreResources(type: Copy) { from fileTree(project(":core").file("src/main/resources")) into p.file("build/resources/main") } - compileJava { + tasks.withType(JavaCompile) { if (isMinecraftSubProject) { options.release = rootProject.java_version as Integer options.compilerArgs += ["-Xplugin:Manifold"] diff --git a/common/build.gradle b/common/build.gradle index 648d1e67b..b6df3a307 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,21 +1,30 @@ -// Use Unimined's implimentation for MC as we can use Parchment mappings in common now! :tada: -// With Sponge's vanilla gradle, we cannot change the mappings to anything out of mojmaps -unimined.minecraft { - fabric { // TODO: Find a way to only include the mc stuff, not fabric's loader - loader rootProject.fabric_loader_version - accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) - skipInsertAw = true - } - - defaultRemapJar = false +plugins { + id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT" +} + +minecraft { + accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) + version(rootProject.minecraft_version) } dependencies { - + // So mixins can be written in common + compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' } -tasks.register('prepareWorkspace') { - // the build system complains if prepareWorkspace isn't present +publishing { + publications { + mavenCommon(MavenPublication) { + artifactId = rootProject.mod_readable_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + } } + diff --git a/coreSubProjects b/coreSubProjects index 88ff9e7cd..c89fcb094 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 88ff9e7cde382deb511563b3af330ab45deaceee +Subproject commit c89fcb094aafc829aa1e7e2ce2c3109e4cc0da9f diff --git a/fabric/build.gradle b/fabric/build.gradle index 1e0a557bb..36e00cc4b 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,49 +1,76 @@ -unimined.minecraft { - fabric { - loader rootProject.fabric_loader_version - accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")) +plugins { + id "fabric-loom" version "1.6-SNAPSHOT" +} - skipInsertAw = true +loom { + accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") + + // "runs" isn't required, but when we do need it then it can be useful + runs { + client { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + runDir("../run") + } + server { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + runDir("../run") + } } } +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null +} + + configurations { // The addModJar basically embeds the mod to the built jar addModJar include.extendsFrom addModJar modImplementation.extendsFrom addModJar - dummy } + + def addMod(path, enabled) { if (enabled == "2") dependencies { modImplementation(path) } else if (enabled == "1") - dependencies { compileOnly(path) } -} - -// TODO: There currently seems to be a bug which causes the regular addModJar to not work, swap back to the regular addModJar when fixed -def addModJar_(path) { - dependencies { - modImplementation(path) - include(path) - } + dependencies { modCompileOnly(path) } } dependencies { - annotationProcessor "javax.annotation:javax.annotation-api:1.3.2" - implementation("javax.annotation:javax.annotation-api:1.3.2") - runtimeOnly "javax.annotation:javax.annotation-api:1.3.2" - compileOnly "javax.annotation:javax.annotation-api:1.3.2" - modImplementation "javax.annotation:javax.annotation-api:1.3.2" + minecraft "com.mojang:minecraft:${minecraft_version}" + mappings loom.layered() { + // Mojmap mappings + officialMojangMappings() + // Parchment mappings (it adds parameter mappings & javadoc) + parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") + } + // Fabric loader + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + + +// annotationProcessor "javax.annotation:javax.annotation-api:1.3.2" +// implementation("javax.annotation:javax.annotation-api:1.3.2") +// runtimeOnly "javax.annotation:javax.annotation-api:1.3.2" +// compileOnly "javax.annotation:javax.annotation-api:1.3.2" +// modImplementation "javax.annotation:javax.annotation-api:1.3.2" // Fabric API - addModJar_(fabricApi.fabricModule("fabric-api-base", rootProject.fabric_api_version)) - addModJar_(fabricApi.fabricModule("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) - addModJar_(fabricApi.fabricModule("fabric-resource-loader-v0", rootProject.fabric_api_version)) - addModJar_(fabricApi.fabricModule("fabric-events-interaction-v0", rootProject.fabric_api_version)) - addModJar_(fabricApi.fabricModule("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy) - addModJar_(fabricApi.fabricModule("fabric-networking-api-v1", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-events-interaction-v0", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy) + addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version)) + // Mod Menu modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") @@ -105,6 +132,7 @@ remapJar { } + task deleteResources(type: Delete) { delete file("build/resources/main") } @@ -114,31 +142,15 @@ processResources { dependsOn(copyCommonLoaderResources) } -afterEvaluate { - runClient { - dependsOn(copyCoreResources) - dependsOn(copyCommonLoaderResources) -// jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) - finalizedBy(deleteResources) - } +runClient { + dependsOn(copyCoreResources) + dependsOn(copyCommonLoaderResources) + finalizedBy(deleteResources) } -//jar { -// classifier "dev" -//} sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } - -// def fabricLikeSources = project(":fabricLike").sourcesJar -// dependsOn fabricLikeSources -// from fabricLikeSources.archiveFile.map { zipTree(it) } } - -//components.java { -// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { -// skip() -// } -//} \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 57801c58f..ed57a1326 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,76 +1,51 @@ -unimined.minecraft { - minecraftForge { - loader forge_version - mixinConfig("DistantHorizons.forge.mixins.json") - - file("build/sourcesSets/main/META-INF/").mkdirs() - accessTransformer(aw2at( - project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), - file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar - )) - } +plugins { + // Note: This is only needed for multi-loader projects + // The main architectury loom version is set at the start of the root build.gradle + id "architectury-plugin" version "3.4-SNAPSHOT" } +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 -def addMod(path, enabled) { - if (enabled == "2") - dependencies { modImplementation(path) } - else if (enabled == "1") - dependencies { compileOnly(path) } +architectury { + platformSetupLoomIde() + forge() } -dependencies { - // Architectury API -// if (minecraft_version == "1.16.5") { -// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") -// } else { -// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") + +//loom { +// forge { +// convertAccessWideners.set(true) +// extraAccessWideners.add("lod.accesswidener") +// mixinConfigs("DistantHorizons.mixins.json") // } +//} - // Starlight - addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge) -// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" +loom { + silentMojangMappingsLicense() // Shut the licencing warning + accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") - addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) + forge { + convertAccessWideners = true + extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) - -// annotationProcessor "org.spongepowered:mixin:0.8.5:processor" - -// if (System.getProperty("idea.sync.active") != "true") { -// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" -// } -} - -tasks.register('copyAllResources') { - dependsOn(copyCoreResources) - dependsOn(copyCommonLoaderResources) -} - - - -processResources { - dependsOn(tasks.named('copyAllResources')) -} - -afterEvaluate { - runClient { - dependsOn(tasks.named('copyAllResources')) + mixinConfigs = [ + "DistantHorizons.forge.mixins.json" + ] } - - // TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now - tasks.runClient.doFirst { - // TODO can we just ignore these folders instead? - // deleting them may cause issues if the OS locks the files - // and it feels hacky - try - { - delete file("../common/build/libs") - delete file("../coreSubProjects/core/build/libs") - delete file("../coreSubProjects/api/build/libs") - } - catch (ignored) - { - println('lib directories already deleted') + + // "runs" isn't required, but when we do need it then it can be useful + runs { + client { + client() + setConfigName("Forge Client") + ideConfigGenerated(true) + runDir("../run") +// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) + } + server { + server() + setConfigName("Forge Server") + ideConfigGenerated(true) + runDir("../run") } } } @@ -78,45 +53,48 @@ afterEvaluate { remapJar { inputFile = shadowJar.archiveFile dependsOn shadowJar -// classifier null } - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } +def addMod(path, enabled) { + if (enabled == "2") + dependencies { implementation(path) } + else if (enabled == "1") + dependencies { modCompileOnly(path) } } -//components.java { -// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { -// skip() -// } -//} - - - -// TODO this was specifically added for MC 1.20.4 and should not be used on MC versions prior to it -// source: https://github.com/MinecraftForge/MinecraftForge/blob/5d0047753dfac0caaf5d97cc3f5c9a8b0990cb44/mdk/build.gradle#L209-L217 -// -// Merge the resources and classes into the same directory. -// This is done because java expects modules to be in a single directory. -// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem -// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. -sourceSets.each { - if ( // Only run on MC 1.20.4 or later - // FIXME: Add an environment variable for the Major, Minor, and Patch version number of Minecraft - minecraft_version.split("\\.")[1].toInteger() >= 20 && - ( - minecraft_version.split("\\.").length > 1 && // Incase there isn't a minor version - minecraft_version.split("\\.")[2].toInteger() >= 4 - ) - ) { - // all of our code and resources should be in the sourceSets/main/ folder for Forge 1.20.4+ - def dir = layout.buildDirectory.dir("sourcesSets/$it.name") - println "source name: [" + it.name + "]"// as of 2024-2-4 "it.name" only returned "main" and "test" - it.output.resourcesDir = dir - it.java.destinationDirectory = dir +dependencies { + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" + mappings loom.layered() { + // Mojmap mappings + officialMojangMappings() + // Parchment mappings (it adds parameter mappings & javadoc) + parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") } + + // Forge + forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" + + addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) + + addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) + +} + +task deleteResources(type: Delete) { + delete file("build/resources/main") +} + +tasks.register('copyAllResources') { + dependsOn(copyCoreResources) + dependsOn(copyCommonLoaderResources) +} + +processResources { + dependsOn(tasks.named('copyAllResources')) +} + +tasks.named('runClient') { + dependsOn(tasks.named('copyAllResources')) + finalizedBy(deleteResources) } diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 5703ea19f..f5ab276fd 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -1,44 +1,98 @@ -unimined.minecraft { - neoForged { - loader neoforge_version - mixinConfig("DistantHorizons.neoforge.mixins.json") - - file("build/sourcesSets/main/META-INF/").mkdirs() - accessTransformer(aw2at( - project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), - file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar - )) +plugins { + // Note: This is only needed for multi-loader projects + // The main architectury loom version is set at the start of the root build.gradle + id "architectury-plugin" version "3.4-SNAPSHOT" +} + +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 + +architectury { + platformSetupLoomIde() + neoForge() +} + +// TODO this is already defined in the main settings.gradle file, why doesn't it work unless also defined here? (If compiling does work without this block feel free to remove) +repositories { + maven { + name "Neoforge" + url "https://maven.neoforged.net/releases/" } } +//loom { +// forge { +// convertAccessWideners.set(true) +// extraAccessWideners.add("lod.accesswidener") +// mixinConfigs("DistantHorizons.mixins.json") +// } +//} + +loom { + silentMojangMappingsLicense() // Shut the licencing warning + accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") + + neoForge { + // Access wideners are now defined in the `remapJar.atAccessWideners` +// convertAccessWideners = true +// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name + + // Mixins are now defined in the `mods.toml` +// mixinConfigs = [ +// "DistantHorizons.mixins.json" +// ] + } + mixin { + // Mixins are now defined in the `mods.toml` +// mixinConfigs = [ +// "DistantHorizons.mixins.json" +// ] + } + + // "runs" isn't required, but when we do need it then it can be useful + runs { + client { + client() + setConfigName("NeoForge Client") + ideConfigGenerated(true) + runDir("../run") +// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) + } + server { + server() + setConfigName("NeoForge Server") + ideConfigGenerated(true) + runDir("../run") + } + } +} + +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar +// classifier null + + atAccessWideners.add("distanthorizons.accesswidener") +} def addMod(path, enabled) { if (enabled == "2") - dependencies { modImplementation(path) } + dependencies { implementation(path) } else if (enabled == "1") - dependencies { compileOnly(path) } + dependencies { modCompileOnly(path) } } + dependencies { - // Architectury API -// if (minecraft_version == "1.16.5") { -// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") -// } else { -// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") -// } - - // Starlight - addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge) -// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" - - addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" + mappings loom.layered() { + // Mojmap mappings + officialMojangMappings() + // Parchment mappings (it adds parameter mappings & javadoc) + parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") + } + // Neoforge + neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) - -// annotationProcessor "org.spongepowered:mixin:0.8.5:processor" - -// if (System.getProperty("idea.sync.active") != "true") { -// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" -// } } task deleteResources(type: Delete) { @@ -54,20 +108,11 @@ processResources { dependsOn(tasks.named('copyAllResources')) } -afterEvaluate { - runClient { - dependsOn(tasks.named('copyAllResources')) - finalizedBy(deleteResources) - } +tasks.named('runClient') { + dependsOn(tasks.named('copyAllResources')) + finalizedBy(deleteResources) } -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null -} - - sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources @@ -78,4 +123,4 @@ sourcesJar { // withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { // skip() // } -//} \ No newline at end of file +//} diff --git a/settings.gradle b/settings.gradle index 8579a3916..fb99f9435 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,9 +10,13 @@ pluginManagement { url "https://maven.minecraftforge.net/" } maven { - name "NeoForge" + name "NeoForge Releases" url "https://maven.neoforged.net/releases/" } + maven { + name "NeoForge Snapshot" + url "https://maven.neoforged.net/snapshots/" + } maven { name "Architectury (Better Forge because regular Forge is annoying)" // TODO: Once we switch to NeoForge, would it's gradle work better? or will it have Forge's problems in it url "https://maven.architectury.dev/" @@ -29,12 +33,6 @@ pluginManagement { name "ParchmentMC" url "https://maven.parchmentmc.org" } - maven { - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - url = "https://maven.wagyourtail.xyz/snapshots" - } mavenCentral() gradlePluginPortal() @@ -43,11 +41,6 @@ pluginManagement { } } -plugins { - // handles JVM and toolchain downloading - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' -} - // Throw an error and a little help message if the user forgot to clone the core sub-project diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 128c77dd8..a8d6371a5 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -39,7 +39,7 @@ fabric_api_version=0.91.2+1.20.4 # (Neo)Forge loader forge_version=49.0.30 -neoforge_version=118-beta +neoforge_version=20.4.233 # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From 85f6b8320b3965ff0bb0089bddadc209e84a5dbd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:09:42 -0500 Subject: [PATCH 194/301] Fix Fabric compiling --- gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 547ae5860..ff30b3955 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,6 @@ org.gradle.jvmargs=-Xmx4096M org.gradle.parallel=true org.gradle.caching=true -fabric.loom.multiProjectOptimisation=true # Mod Info mod_name=DistantHorizons From b5b888c69f2d443f96057bca5b8689fa254f4533 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:10:05 -0500 Subject: [PATCH 195/301] Remove duplicate remapJar in fabric gradle --- fabric/build.gradle | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index 36e00cc4b..540278611 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -25,7 +25,6 @@ loom { remapJar { inputFile = shadowJar.archiveFile dependsOn shadowJar -// classifier null } @@ -125,13 +124,6 @@ dependencies { } } -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null -} - - task deleteResources(type: Delete) { delete file("build/resources/main") @@ -145,6 +137,7 @@ processResources { runClient { dependsOn(copyCoreResources) dependsOn(copyCommonLoaderResources) +// jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ]) finalizedBy(deleteResources) } From 8222126e8f7307c7836348acc6fea1cf3bceebbe Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:34:39 -0500 Subject: [PATCH 196/301] minor MixinMinecraft reformat --- .../distanthorizons/fabric/mixins/client/MixinMinecraft.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 6501977dd..f4bf969a6 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -77,7 +77,9 @@ public class MixinMinecraft Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE + ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) + : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) )); }; } From b1c6a5c1d44e78b5f29b4c33d9472ef3482691d1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:52:04 -0500 Subject: [PATCH 197/301] Move most libraries from the main script to core --- build.gradle | 51 ++++++------------------------------------------- coreSubProjects | 2 +- 2 files changed, 7 insertions(+), 46 deletions(-) diff --git a/build.gradle b/build.gradle index 2569c174a..541da4b92 100644 --- a/build.gradle +++ b/build.gradle @@ -104,8 +104,6 @@ subprojects { p -> apply plugin: "com.github.johnrengelman.shadow" if (isMinecraftSubProject) apply plugin: "systems.manifold.manifold-gradle-plugin" - if (p == project(":core")) - apply plugin: "application" // Apply forge's loom if ( @@ -171,14 +169,6 @@ subprojects { p -> } - // Let the application plugin know where the main class is - // (This will point to a non-existent class in all sub-projects except "Core") - if (p == project(":core")) { - application { - mainClass.set("com.seibel.distanthorizons.core.jar.JarMain") - } - } - dependencies { //=====================// // shared dependencies // @@ -206,27 +196,17 @@ subprojects { p -> implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") - // 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 - forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") // NightConfig (includes Toml & Json) + // needs to be here and in core to prevent compiler errors 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}") + // Compression + // needs to be here and in core to prevent compiler errors + forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 - // 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}") { @@ -292,33 +272,14 @@ subprojects { p -> } def librariesLocation = "distanthorizons.libraries" - // 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" + // SVG (not needed atm) +// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg" // 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") - 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" - - // SVG (not needed atm) -// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg" - // 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 c89fcb094..a613540b6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c89fcb094aafc829aa1e7e2ce2c3109e4cc0da9f +Subproject commit a613540b6a9a287054569430a92118c6d74f981f From b37e56837239b7cbd39309a98e757a6beaa3c1c3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:52:56 -0500 Subject: [PATCH 198/301] Change Initializer compressor test class --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a613540b6..2cc6c8d84 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a613540b6a9a287054569430a92118c6d74f981f +Subproject commit 2cc6c8d8401f422f7650a5479ae5f895c952d0dd From da0f4ae326c4fa8b61c342693a990f27a517e038 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 22:09:56 -0500 Subject: [PATCH 199/301] shade in apache.logging for the standalone jar --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 2cc6c8d84..b41e54e6a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2cc6c8d8401f422f7650a5479ae5f895c952d0dd +Subproject commit b41e54e6a6e05bf5b4bc76f302848f4cf65cd8d5 From bd85329589a8873c1a4eede25987cb2cf305baba Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 26 Apr 2024 07:22:03 -0500 Subject: [PATCH 200/301] Merge Data_source_rewrite into main --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b41e54e6a..614884c29 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b41e54e6a6e05bf5b4bc76f302848f4cf65cd8d5 +Subproject commit 614884c29e34e5708160e17a93b6646f38c5ad9d From 05c0f030cbdabdccbdcf42e1b1742a2ca2d544ad Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 26 Apr 2024 07:33:26 -0500 Subject: [PATCH 201/301] Fix issues with compressors not appearing at runtime --- build.gradle | 9 +++++++-- coreSubProjects | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 541da4b92..ea46a49c7 100644 --- a/build.gradle +++ b/build.gradle @@ -199,13 +199,15 @@ subprojects { p -> // NightConfig (includes Toml & Json) - // needs to be here and in core to prevent compiler errors + // 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 compiler errors + // 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 // Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing @@ -277,7 +279,10 @@ subprojects { p -> // Compression (LZ4) relocate "net.jpountz", "${librariesLocation}.jpountz" + relocate "com.github.luben", "${librariesLocation}.github.luben" + relocate "org.tukaani", "${librariesLocation}.tukaani" + // night config relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" mergeServiceFiles() diff --git a/coreSubProjects b/coreSubProjects index 614884c29..7470455e5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 614884c29e34e5708160e17a93b6646f38c5ad9d +Subproject commit 7470455e50bd45f16ea019982744c03bcb815471 From 5de19989134b00ebdb4efe7d52807d754843de55 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 26 Apr 2024 07:33:48 -0500 Subject: [PATCH 202/301] up the version number 2.0.3 -> 2.0.4 --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 7470455e5..2298ef0e0 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7470455e50bd45f16ea019982744c03bcb815471 +Subproject commit 2298ef0e0d1d48237fd4a4b9eee95056c2f34e4b diff --git a/gradle.properties b/gradle.properties index ff30b3955..de309504e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.0.3-a-dev +mod_version=2.0.4-a-dev api_version=1.1.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons From 3c76ed71d887d7e557a4d8ba9262271bae325ff8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 27 Apr 2024 11:35:16 -0500 Subject: [PATCH 203/301] 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 204/301] 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 205/301] 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 206/301] 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 207/301] 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 208/301] 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 209/301] 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 210/301] 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 211/301] 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 212/301] 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 213/301] 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 214/301] 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 215/301] 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 216/301] 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 217/301] 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 218/301] 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 219/301] 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 220/301] 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 221/301] 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 222/301] 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 223/301] 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 224/301] 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 From 184d61e637fcb0e81389343681c1309005502dcd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 May 2024 18:17:10 -0500 Subject: [PATCH 225/301] Up the API version 1.1.0 -> 2.0.0 There were several breaking changes and I forgot to up the major version number appropriately. --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index e1ca398b8..7e45a98e8 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e1ca398b8f24d82d1c5f79a345cc641a2366d680 +Subproject commit 7e45a98e8fb43b670d95ec01dff817f5cf128531 diff --git a/gradle.properties b/gradle.properties index d4fdcff7e..6b7dd552b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons mod_version=2.0.4-a-dev -api_version=1.1.0 +api_version=2.0.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. From a20fb982ecc3f8690456453a0fc8eaa86975995a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 9 May 2024 07:35:00 -0500 Subject: [PATCH 226/301] Potential fix for NaN multiverse similarity --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index e1ca398b8..04379691b 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e1ca398b8f24d82d1c5f79a345cc641a2366d680 +Subproject commit 04379691bc522187fce93e480fb3644c37ac87f8 From 54cd1a2e485e403ccfdc5cac0867695aeaac6bc7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 9 May 2024 19:45:50 -0500 Subject: [PATCH 227/301] Fix monoliths due to duplicate IDs --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 04379691b..f33bfa1d6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 04379691bc522187fce93e480fb3644c37ac87f8 +Subproject commit f33bfa1d696de9cdc628d1b232cd7b8b89f83942 From 45594e4e47c08e7895a09eaf11f00f5d1d63be86 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 9 May 2024 19:46:33 -0500 Subject: [PATCH 228/301] Handle missing/corrupted block/biome ID's in the full data --- .../common/wrappers/WrapperFactory.java | 14 +++++++++++++- .../common/wrappers/block/BiomeWrapper.java | 12 +++++++++++- .../common/wrappers/block/BlockStateWrapper.java | 15 ++++++++++++--- coreSubProjects | 2 +- 4 files changed, 37 insertions(+), 6 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 dd71daf24..7b885fc5f 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 @@ -32,6 +32,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.level.IDhLevel; import com.seibel.distanthorizons.core.level.IDhServerLevel; +import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory; import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; @@ -83,10 +84,21 @@ public class WrapperFactory implements IWrapperFactory @Override public IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BiomeWrapper.deserialize(str, levelWrapper); } + @Override + public IBiomeWrapper getPlainsBiomeWrapper(ILevelWrapper levelWrapper) // TODO is there a way we could get this without the levelWrapper? it isn't necessary but would clean up the code a bit + { + try + { + return BiomeWrapper.deserialize(BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING, levelWrapper); + } + catch (IOException e) + { + throw new LodUtil.AssertFailureException("Unable to parse plains resource string ["+BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING+"], error:\n " + e.getMessage()); + } + } @Override public IBlockStateWrapper deserializeBlockStateWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BlockStateWrapper.deserialize(str, levelWrapper); } - @Override public IBlockStateWrapper getAirBlockStateWrapper() { return BlockStateWrapper.AIR; } 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 9b8f889f6..2d5f95ca8 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 @@ -249,6 +249,7 @@ public class BiomeWrapper implements IBiomeWrapper return this.serialString; } + // TODO would it be worth while to cache these objects in a ConcurrentHashMap? public static IBiomeWrapper deserialize(String resourceLocationString, ILevelWrapper levelWrapper) throws IOException { if (resourceLocationString.equals(EMPTY_BIOME_STRING)) @@ -274,7 +275,16 @@ public class BiomeWrapper implements IBiomeWrapper { throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "]."); } - ResourceLocation resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); + + ResourceLocation resourceLocation; + try + { + resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); + } + catch (Exception e) + { + throw new IOException("No Resource Location found for the string: [" + resourceLocationString + "] Error: ["+e.getMessage()+"]."); + } try diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 4b2d1e0c5..5e5fca6b1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -336,6 +336,7 @@ public class BlockStateWrapper implements IBlockStateWrapper } + // TODO would it be worth while to cache these objects in a ConcurrentHashMap? /** will only work if a level is currently loaded */ public static IBlockStateWrapper deserialize(String resourceStateString, ILevelWrapper levelWrapper) throws IOException { @@ -357,13 +358,21 @@ public class BlockStateWrapper implements IBlockStateWrapper } // parse the resource location - int resourceSeparatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR); - if (resourceSeparatorIndex == -1) + int separatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR); + if (separatorIndex == -1) { throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "]."); } - ResourceLocation resourceLocation = new ResourceLocation(resourceStateString.substring(0, resourceSeparatorIndex), resourceStateString.substring(resourceSeparatorIndex + 1)); + ResourceLocation resourceLocation; + try + { + resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1)); + } + catch (Exception e) + { + throw new IOException("No Resource Location found for the string: [" + resourceStateString + "] Error: ["+e.getMessage()+"]."); + } // attempt to get the BlockState from all possible BlockStates diff --git a/coreSubProjects b/coreSubProjects index f33bfa1d6..7cfcfb069 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f33bfa1d696de9cdc628d1b232cd7b8b89f83942 +Subproject commit 7cfcfb0695cae172df7ec48e0bb30cc57246fa3f From 2642b7a9a48912de624fe0bc25da2f9c16cb8cec Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 9 May 2024 23:22:50 -0500 Subject: [PATCH 229/301] disable sql timeout --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 7cfcfb069..4575701bd 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7cfcfb0695cae172df7ec48e0bb30cc57246fa3f +Subproject commit 4575701bd48bb53bd4b93fc60cc6ae6e10d48efa From 294685df0088fcafd0894c28f0d84ac754909994 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 10 May 2024 07:05:40 -0500 Subject: [PATCH 230/301] Remove indium recommended dependency A lot of people were reading fabric's warning as a required dependency --- .../main/java/com/seibel/distanthorizons/fabric/FabricMain.java | 2 +- versionProperties/1.16.5.properties | 2 +- versionProperties/1.17.1.properties | 2 +- versionProperties/1.18.2.properties | 2 +- versionProperties/1.19.2.properties | 2 +- versionProperties/1.19.4.properties | 2 +- versionProperties/1.20.1.properties | 2 +- versionProperties/1.20.2.properties | 2 +- versionProperties/1.20.4.properties | 2 +- versionProperties/1.20.6.properties | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index bf77cd8f6..6f96d189b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -77,7 +77,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti // If sodium is installed Indium is also necessary in order to use the Fabric rendering API if (!modChecker.isModLoaded("indium")) { - String indiumMissingMessage = ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium"; + String indiumMissingMessage = ModInfo.READABLE_NAME + " needs Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium"; LOGGER.fatal(indiumMissingMessage); if (!GraphicsEnvironment.isHeadless()) diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index 9740ae07d..b69c274d7 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -22,7 +22,7 @@ fabric_api_version=0.42.0+1.16 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index bd823e4ae..6e8c0e19b 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -22,7 +22,7 @@ fabric_api_version=0.46.1+1.17 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index a14c7cacb..a3c524f8d 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -23,7 +23,7 @@ fabric_api_version=0.76.0+1.18.2 canvas_version=mc118:1.0.2616 fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index 0e0576876..1f8a511e8 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -22,7 +22,7 @@ fabric_api_version=0.76.1+1.19.2 canvas_version=mc119-1.0.2480 fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index c5c107ea3..b944efdf4 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -21,7 +21,7 @@ fabric_api_version=0.87.1+1.19.4 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index 3c73bd063..796120b2d 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.1 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index f443bc41c..d48707759 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.2 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 843ea79af..41079034f 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -22,7 +22,7 @@ fabric_api_version=0.91.2+1.20.4 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index c2fc9045a..d58a8111a 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -22,7 +22,7 @@ fabric_api_version=0.97.8+1.20.6 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list={ "indium": "*" } + fabric_recommend_list= # Fabric mod run # 0 = Don't enable and don't run From 94cba6cf676d199f71d9cd350b37782c2c8acf4f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 10 May 2024 17:25:52 -0500 Subject: [PATCH 231/301] Fix compiling --- versionProperties/1.16.5.properties | 2 +- versionProperties/1.17.1.properties | 2 +- versionProperties/1.18.2.properties | 2 +- versionProperties/1.19.2.properties | 2 +- versionProperties/1.19.4.properties | 2 +- versionProperties/1.20.1.properties | 2 +- versionProperties/1.20.2.properties | 2 +- versionProperties/1.20.4.properties | 2 +- versionProperties/1.20.6.properties | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index b69c274d7..b43755a1a 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -22,7 +22,7 @@ fabric_api_version=0.42.0+1.16 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 6e8c0e19b..9b059c06d 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -22,7 +22,7 @@ fabric_api_version=0.46.1+1.17 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index a3c524f8d..e4b01723e 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -23,7 +23,7 @@ fabric_api_version=0.76.0+1.18.2 canvas_version=mc118:1.0.2616 fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index 1f8a511e8..cc8479a27 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -22,7 +22,7 @@ fabric_api_version=0.76.1+1.19.2 canvas_version=mc119-1.0.2480 fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index b944efdf4..7ba9a7565 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -21,7 +21,7 @@ fabric_api_version=0.87.1+1.19.4 canvas_version= fabric_incompatibility_list={ "iris": "*" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index 796120b2d..69cede1c0 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.1 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index d48707759..62f394c8a 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.2 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 41079034f..380a3fd7c 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -22,7 +22,7 @@ fabric_api_version=0.91.2+1.20.4 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index d58a8111a..f7d546e14 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -22,7 +22,7 @@ fabric_api_version=0.97.8+1.20.6 canvas_version= fabric_incompatibility_list={ "iris": "<=1.6.20" } - fabric_recommend_list= + fabric_recommend_list={} # Fabric mod run # 0 = Don't enable and don't run From 55a837ca5e27f16de1503afed2146caea321b677 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 10 May 2024 22:27:29 -0500 Subject: [PATCH 232/301] Attempt to prevent thread starvation due to world gen --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 4575701bd..723f67ea0 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4575701bd48bb53bd4b93fc60cc6ae6e10d48efa +Subproject commit 723f67ea0c77af19515c8da01303cd15be3766e7 From e29a7786e45c570b65457d2a3fea4b5c38b88faa Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 11 May 2024 16:23:50 -0500 Subject: [PATCH 233/301] Potentially fix LODs not loading in --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 723f67ea0..f5e0c112e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 723f67ea0c77af19515c8da01303cd15be3766e7 +Subproject commit f5e0c112e30be7645ea7c09aff94e951d7c6c7fd From 6b5bae9beed0f831dfb323a2a2668dddf8447681 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 13 May 2024 20:26:47 -0400 Subject: [PATCH 234/301] Cache block and biome wrapper deserialization values --- .../common/wrappers/block/BiomeWrapper.java | 110 ++++++----- .../wrappers/block/BlockStateWrapper.java | 179 ++++++++++-------- 2 files changed, 164 insertions(+), 125 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 2d5f95ca8..fcb59ad9a 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 @@ -64,6 +64,8 @@ public class BiomeWrapper implements IBiomeWrapper public static final ConcurrentMap, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #endif + public static final ConcurrentHashMap WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>(); + public static final String EMPTY_BIOME_STRING = "EMPTY"; public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); @@ -267,62 +269,78 @@ public class BiomeWrapper implements IBiomeWrapper return EMPTY_WRAPPER; } - - - // parse the resource location - int separatorIndex = resourceLocationString.indexOf(":"); - if (separatorIndex == -1) + if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(resourceLocationString)) { - throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "]."); + return WRAPPER_BY_RESOURCE_LOCATION.get(resourceLocationString); } - ResourceLocation resourceLocation; + + + // if no wrapper is found, default to the empty wrapper + BiomeWrapper foundWrapper = EMPTY_WRAPPER; try { - resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); - } - catch (Exception e) - { - throw new IOException("No Resource Location found for the string: [" + resourceLocationString + "] Error: ["+e.getMessage()+"]."); - } - - - try - { - Level level = (Level)levelWrapper.getWrappedMcObject(); - net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); - - boolean success; - #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 - Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); - success = (biome != null); - #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 - Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); - success = (unwrappedBiome != null); - Holder biome = new Holder.Direct<>(unwrappedBiome); - #else - Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation); - success = (unwrappedBiome != null); - Holder biome = new Holder.Direct<>(unwrappedBiome); - #endif - - - - if (!success) + // parse the resource location + int separatorIndex = resourceLocationString.indexOf(":"); + if (separatorIndex == -1) { - if (!brokenResourceLocationStrings.contains(resourceLocationString)) - { - brokenResourceLocationStrings.add(resourceLocationString); - LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]"); - } - return EMPTY_WRAPPER; + throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "]."); } - return getBiomeWrapper(biome, levelWrapper); + ResourceLocation resourceLocation; + try + { + resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); + } + catch (Exception e) + { + throw new IOException("No Resource Location found for the string: [" + resourceLocationString + "] Error: [" + e.getMessage() + "]."); + } + + + try + { + Level level = (Level) levelWrapper.getWrappedMcObject(); + net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); + + boolean success; + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); + success = (biome != null); + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 + Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation); + success = (unwrappedBiome != null); + Holder biome = new Holder.Direct<>(unwrappedBiome); + #else + Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation); + success = (unwrappedBiome != null); + Holder biome = new Holder.Direct<>(unwrappedBiome); + #endif + + + + if (!success) + { + if (!brokenResourceLocationStrings.contains(resourceLocationString)) + { + brokenResourceLocationStrings.add(resourceLocationString); + LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]"); + } + return EMPTY_WRAPPER; + } + + + foundWrapper = (BiomeWrapper) getBiomeWrapper(biome, levelWrapper); + return foundWrapper; + } + catch (Exception e) + { + throw new IOException("Failed to deserialize the string [" + resourceLocationString + "] into a BiomeWrapper: " + e.getMessage(), e); + } } - catch (Exception e) + finally { - throw new IOException("Failed to deserialize the string [" + resourceLocationString + "] into a BiomeWrapper: " + e.getMessage(), e); + WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(resourceLocationString, foundWrapper); } } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 5e5fca6b1..75004f474 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -65,6 +65,7 @@ public class BlockStateWrapper implements IBlockStateWrapper private static final Logger LOGGER = DhLoggerBuilder.getLogger(); public static final ConcurrentHashMap WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>(); + public static final ConcurrentHashMap WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>(); public static final String AIR_STRING = "AIR"; public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null); @@ -336,7 +337,6 @@ public class BlockStateWrapper implements IBlockStateWrapper } - // TODO would it be worth while to cache these objects in a ConcurrentHashMap? /** will only work if a level is currently loaded */ public static IBlockStateWrapper deserialize(String resourceStateString, ILevelWrapper levelWrapper) throws IOException { @@ -345,106 +345,127 @@ public class BlockStateWrapper implements IBlockStateWrapper return AIR; } - - - // try to parse out the BlockState - String blockStatePropertiesString = null; // will be null if no properties were included - int stateSeparatorIndex = resourceStateString.indexOf(STATE_STRING_SEPARATOR); - if (stateSeparatorIndex != -1) + // attempt to use the existing wrapper + if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(resourceStateString)) { - // blockstate properties found - blockStatePropertiesString = resourceStateString.substring(stateSeparatorIndex + STATE_STRING_SEPARATOR.length()); - resourceStateString = resourceStateString.substring(0, stateSeparatorIndex); + return WRAPPER_BY_RESOURCE_LOCATION.get(resourceStateString); } - // parse the resource location - int separatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR); - if (separatorIndex == -1) - { - throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "]."); - } - ResourceLocation resourceLocation; + + // if no wrapper is found, default to air + BlockStateWrapper foundWrapper = AIR; try { - resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1)); - } - catch (Exception e) - { - throw new IOException("No Resource Location found for the string: [" + resourceStateString + "] Error: ["+e.getMessage()+"]."); - } - - - // attempt to get the BlockState from all possible BlockStates - try - { - - #if MC_VER > MC_1_17_1 - // use the given level if possible, otherwise try using the currently loaded one - Level level = (levelWrapper != null ? (Level)levelWrapper.getWrappedMcObject() : null); - level = (level == null ? Minecraft.getInstance().level : level); - #endif - - Block block; - #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 - block = Registry.BLOCK.get(resourceLocation); - #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 - net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); - block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation); - #else - net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); - block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation); - #endif - - - if (block == null) + // try to parse out the BlockState + String blockStatePropertiesString = null; // will be null if no properties were included + int stateSeparatorIndex = resourceStateString.indexOf(STATE_STRING_SEPARATOR); + if (stateSeparatorIndex != -1) { - // shouldn't normally happen, but here to make the compiler happy - if (!BrokenResourceLocations.contains(resourceLocation)) - { - BrokenResourceLocations.add(resourceLocation); - LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost."); - } - return AIR; + // blockstate properties found + blockStatePropertiesString = resourceStateString.substring(stateSeparatorIndex + STATE_STRING_SEPARATOR.length()); + resourceStateString = resourceStateString.substring(0, stateSeparatorIndex); + } + + // parse the resource location + int separatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR); + if (separatorIndex == -1) + { + throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "]."); + } + + ResourceLocation resourceLocation; + try + { + resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1)); + } + catch (Exception e) + { + throw new IOException("No Resource Location found for the string: [" + resourceStateString + "] Error: [" + e.getMessage() + "]."); } - // attempt to find the blockstate from all possibilities - BlockState foundState = null; - if (blockStatePropertiesString != null) - { - List possibleStateList = block.getStateDefinition().getPossibleStates(); - for (BlockState possibleState : possibleStateList) - { - String possibleStatePropertiesString = serializeBlockStateProperties(possibleState); - if (possibleStatePropertiesString.equals(blockStatePropertiesString)) - { - foundState = possibleState; - break; - } - } - } - // use the default if no state was found or given - if (foundState == null) + // attempt to get the BlockState from all possible BlockStates + try { - if (blockStatePropertiesString != null) + + #if MC_VER > MC_1_17_1 + // use the given level if possible, otherwise try using the currently loaded one + Level level = (levelWrapper != null ? (Level) levelWrapper.getWrappedMcObject() : null); + level = (level == null ? Minecraft.getInstance().level : level); + #endif + + Block block; + #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 + block = Registry.BLOCK.get(resourceLocation); + #elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2 + net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); + block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation); + #else + net.minecraft.core.RegistryAccess registryAccess = level.registryAccess(); + block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation); + #endif + + + if (block == null) { - // we should have found a blockstate, but didn't + // shouldn't normally happen, but here to make the compiler happy if (!BrokenResourceLocations.contains(resourceLocation)) { BrokenResourceLocations.add(resourceLocation); - LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state."); + LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost."); + } + + return AIR; + } + + + // attempt to find the blockstate from all possibilities + BlockState foundState = null; + if (blockStatePropertiesString != null) + { + List possibleStateList = block.getStateDefinition().getPossibleStates(); + for (BlockState possibleState : possibleStateList) + { + String possibleStatePropertiesString = serializeBlockStateProperties(possibleState); + if (possibleStatePropertiesString.equals(blockStatePropertiesString)) + { + foundState = possibleState; + break; + } } } - foundState = block.defaultBlockState(); + // use the default if no state was found or given + if (foundState == null) + { + if (blockStatePropertiesString != null) + { + // we should have found a blockstate, but didn't + if (!BrokenResourceLocations.contains(resourceLocation)) + { + BrokenResourceLocations.add(resourceLocation); + LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state."); + } + } + + foundState = block.defaultBlockState(); + } + + foundWrapper = new BlockStateWrapper(foundState, levelWrapper); + return foundWrapper; + } + catch (Exception e) + { + throw new IOException("Failed to deserialize the string [" + resourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e); } - return new BlockStateWrapper(foundState, levelWrapper); } - catch (Exception e) + finally { - throw new IOException("Failed to deserialize the string [" + resourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e); + // put if absent in case two threads deserialize at the same time + // unfortunately we can't put everything in a computeIfAbsent() since we also throw exceptions + WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(resourceStateString, foundWrapper); } } From da18469fd4352e1b9c74ffec31a2b73983753474 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 15 May 2024 07:24:08 -0400 Subject: [PATCH 235/301] Fix resource locations in biome/block wrappers --- .../common/wrappers/block/BiomeWrapper.java | 11 +++++++---- .../common/wrappers/block/BlockStateWrapper.java | 13 ++++++++----- 2 files changed, 15 insertions(+), 9 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 fcb59ad9a..f7282de12 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 @@ -254,6 +254,9 @@ public class BiomeWrapper implements IBiomeWrapper // TODO would it be worth while to cache these objects in a ConcurrentHashMap? public static IBiomeWrapper deserialize(String resourceLocationString, ILevelWrapper levelWrapper) throws IOException { + // we need the final string for the concurrent hash map later + final String finalResourceStateString = resourceLocationString; + if (resourceLocationString.equals(EMPTY_BIOME_STRING)) { if (!emptyStringWarningLogged) @@ -269,9 +272,9 @@ public class BiomeWrapper implements IBiomeWrapper return EMPTY_WRAPPER; } - if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(resourceLocationString)) + if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(finalResourceStateString)) { - return WRAPPER_BY_RESOURCE_LOCATION.get(resourceLocationString); + return WRAPPER_BY_RESOURCE_LOCATION.get(finalResourceStateString); } @@ -335,12 +338,12 @@ public class BiomeWrapper implements IBiomeWrapper } catch (Exception e) { - throw new IOException("Failed to deserialize the string [" + resourceLocationString + "] into a BiomeWrapper: " + e.getMessage(), e); + throw new IOException("Failed to deserialize the string [" + finalResourceStateString + "] into a BiomeWrapper: " + e.getMessage(), e); } } finally { - WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(resourceLocationString, foundWrapper); + WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper); } } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 75004f474..4a40c6e1f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -340,15 +340,18 @@ public class BlockStateWrapper implements IBlockStateWrapper /** will only work if a level is currently loaded */ public static IBlockStateWrapper deserialize(String resourceStateString, ILevelWrapper levelWrapper) throws IOException { - if (resourceStateString.equals(AIR_STRING) || resourceStateString.equals("")) // the empty string shouldn't normally happen, but just in case + // we need the final string for the concurrent hash map later + final String finalResourceStateString = resourceStateString; + + if (finalResourceStateString.equals(AIR_STRING) || finalResourceStateString.equals("")) // the empty string shouldn't normally happen, but just in case { return AIR; } // attempt to use the existing wrapper - if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(resourceStateString)) + if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(finalResourceStateString)) { - return WRAPPER_BY_RESOURCE_LOCATION.get(resourceStateString); + return WRAPPER_BY_RESOURCE_LOCATION.get(finalResourceStateString); } @@ -458,14 +461,14 @@ public class BlockStateWrapper implements IBlockStateWrapper } catch (Exception e) { - throw new IOException("Failed to deserialize the string [" + resourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e); + throw new IOException("Failed to deserialize the string [" + finalResourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e); } } finally { // put if absent in case two threads deserialize at the same time // unfortunately we can't put everything in a computeIfAbsent() since we also throw exceptions - WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(resourceStateString, foundWrapper); + WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper); } } From d45455092c0db4b0f2fbe1c45c971931856eb0d0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 15 May 2024 07:36:42 -0400 Subject: [PATCH 236/301] Replace QuadTree iterator linked list with ArrayDeque Thanks JustALittleWolf! --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index f5e0c112e..cec643860 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f5e0c112e30be7645ea7c09aff94e951d7c6c7fd +Subproject commit cec643860238fe2dec9960911d481fc9398455de From a83d7e2a26121311b83579af1ef7f8cb451b52c2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 16 May 2024 22:15:43 -0500 Subject: [PATCH 237/301] Replace DhSectionPos with long's for GC performance What could possibly go wrong? --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index c67712d97..fabe5d77e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c67712d9733defa6e50ff073b39504484a9b7d3b +Subproject commit fabe5d77ea80f907894d27db341b7b9002367268 From 26151779071a5578e243e33056fe19365c922f6e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 18 May 2024 08:07:48 -0500 Subject: [PATCH 238/301] Fix fabric 1.20.6 compiling --- build.gradle | 2 +- .../common/wrappers/gui/ClassicConfigGUI.java | 3 ++ .../common/wrappers/gui/MinecraftScreen.java | 4 ++ .../mimicObject/ChunkLoader.java | 48 +++++++++++++------ .../RegionFileStorageExternalCache.java | 8 +++- coreSubProjects | 2 +- fabric/build.gradle | 25 +++++----- .../fabric/FabricClientProxy.java | 17 ++++++- .../mixins/client/MixinLevelRenderer.java | 19 ++++++-- .../wrappers/modAccessor/BCLibAccessor.java | 4 +- .../wrappers/modAccessor/IrisAccessor.java | 4 ++ .../mixins/client/MixinLevelRenderer.java | 7 ++- gradle.properties | 4 +- versionProperties/1.20.6.properties | 6 +-- 14 files changed, 110 insertions(+), 43 deletions(-) diff --git a/build.gradle b/build.gradle index eb25b6432..508e00fa8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id "java" // Plugin to put dependencies inside our final jar - id "com.github.johnrengelman.shadow" version '7.1.2' apply false + id "com.github.johnrengelman.shadow" version '8.1.1' apply false // Plugin to create merged jars id "io.github.pacifistmc.forgix" version "1.2.6" diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 5ee0bab21..9271a9637 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -279,8 +279,11 @@ public class ClassicConfigGUI })); this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25); + + #if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+ if (this.minecraft != null && this.minecraft.level != null) this.list.setRenderBackground(false); + #endif this.addWidget(this.list); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index 1b3c1298c..2efa317c1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -60,8 +60,12 @@ public class MinecraftScreen screen.init(); // Init our own config screen this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint + + #if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+ if (this.minecraft != null && this.minecraft.level != null) // Check if in game this.list.setRenderBackground(false); // Disable from rendering + #endif + this.addWidget(this.list); // Add the tint to the things to be rendered } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 16fbac5cd..5c6ef0fa1 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -76,6 +76,11 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.material.Fluids; #endif +#if MC_VER == MC_1_20_6 +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.chunk.status.ChunkType; +#endif + import net.minecraft.world.level.material.Fluid; @@ -164,7 +169,8 @@ public class ChunkLoader #endif blockStateContainer = tagSection.contains("block_states", 10) - ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) + ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)) + #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); #if MC_VER < MC_1_18_2 @@ -172,10 +178,13 @@ public class ChunkLoader ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); #else + biomeContainer = tagSection.contains("biomes", 10) - ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error) + ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)) + #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); #endif + #if MC_VER < MC_1_20_1 chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); #else @@ -213,14 +222,15 @@ public class ChunkLoader } } - public static ChunkStatus.ChunkType readChunkType(CompoundTag tagLevel) + public static #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) { ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status")); if (chunkStatus != null) { return chunkStatus.getChunkType(); } - return ChunkStatus.ChunkType.PROTOCHUNK; + + return #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif } public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) @@ -262,19 +272,27 @@ public class ChunkLoader } } - ChunkStatus.ChunkType chunkType = readChunkType(tagLevel); - #if MC_VER < MC_1_18_2 - if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK) - return null; + #if MC_VER < MC_1_20_6 + ChunkStatus.ChunkType chunkType; #else - BlendingData blendingData = readBlendingData(tagLevel); - #if MC_VER < MC_1_19_2 - if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise())) - return null; - #else - if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && blendingData == null) - return null; + ChunkType chunkType; #endif + chunkType = readChunkType(tagLevel); + + #if MC_VER < MC_1_18_2 + if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK) + return null; + #else + + BlendingData blendingData = readBlendingData(tagLevel); + #if MC_VER < MC_1_19_2 + if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise())) + return null; + #else + if (chunkType == #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK #else ChunkType.PROTOCHUNK #endif && blendingData == null) + return null; + #endif + #endif long inhabitedTime = tagLevel.getLong("InhabitedTime"); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index 628f52cad..ff6283b64 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -17,6 +17,10 @@ import java.nio.file.Path; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; +#if MC_VER >= MC_1_20_6 +import net.minecraft.world.level.chunk.storage.RegionStorageInfo; +#endif + /** * @deprecated should be replaced with net.minecraft.world.level.chunk.storage.IOWorker to * prevent potential file corruption and issues with the C2ME mod. @@ -180,8 +184,10 @@ public class RegionFileStorageExternalCache implements AutoCloseable Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca"); #if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false); - #else + #elif MC_VER <= MC_1_20_4 rFile = new RegionFile(regionFilePath, storageFolderPath, false); + #else + rFile = new RegionFile(new RegionStorageInfo("level", null, "level type"), regionFilePath, storageFolderPath, false); #endif this.regionFileCache.add(new RegionFileCache(ChunkPos.asLong(pos.getRegionX(), pos.getRegionZ()), rFile)); diff --git a/coreSubProjects b/coreSubProjects index fabe5d77e..9cebd7ee5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit fabe5d77ea80f907894d27db341b7b9002367268 +Subproject commit 9cebd7ee5485e31c617e375468d892b1348a3e8d diff --git a/fabric/build.gradle b/fabric/build.gradle index fa1fabb62..accf863fc 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -69,14 +69,14 @@ dependencies { addModJar(fabricApi.module("fabric-events-interaction-v0", rootProject.fabric_api_version)) addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy) addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version)) + + // used by mod menu in MC 1.20.6+ + addModJar(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version)) + addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.fabric_api_version)) // Mod Menu - if (rootProject.modmenu_version != "") { - modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") - } - - + modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") // Starlight addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight) @@ -91,22 +91,23 @@ dependencies { modImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", rootProject.fabric_api_version)) modImplementation(fabricApi.module("fabric-rendering-fluids-v1", rootProject.fabric_api_version)) } - + // Lithium addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium) - + // Iris addMod("maven.modrinth:iris:${rootProject.iris_version}", rootProject.enable_iris) - + // BCLib addMod("com.github.quiqueck:BCLib:${rootProject.bclib_version}", rootProject.enable_bclib) - + // Canvas addMod("io.vram:canvas-fabric-${project.canvas_version}", rootProject.enable_canvas) - + // Immersive Portals - if (rootProject.enable_immersive_portals == "1") - modCompileOnly ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") + if (rootProject.enable_immersive_portals == "1") { + modCompileOnly("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") + } else if (rootProject.enable_immersive_portals == "2") { modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") { exclude(group: "net.fabricmc.fabric-api") diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 74d1c262c..48010d55d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -19,6 +19,8 @@ package com.seibel.distanthorizons.fabric; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; @@ -36,6 +38,7 @@ import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; +import com.seibel.distanthorizons.coreapi.util.math.Mat4f; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor; //import io.netty.buffer.ByteBuf; import net.fabricmc.api.EnvType; @@ -58,6 +61,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.phys.HitResult; import org.apache.logging.log4j.Logger; +import org.joml.Matrix4f; import org.lwjgl.glfw.GLFW; /** @@ -192,9 +196,18 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy WorldRenderEvents.AFTER_SETUP.register((renderContext) -> { + Matrix4f projectionMatrix = renderContext.projectionMatrix(); + + Matrix4f modelViewMatrix; + #if MC_VER < MC_1_20_4 + modelViewMatrix = matrixStack.last().pose(); + #else + modelViewMatrix = renderContext.positionMatrix(); + #endif + this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()), - McObjectConverter.Convert(renderContext.matrixStack().last().pose()), - McObjectConverter.Convert(renderContext.projectionMatrix()), + McObjectConverter.Convert(modelViewMatrix), + McObjectConverter.Convert(projectionMatrix), renderContext.tickDelta()); }); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 75bb8c02b..c884e10ae 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -84,11 +84,16 @@ public class MixinLevelRenderer method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #else + #elif MC_VER < MC_1_20_6 @Inject(at = @At("HEAD"), method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) + #else + @Inject(at = @At("HEAD"), + method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback) #endif { #if MC_VER == MC_1_16_5 @@ -100,10 +105,15 @@ public class MixinLevelRenderer Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose()); - #else + #elif MC_VER <= MC_1_20_4 // get the matrices directly from MC Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose()); Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix); + #else + // get the matrices directly from MC + Mat4f mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix); //frustumMatrix); + Mat4f mcProjectionMatrix = new Mat4f();// McObjectConverter.Convert(projectionMatrix); + mcProjectionMatrix.setIdentity(); #endif if (renderType.equals(RenderType.translucent())) { @@ -126,9 +136,12 @@ public class MixinLevelRenderer #elif MC_VER < MC_1_20_1 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + #elif MC_VER < MC_1_20_6 + @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") + private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") - private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + private void callAfterRunUpdates(CallbackInfo ci) #endif { ChunkWrapper.syncedUpdateClientLightStatus(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index 93934f15e..ed9c55488 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -1,7 +1,7 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor; -#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 // These versions either don't have BCLib, or the implementation is different +#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 || MC_VER == MC_1_20_6 // These versions either don't have BCLib, or the implementation is different #elif MC_VER == MC_1_18_2 import ru.bclib.config.ClientConfig; import ru.bclib.config.Configs; @@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor public void setRenderCustomFog(boolean newValue) { - #if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4) // These versions either don't have BCLib, or the implementation is different + #if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 || MC_VER == MC_1_20_6) // These versions either don't have BCLib, or the implementation is different // Change the value of CUSTOM_FOG_RENDERING in the bclib client config // This disabled fog from rendering within bclib diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java index cc0a7216a..90753eee3 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java @@ -22,7 +22,11 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor; #if MC_VER >= MC_1_19_4 import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; +#if MC_VER <= MC_1_20_4 import net.coderbot.iris.Iris; +#else +import net.irisshaders.iris.Iris; +#endif import net.irisshaders.iris.api.v0.IrisApi; public class IrisAccessor implements IIrisAccessor diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index a04df23bd..53fd70051 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -111,11 +111,16 @@ public class MixinLevelRenderer method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #else + #elif MC_VER < MC_1_20_4 @Inject(at = @At("HEAD"), method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) + #else + @Inject(at = @At("HEAD"), + method = "renderSectionLayer", + cancellable = true) + private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) #endif { // get MC's model view and projection matrices diff --git a/gradle.properties b/gradle.properties index 6b7dd552b..9bc3bd8e7 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.13 +manifold_version=2024.1.15 # 2023.1.17 can be used if there are mystery Java compiler issues nightconfig_version=3.6.6 lz4_version=1.8.0 @@ -50,7 +50,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/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index f7d546e14..8118a9001 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -1,7 +1,7 @@ # 1.20.6 version java_version=21 minecraft_version=1.20.6 -parchment_version=1.20.4:2024.04.14 +parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.20.6"] accessWidenerVersion=1_20_2 builds_for=fabric @@ -11,7 +11,7 @@ builds_for=fabric fabric_loader_version=0.15.10 fabric_api_version=0.97.8+1.20.6 # Fabric mod versions - modmenu_version= + modmenu_version=10.0.0-beta.1 starlight_version_fabric= phosphor_version_fabric= lithium_version= @@ -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.16-beta +neoforge_version=20.6.70-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From e7b60b75628c1c05aa59c822612fffc7a11bdfdf Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 18 May 2024 11:14:13 -0500 Subject: [PATCH 239/301] Fix neoforge 1.20.6 compiling --- build.gradle | 1 + .../common/wrappers/gui/GetConfigScreen.java | 2 +- .../mixins/client/MixinLevelRenderer.java | 4 +- .../neoforge/NeoforgeClientProxy.java | 40 ++++++++++++++- .../neoforge/NeoforgeMain.java | 13 ++++- .../neoforge/NeoforgeServerProxy.java | 18 +++++-- .../mixins/client/MixinLevelRenderer.java | 51 ++++++++----------- .../{mods.toml => NeoForge.mods.toml} | 4 +- versionProperties/1.20.6.properties | 2 +- 9 files changed, 93 insertions(+), 42 deletions(-) rename neoforge/src/main/resources/META-INF/{mods.toml => NeoForge.mods.toml} (96%) diff --git a/build.gradle b/build.gradle index 508e00fa8..c3a8e8f88 100644 --- a/build.gradle +++ b/build.gradle @@ -325,6 +325,7 @@ subprojects { p -> "fabric.mod.json", "quilt.mod.json", "META-INF/mods.toml", + "META-INF/NeoForge.mods.toml", // The mixins for each of the loaders "DistantHorizons."+ p.name +".fabricLike.mixins.json" diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java index 9e1a165a0..90c9299a5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GetConfigScreen.java @@ -36,7 +36,7 @@ public class GetConfigScreen case JavaFX: return MinecraftScreen.getScreen(parent, new JavaScreenHandlerScreen(new ConfigScreen()), ModInfo.ID + ".title"); default: - return null; + throw new IllegalArgumentException("No config screen implementation defined for ["+useScreen+"]."); } } diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index c884e10ae..34767a843 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -111,8 +111,8 @@ public class MixinLevelRenderer Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix); #else // get the matrices directly from MC - Mat4f mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix); //frustumMatrix); - Mat4f mcProjectionMatrix = new Mat4f();// McObjectConverter.Convert(projectionMatrix); + Mat4f mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix); + Mat4f mcProjectionMatrix = new Mat4f(); mcProjectionMatrix.setIdentity(); #endif diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index b58d758a1..8a086c0b1 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -21,6 +21,7 @@ package com.seibel.distanthorizons.neoforge; import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.util.ProxyUtil; +import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; @@ -34,6 +35,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapp import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.coreapi.ModInfo; //import io.netty.buffer.ByteBuf; +import com.seibel.distanthorizons.coreapi.util.math.Mat4f; import net.minecraft.world.level.LevelAccessor; import net.minecraft.client.multiplayer.ClientLevel; @@ -54,10 +56,16 @@ import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import net.minecraft.client.Minecraft; import net.neoforged.neoforge.client.event.InputEvent; -import net.neoforged.neoforge.event.TickEvent; import net.neoforged.bus.api.SubscribeEvent; import org.lwjgl.opengl.GL32; +#if MC_VER < MC_1_20_6 +import net.neoforged.neoforge.event.TickEvent; +#else +import net.neoforged.neoforge.client.event.ClientTickEvent; +#endif + + /** * This handles all events sent to the client, * and is the starting point for most of the mod. @@ -72,8 +80,10 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy // private static SimpleChannel multiversePluginChannel; + // Not the cleanest way of passing this to the LOD renderer, but it'll have to do for now + public static Mat4f currentModelViewMatrix = new Mat4f(); + public static Mat4f currentProjectionMatrix = new Mat4f(); - private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -90,6 +100,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy // tick events // //=============// + #if MC_VER < MC_1_20_6 @SubscribeEvent public void clientTickEvent(TickEvent.ClientTickEvent event) { @@ -98,6 +109,13 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy ClientApi.INSTANCE.clientTickEvent(); } } + #else + @SubscribeEvent + public void clientTickEvent(ClientTickEvent.Pre event) + { + ClientApi.INSTANCE.clientTickEvent(); + } + #endif @@ -281,6 +299,16 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy // rendering // //===========// + @SubscribeEvent + public void beforeLevelRenderEvent(RenderLevelStageEvent event) + { + if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SKY) + { + currentModelViewMatrix = McObjectConverter.Convert(event.getModelViewMatrix()); + currentProjectionMatrix = McObjectConverter.Convert(event.getProjectionMatrix()); + } + } + @SubscribeEvent public void afterLevelRenderEvent(RenderLevelStageEvent event) { @@ -301,4 +329,12 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy } + + //================// + // helper methods // + //================// + + private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } + + } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java index 8ee751e5e..8dd61f085 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeMain.java @@ -35,13 +35,18 @@ import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent; -import net.neoforged.neoforge.client.ConfigScreenHandler; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.RegisterCommandsEvent; import net.neoforged.neoforge.event.server.ServerStartingEvent; import java.util.function.Consumer; +#if MC_VER < MC_1_20_6 +import net.neoforged.neoforge.client.ConfigScreenHandler; +#else +import net.neoforged.neoforge.client.gui.IConfigScreenFactory; +#endif + /** * Initialize and setup the Mod.
* If you are looking for the real start of the mod @@ -70,8 +75,14 @@ public class NeoforgeMain extends AbstractModInitializer { this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); + #if MC_VER < MC_1_20_6 ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent))); + #else + ModLoadingContext.get().registerExtensionPoint(IConfigScreenFactory.class, + // TODO fix potential null pointer + () -> (client, parent) -> GetConfigScreen.getScreen(parent)); + #endif } @Override diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java index 505d3dcd6..f7e7e366b 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeServerProxy.java @@ -12,7 +12,6 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.LevelAccessor; import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.event.level.ChunkEvent; import net.neoforged.neoforge.event.level.LevelEvent; import net.neoforged.bus.api.SubscribeEvent; @@ -20,11 +19,17 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.event.server.ServerAboutToStartEvent; import net.neoforged.neoforge.event.server.ServerStoppingEvent; - import org.apache.logging.log4j.Logger; import java.util.function.Supplier; +#if MC_VER < MC_1_20_6 +import net.neoforged.neoforge.event.TickEvent; +#else +import net.neoforged.neoforge.event.tick.ServerTickEvent; +#endif + + public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy { private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); } @@ -58,7 +63,7 @@ public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy // events // //========// - // ServerTickEvent (at end) + #if MC_VER < MC_1_20_6 @SubscribeEvent public void serverTickEvent(TickEvent.ServerTickEvent event) { @@ -67,6 +72,13 @@ public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy this.serverApi.serverTickEvent(); } } + #else + @SubscribeEvent + public void serverTickEvent(ServerTickEvent.Post event) + { + this.serverApi.serverTickEvent(); + } + #endif // ServerWorldLoadEvent @SubscribeEvent diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index e885b13e9..95e5e9bff 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -19,10 +19,12 @@ package com.seibel.distanthorizons.neoforge.mixins.client; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; #if MC_VER < MC_1_19_4 import com.mojang.math.Matrix4f; #else +import com.seibel.distanthorizons.neoforge.NeoforgeClientProxy; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; @@ -67,30 +69,6 @@ public class MixinLevelRenderer (remap = false) #endif private ClientLevel level; - @Unique - private static float previousPartialTicks = 0; - - // TODO: Is there any reason why this is here? Can it be deleted? - public MixinLevelRenderer() - { - throw new NullPointerException("Null cannot be cast to non-null type."); - } - - #if MC_VER < MC_1_17_1 - @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V") - private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback) - #else - @Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true) - public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTicks, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) - #endif - { - // FIXME this is only called when clouds are enabled and vanilla render distance is far enough - // not having the partial ticks doesn't appear to be critical currently, but might cause weird issues down the line - - // get the partial ticks since renderBlockLayer doesn't - // have access to them - previousPartialTicks = partialTicks; - } #if MC_VER < MC_1_17_1 @@ -108,12 +86,17 @@ public class MixinLevelRenderer method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) - #else + #elif MC_VER < MC_1_20_6 @Inject(at = @At("HEAD"), method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V", cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback) - #endif + #else + @Inject(at = @At("HEAD"), + method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V", + cancellable = true) + private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback) + #endif { // get MC's model view and projection matrices #if MC_VER == MC_1_16_5 @@ -125,10 +108,15 @@ public class MixinLevelRenderer Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose()); - #else + #elif MC_VER <= MC_1_20_4 // get the matrices directly from MC Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose()); Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix); + #else + // get the matrices from neoForge's render event. + // We can't call the renderer there because we don't have access to the level that's being rendered + Mat4f mcModelViewMatrix = NeoforgeClientProxy.currentModelViewMatrix; + Mat4f mcProjectionMatrix = NeoforgeClientProxy.currentProjectionMatrix; #endif @@ -136,11 +124,11 @@ public class MixinLevelRenderer // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); } else if (renderType.equals(RenderType.translucent())) { - ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) @@ -155,9 +143,12 @@ public class MixinLevelRenderer #elif MC_VER < MC_1_20_1 @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel") public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + #elif MC_VER < MC_1_20_6 + @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") + private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) #else @Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") - private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) + private void callAfterRunUpdates(CallbackInfo ci) #endif { ChunkWrapper.syncedUpdateClientLightStatus(); diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/NeoForge.mods.toml similarity index 96% rename from neoforge/src/main/resources/META-INF/mods.toml rename to neoforge/src/main/resources/META-INF/NeoForge.mods.toml index 2a295c5ad..dff252f0a 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/NeoForge.mods.toml @@ -24,8 +24,8 @@ issueTrackerURL = "${issues}" acceptableRemoteVersions = "*" # We may need this to make forge (lexforge) & neoforge work together -#[[mixins]] -# config = "DistantHorizons.neoforge.mixins.json" +[[mixins]] + config = "DistantHorizons.neoforge.mixins.json" [[dependencies.distanthorizons]] modId = "minecraft" diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index 8118a9001..06d1732e8 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.6 parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.20.6"] accessWidenerVersion=1_20_2 -builds_for=fabric +builds_for=fabric,neoforge # neoforge can be added once the issue with mixins has been resolved # Fabric loader From 45d4f390a91aa29f091165200a6027f28b696eea Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 18 May 2024 20:31:15 -0500 Subject: [PATCH 240/301] Fix a bunch of compiler errors --- build.gradle | 4 +- .../fabric/FabricClientProxy.java | 14 ++-- forge/build.gradle | 14 +++- .../mixins/client/MixinLevelRenderer.java | 4 +- .../mixins/client/MixinLightTexture.java | 2 +- .../mixins/client/MixinMinecraft.java | 73 ++++++++++--------- .../resources/META-INF/NeoForge.mods.toml | 3 +- versionProperties/1.20.6.properties | 5 +- 8 files changed, 67 insertions(+), 52 deletions(-) diff --git a/build.gradle b/build.gradle index c3a8e8f88..f3c40c3b5 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id "com.github.johnrengelman.shadow" version '8.1.1' apply false // Plugin to create merged jars - id "io.github.pacifistmc.forgix" version "1.2.6" + id "io.github.pacifistmc.forgix" version "1.2.9" // Manifold preprocessor id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" @@ -325,7 +325,7 @@ subprojects { p -> "fabric.mod.json", "quilt.mod.json", "META-INF/mods.toml", - "META-INF/NeoForge.mods.toml", + "META-INF/neoforge.mods.toml", // The mixins for each of the loaders "DistantHorizons."+ p.name +".fabricLike.mixins.json" diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 48010d55d..cb2153586 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -196,18 +196,18 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy WorldRenderEvents.AFTER_SETUP.register((renderContext) -> { - Matrix4f projectionMatrix = renderContext.projectionMatrix(); + Mat4f projectionMatrix = McObjectConverter.Convert(renderContext.projectionMatrix()); - Matrix4f modelViewMatrix; - #if MC_VER < MC_1_20_4 - modelViewMatrix = matrixStack.last().pose(); + Mat4f modelViewMatrix; + #if MC_VER < MC_1_20_6 + modelViewMatrix = McObjectConverter.Convert(renderContext.matrixStack().last().pose()); #else - modelViewMatrix = renderContext.positionMatrix(); + modelViewMatrix = McObjectConverter.Convert(renderContext.positionMatrix()); #endif this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()), - McObjectConverter.Convert(modelViewMatrix), - McObjectConverter.Convert(projectionMatrix), + modelViewMatrix, + projectionMatrix, renderContext.tickDelta()); }); diff --git a/forge/build.gradle b/forge/build.gradle index ed57a1326..790890245 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -4,7 +4,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" } -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 architectury { platformSetupLoomIde() @@ -78,6 +78,18 @@ dependencies { addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) + + if ( // Only run on MC 1.20.6 or later + // FIXME: Add an environment variable for the Major, Minor, and Patch version number of Minecraft + minecraft_version.split("\\.")[1].toInteger() >= 20 && + ( + minecraft_version.split("\\.").length > 1 && // Incase there isn't a minor version + minecraft_version.split("\\.")[2].toInteger() >= 6 + ) + ) { + // (potential) hack fix, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+ + implementation('net.sf.jopt-simple:jopt-simple:5.0.4') //{ version { strictly '5.0.4' } } + } } task deleteResources(type: Delete) { diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 53fd70051..9eb2d9394 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -49,6 +49,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import javax.annotation.Nullable; import java.nio.FloatBuffer; #if MC_VER < MC_1_17_1 @@ -68,7 +69,8 @@ import org.lwjgl.opengl.GL15; @Mixin(LevelRenderer.class) public class MixinLevelRenderer { - @Shadow + @Nullable + @Shadow //# if MC_VER >= MC_1_20_4 (remap = false) # endif private ClientLevel level; @Unique private static float previousPartialTicks = 0; 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 215f7f7d3..319c449a5 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 @@ -38,7 +38,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LightTexture.class) public class MixinLightTexture { - @Shadow + @Shadow //# if MC_VER >= MC_1_20_4 (remap = false) # endif @Final private NativeImage lightPixels; diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java index b9a266764..45e166c78 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java @@ -24,41 +24,44 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - #if MC_VER < MC_1_20_2 - #if MC_VER == MC_1_20_1 - @Redirect( - method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") - ) - public void onOpenScreen(Minecraft instance, Screen guiScreen) - { - #else - @Redirect( - method = "(Lnet/minecraft/client/main/GameConfig;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") - ) - public void onOpenScreen(Minecraft instance, Screen guiScreen) - { - #endif - if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it - { - instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened - return; - } - - if (SelfUpdater.onStart()) - { - instance.setScreen(new UpdateModScreen( - new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) - )); - } - else - { - instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened - } - } - #endif + // commented out due to a bug with Manifold and having nested preprocessors + // and since neoforge doesn't work for anything before MC 1.20.6 anyway it doesn't need to be included + + //#if MC_VER < MC_1_20_2 + //#if MC_VER == MC_1_20_1 + //@Redirect( + // method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V", + // at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") + //) + //public void onOpenScreen(Minecraft instance, Screen guiScreen) + //{ + //#else + //@Redirect( + // method = "(Lnet/minecraft/client/main/GameConfig;)V", + // at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") + //) + //public void onOpenScreen(Minecraft instance, Screen guiScreen) + //{ + //#endif + // if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it + // { + // instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened + // return; + // } + // + // if (SelfUpdater.onStart()) + // { + // instance.setScreen(new UpdateModScreen( + // new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons + // (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + // )); + // } + // else + // { + // instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened + // } + //} + //#endif #if MC_VER >= MC_1_20_2 @Redirect( diff --git a/neoforge/src/main/resources/META-INF/NeoForge.mods.toml b/neoforge/src/main/resources/META-INF/NeoForge.mods.toml index dff252f0a..be75d32f9 100644 --- a/neoforge/src/main/resources/META-INF/NeoForge.mods.toml +++ b/neoforge/src/main/resources/META-INF/NeoForge.mods.toml @@ -29,8 +29,7 @@ issueTrackerURL = "${issues}" [[dependencies.distanthorizons]] modId = "minecraft" - mandatory = true # Forge syntax - type = "required" # Neoforge syntax + type = "required" versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for ordering = "NONE" side = "BOTH" \ No newline at end of file diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index 06d1732e8..605989044 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -4,8 +4,7 @@ minecraft_version=1.20.6 parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.20.6"] accessWidenerVersion=1_20_2 -builds_for=fabric,neoforge -# neoforge can be added once the issue with mixins has been resolved +builds_for=fabric,neoforge,forge # Fabric loader fabric_loader_version=0.15.10 @@ -38,7 +37,7 @@ fabric_api_version=0.97.8+1.20.6 enable_canvas=0 # (Neo)Forge loader -forge_version=50.0.0 +forge_version=50.0.19 neoforge_version=20.6.70-beta # (Neo)Forge mod versions starlight_version_forge= From 85df9c5ef403c1441c3a33eef50da7e797f26433 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 18 May 2024 20:32:33 -0500 Subject: [PATCH 241/301] Add 1.20.6 to the CI build script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79afe1193..06b24bc12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ build: stage: build parallel: matrix: - - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4"] + - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4", "1.20.6"] script: # this both runs the unit tests and assembles the code - ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; From 7fa4bc35f69ab30c2c4a211666844170a815bfd6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 19 May 2024 14:16:40 -0500 Subject: [PATCH 242/301] remove forge from 1.20.6 to fix CI/CD --- versionProperties/1.20.6.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index 605989044..eaea6d61a 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -4,7 +4,8 @@ minecraft_version=1.20.6 parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.20.6"] accessWidenerVersion=1_20_2 -builds_for=fabric,neoforge,forge +builds_for=fabric,neoforge +# forge is broken due to gradle/build script issues # Fabric loader fabric_loader_version=0.15.10 From 17022f2df201c4c829d05fec4511db5c91ca3368 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 19 May 2024 14:26:27 -0500 Subject: [PATCH 243/301] Document GuiHelper args --- .../common/wrappers/gui/ClassicConfigGUI.java | 11 ++++++----- .../common/wrappers/gui/GuiHelper.java | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 9271a9637..e173fe999 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -98,6 +98,7 @@ public class ClassicConfigGUI public static final int SpaceFromRightScreen = 10; public static final int ButtonWidthSpacing = 5; public static final int ResetButtonWidth = 40; + public static final int ResetButtonHeight = 20; } @@ -322,12 +323,12 @@ public class ClassicConfigGUI this.reload = true; Objects.requireNonNull(minecraft).setScreen(this); }; - int a = this.width - ConfigScreenConfigs.SpaceFromRightScreen - 150 - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth; - int b = 0; - int c = ConfigScreenConfigs.ResetButtonWidth; - int d = 20; + int posX = this.width - ConfigScreenConfigs.SpaceFromRightScreen - 150 - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth; + int posZ = 0; - Button resetButton = MakeBtn(Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED), a, b, c, d, btnAction); + Button resetButton = MakeBtn(Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED), + posX, posZ, ConfigScreenConfigs.ResetButtonWidth, ConfigScreenConfigs.ResetButtonHeight, + btnAction); if (((EntryInfo) info.guiValue).widget instanceof Map.Entry) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java index 18274f77c..53b0cebaa 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java @@ -15,12 +15,12 @@ public class GuiHelper /** * Helper static methods for versional compat */ - public static Button MakeBtn(Component base, int a, int b, int c, int d, Button.OnPress action) + public static Button MakeBtn(Component base, int posX, int posZ, int width, int height, Button.OnPress action) { #if MC_VER < MC_1_19_4 return new Button(a, b, c, d, base, action); #else - return Button.builder(base, action).bounds(a, b, c, d).build(); + return Button.builder(base, action).bounds(posX, posZ, width, height).build(); #endif } From 8fe4ad454ca17790040b69404b840e27c4168527 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 19 May 2024 20:31:51 -0500 Subject: [PATCH 244/301] update CI JDK 17 -> 21 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06b24bc12..d84d24eea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ # use Eclipse's JDK # The ci should always use a unix(-like) OS to work -image: eclipse-temurin:17 +image: eclipse-temurin:21 # all stages need to be defined here # TODO: Make stages depend on what is in versionProperties From c1f798793e574f50ef6de5a4c10bfdd508e48a90 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 19 May 2024 21:25:26 -0500 Subject: [PATCH 245/301] roll back manifold version to fix mystery compiler issues 2024.1.15 -> 2023.1.17 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9bc3bd8e7..c39c4a4a2 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.15 +manifold_version=2023.1.17 # 2023.1.17 can be used if there are mystery Java compiler issues nightconfig_version=3.6.6 lz4_version=1.8.0 From d40d94a565dc7c9ed34972c877c6b90a75eda5dd Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 07:52:38 -0500 Subject: [PATCH 246/301] Add probably broken AT OptionsScreen code Will probably break 1.20.2 and 1.20.4 --- .../1_20_2.distanthorizons.accesswidener | 3 + .../mixins/client/MixinOptionsScreen.java | 80 ++++++++++++++----- 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/common/src/main/resources/1_20_2.distanthorizons.accesswidener b/common/src/main/resources/1_20_2.distanthorizons.accesswidener index c793fab68..a267d98a3 100644 --- a/common/src/main/resources/1_20_2.distanthorizons.accesswidener +++ b/common/src/main/resources/1_20_2.distanthorizons.accesswidener @@ -37,3 +37,6 @@ accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp + +# TODO add a separate 1.20.6 Access widner file, this is only present in 1.20.6 +accessible field net/minecraft/client/gui/screens/OptionsScreen layout Lnet/minecraft/client/gui/layouts/HeaderAndFooterLayout; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 61b805be5..fc0bbdd70 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -23,6 +23,8 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -30,7 +32,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +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; @@ -46,36 +50,70 @@ import java.util.Objects; @Mixin(OptionsScreen.class) public class MixinOptionsScreen extends Screen { - // Get the texture for the button + /** Get the texture for the button */ private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); - protected MixinOptionsScreen(Component title) - { + + public final TexturedButtonWidget optionsButton; + + @Shadow + @Final + protected HeaderAndFooterLayout layout; + + + + protected MixinOptionsScreen(Component title) + { super(title); + + this.optionsButton = new TexturedButtonWidget( + // Where the button is on the screen + this.width / 2 - 180, this.height / 6 - 12, + // Width and height of the button + 20, 20, + // texture UV Offset + 0, 0, + // Some textuary stuff + 20, ICON_TEXTURE, 20, 40, + // Create the button and tell it where to go + // For now it goes to the client option by default + (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), + // Add a title to the utton + #if MC_VER < MC_1_19_2 + new TranslatableComponent(ModInfo.ID + ".title"))); + #else + Component.translatable(ModInfo.ID + ".title")); + #endif } + + @Inject(at = @At("HEAD"), method = "init") private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) + { this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif - (new TexturedButtonWidget( - // Where the button is on the screen - this.width / 2 - 180, this.height / 6 - 12, - // Width and height of the button - 20, 20, - // Offset - 0, 0, - // Some textuary stuff - 20, ICON_TEXTURE, 20, 40, - // Create the button and tell it where to go - // For now it goes to the client option by default - (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), - // Add a title to the utton - #if MC_VER < MC_1_19_2 - new TranslatableComponent(ModInfo.ID + ".title"))); - #else - Component.translatable(ModInfo.ID + ".title"))); - #endif + (this.optionsButton); + + // TODO we need to add optionsButton to the UI via the layout instead so it centers correctly + // This wasn't working on James' machine + this.layout.visitChildren((x) -> + { + System.out.println(x); + }); + + } } + + //@Inject(method = "Lnet/minecraft/client/gui/screens/Screen;render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V", at = @At(value = "INVOKE")) + //public void renderStuff(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, CallbackInfo ci) + //{ + // int newWidth = this.width / 2 - 180; + // if (this.optionsButton.getX() != newWidth) + // { + // this.optionsButton.setX(newWidth); + // } + //} + } From 00d8aa356bc5247ea4a53c96362299e7c5ea32d9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 07:52:46 -0500 Subject: [PATCH 247/301] minor ClassicConfigGUI reformat --- .../common/wrappers/gui/ClassicConfigGUI.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index e173fe999..3e601ecd3 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -252,7 +252,7 @@ public class ClassicConfigGUI this.width - 28, this.height - 28, // Width and height of the button 20, 20, - // Offset + // texture UV Offset 0, 0, // Some textuary stuff 0, new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), 20, 20, @@ -270,10 +270,14 @@ public class ClassicConfigGUI } - addBtn(MakeBtn(Translatable("distanthorizons.general.cancel"), this.width / 2 - 154, this.height - 28, 150, 20, button -> { - ConfigBase.INSTANCE.configFileINSTANCE.loadFromFile(); - Objects.requireNonNull(minecraft).setScreen(parent); - })); + addBtn(MakeBtn(Translatable("distanthorizons.general.cancel"), + this.width / 2 - 154, this.height - 28, + 150, 20, + button -> + { + ConfigBase.INSTANCE.configFileINSTANCE.loadFromFile(); + Objects.requireNonNull(minecraft).setScreen(parent); + })); doneButton = addBtn(MakeBtn(Translatable("distanthorizons.general.done"), this.width / 2 + 4, this.height - 28, 150, 20, (button) -> { ConfigBase.INSTANCE.configFileINSTANCE.saveToFile(); Objects.requireNonNull(minecraft).setScreen(parent); @@ -315,6 +319,7 @@ public class ClassicConfigGUI initEntry(info, this.translationPrefix); Component name = Translatable(translationPrefix + info.getNameWCategory()); + if (ConfigEntry.class.isAssignableFrom(info.getClass())) { Button.OnPress btnAction = button -> { From 12a66e70c9825540d5c4120a8e04dd886b583a98 Mon Sep 17 00:00:00 2001 From: Yeshi0 Date: Mon, 20 May 2024 17:01:45 +0200 Subject: [PATCH 248/301] remove unnecessary references to zstd --- coreSubProjects | 2 +- gradle.properties | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 9cebd7ee5..d48746d4e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9cebd7ee5485e31c617e375468d892b1348a3e8d +Subproject commit d48746d4ee2b024c14d0df3a9b36c271aa3dcd83 diff --git a/gradle.properties b/gradle.properties index c39c4a4a2..cb960ba5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,6 @@ manifold_version=2023.1.17 # 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 xz_version=1.9 sqlite_jdbc_version=3.43.0.0 # 8.2.1 is the newest version we can use since that's the version MC 1.16.5 uses From a49720a22182e44d54a7b1b858cf64aad674db7d Mon Sep 17 00:00:00 2001 From: Yeshi0 Date: Mon, 20 May 2024 17:04:10 +0200 Subject: [PATCH 249/301] fix gradle.properties typos (it was bothering me) --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index cb960ba5c..5d644a4bc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ api_version=2.0.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. -# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a varuable +# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a variable mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"] mod_homepage=https://modrinth.com/mod/distanthorizons mod_source=https://gitlab.com/jeseibel/distant-horizons @@ -29,7 +29,7 @@ sqlite_jdbc_version=3.43.0.0 fastutil_version=8.2.1 #svgSalamander_version=1.1.3 -# Minecraft related libaries (included in MC's jar) +# Minecraft related libraries (included in MC's jar) log4j_version=2.23.1 netty_version=4.1.94.Final lwjgl_version=3.3.1 @@ -51,5 +51,5 @@ versionStr= # and what version is used automatically by build and run commands mcVer=1.20.6 -# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment +# Defines the maximum amount of memory Minecraft is allowed when run in a development environment #minecraftMemoryJavaArg="-Xmx4G" From af6dca6e5e1cf2dc6a2009e2cccdd9d909c3fa44 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 01:26:03 +1000 Subject: [PATCH 250/301] =?UTF-8?q?Add=20JVM=20Downgrader=20(DH=20now=20us?= =?UTF-8?q?es=20Java=20version=20=CE=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 19 +++++++++++++++++++ fabric/build.gradle | 4 ++-- forge/build.gradle | 4 ++-- neoforge/build.gradle | 4 ++-- settings.gradle | 8 ++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index f3c40c3b5..1e62674b9 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,8 @@ plugins { // Architectury is used here only as a replacement for forge's own loom id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + + id 'xyz.wagyourtail.jvmdowngrader' version '0.4.0' apply true } @@ -102,6 +104,7 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" + apply plugin: "xyz.wagyourtail.jvmdowngrader" if (isMinecraftSubProject) apply plugin: "systems.manifold.manifold-gradle-plugin" @@ -313,6 +316,22 @@ subprojects { p -> // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass jar.dependsOn(shadowJar) + // For downgrading our project to Java 8 + if (isMinecraftSubProject) { + task jarDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.DowngradeJar) { + inputFile = tasks.shadowJar.archiveFile + archiveClassifier = "downgraded-8" + } + task apiDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.ShadeAPI) { + inputFile = jarDowngrade.archiveFile + archiveClassifier = "downgraded-8-shaded" + } + + // We're using a custom downgrade task so we disable the original downgrade tasks + downgradeJar.enabled = false + shadeDowngradedApi.enabled = false + } + // Put stuff from gradle.properties into the mod info processResources { diff --git a/fabric/build.gradle b/fabric/build.gradle index accf863fc..2d3b583fc 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,8 +23,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade } diff --git a/forge/build.gradle b/forge/build.gradle index 790890245..ea30313f3 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -51,8 +51,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade } def addMod(path, enabled) { diff --git a/neoforge/build.gradle b/neoforge/build.gradle index f5ab276fd..4b5290e17 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -67,8 +67,8 @@ loom { } remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar + inputFile = apiDowngrade.archiveFile + dependsOn apiDowngrade // classifier null atAccessWideners.add("distanthorizons.accesswidener") diff --git a/settings.gradle b/settings.gradle index fb99f9435..a76ea809a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,6 +33,14 @@ pluginManagement { name "ParchmentMC" url "https://maven.parchmentmc.org" } + maven { // Used for downgrading Java versions + name "Wagyourtail Release Repository" + url "https://maven.wagyourtail.xyz/releases" + } + maven { // Used for downgrading Java versions + name "Wagyourtail Snapshot Repository" + url "https://maven.wagyourtail.xyz/snapshots" + } mavenCentral() gradlePluginPortal() From c4a9e7a2a75b6e68cc19bf88e63309ff80f5c24a Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 01:56:33 +1000 Subject: [PATCH 251/301] =?UTF-8?q?Set=20the=20core=20to=20use=20Java=20ve?= =?UTF-8?q?rsion=20=CE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1e62674b9..9436b60ed 100644 --- a/build.gradle +++ b/build.gradle @@ -630,14 +630,17 @@ allprojects { p -> tasks.withType(JavaCompile) { if (isMinecraftSubProject) { - options.release = rootProject.java_version as Integer + options.release = rootProject.java_version as Integer // Neoforge complains without this options.compilerArgs += ["-Xplugin:Manifold"] - } else { - options.release = 8; // Core & Api should use Java 8 no matter what - //options.release = rootProject.java_version as Integer // But if you want to test some stuff, then this can be enabled } options.encoding = "UTF-8" } + + // Sets the project's actual Java version (it's recommended to use this over the `options.release` method above) + java { + sourceCompatibility = rootProject.java_version + targetCompatibility = rootProject.java_version + } java { withSourcesJar() From e274c9e004a89fc35933d2056d4e534f58a22c29 Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Tue, 21 May 2024 11:53:00 +1000 Subject: [PATCH 252/301] =?UTF-8?q?Properly=20shade=20libraries=20when=20u?= =?UTF-8?q?sing=20Java=20version=20=CE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9436b60ed..8c60421e8 100644 --- a/build.gradle +++ b/build.gradle @@ -285,7 +285,7 @@ subprojects { p -> relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location } } - def librariesLocation = "distanthorizons.libraries" + def librariesLocation = "DistantHorizons.libraries" // LWJGL // Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client From 29481bc123ff3ce6416d8a4359d1a2c322cb2b83 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 22:06:25 -0500 Subject: [PATCH 253/301] Fix 1.20.6 config page and config button --- .../1_20_2.distanthorizons.accesswidener | 3 - .../1_20_6.distanthorizons.accesswidener | 46 +++++++ .../mixins/client/MixinOptionsScreen.java | 112 +++++++++++------- versionProperties/1.20.6.properties | 2 +- 4 files changed, 113 insertions(+), 50 deletions(-) create mode 100644 common/src/main/resources/1_20_6.distanthorizons.accesswidener diff --git a/common/src/main/resources/1_20_2.distanthorizons.accesswidener b/common/src/main/resources/1_20_2.distanthorizons.accesswidener index a267d98a3..c793fab68 100644 --- a/common/src/main/resources/1_20_2.distanthorizons.accesswidener +++ b/common/src/main/resources/1_20_2.distanthorizons.accesswidener @@ -37,6 +37,3 @@ accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp - -# TODO add a separate 1.20.6 Access widner file, this is only present in 1.20.6 -accessible field net/minecraft/client/gui/screens/OptionsScreen layout Lnet/minecraft/client/gui/layouts/HeaderAndFooterLayout; diff --git a/common/src/main/resources/1_20_6.distanthorizons.accesswidener b/common/src/main/resources/1_20_6.distanthorizons.accesswidener new file mode 100644 index 000000000..427617544 --- /dev/null +++ b/common/src/main/resources/1_20_6.distanthorizons.accesswidener @@ -0,0 +1,46 @@ +accessWidener v1 named + +# used when determining where to save files to +accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File; + +# used when rendering +accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D + +# used for grabbing vanilla rendered chunks +accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList; + +#accessible method net/minecraft/client/renderer/LevelRenderer renderSectionLayer (Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V + +# world generation +# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V +accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z +accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage; +accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z + +# lod generation from save file +accessible field net/minecraft/world/level/chunk/storage/ChunkStorage worker Lnet/minecraft/world/level/chunk/storage/IOWorker; +accessible field net/minecraft/world/level/chunk/storage/IOWorker storage Lnet/minecraft/world/level/chunk/storage/RegionFileStorage; +accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage regionCache Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap; +accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage folder Ljava/nio/file/Path; + +# grabbing textures +accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture +accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameX (I)I +accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameY (I)I +accessible field net/minecraft/client/renderer/texture/SpriteContents animatedTexture Lnet/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture; +accessible field net/minecraft/client/renderer/texture/SpriteContents originalImage Lcom/mojang/blaze3d/platform/NativeImage; + +# UI stuff +accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet/minecraft/client/gui/components/WidgetSprites; +# Handles inserting the config button +accessible field net/minecraft/client/gui/layouts/HeaderAndFooterLayout headerFrame Lnet/minecraft/client/gui/layouts/FrameLayout; +accessible field net/minecraft/client/gui/layouts/FrameLayout children Ljava/util/List; +accessible class net/minecraft/client/gui/layouts/FrameLayout$ChildContainer +accessible field net/minecraft/client/gui/layouts/LinearLayout wrapped Lnet/minecraft/client/gui/layouts/GridLayout; + +# hacky stuff +accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; +mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; +accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp + + diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index fc0bbdd70..9fc0f8a57 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -23,7 +23,6 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; @@ -35,85 +34,106 @@ import net.minecraft.resources.ResourceLocation; 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 java.util.Objects; +#if MC_VER == MC_1_20_6 +import net.minecraft.client.gui.layouts.LinearLayout; +#endif + /** * Adds a button to the menu to goto the config * * @author coolGi - * @version 12-02-2021 + * @version 2024-5-20 */ @Mixin(OptionsScreen.class) public class MixinOptionsScreen extends Screen { - /** Get the texture for the button */ + /** Texture used for the config opening button */ + @Unique private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); - public final TexturedButtonWidget optionsButton; + @Unique + private TexturedButtonWidget optionsButton = null; + + #if MC_VER == MC_1_20_6 @Shadow @Final protected HeaderAndFooterLayout layout; + #endif - protected MixinOptionsScreen(Component title) - { - super(title); - - this.optionsButton = new TexturedButtonWidget( - // Where the button is on the screen - this.width / 2 - 180, this.height / 6 - 12, - // Width and height of the button - 20, 20, - // texture UV Offset - 0, 0, - // Some textuary stuff - 20, ICON_TEXTURE, 20, 40, - // Create the button and tell it where to go - // For now it goes to the client option by default - (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), - // Add a title to the utton - #if MC_VER < MC_1_19_2 - new TranslatableComponent(ModInfo.ID + ".title"))); - #else - Component.translatable(ModInfo.ID + ".title")); - #endif - } + //==============// + // constructors // + //==============// + protected MixinOptionsScreen(Component title) { super(title); } - - @Inject(at = @At("HEAD"), method = "init") + @Inject(at = @At("RETURN"), method = "init") private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) { - this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif - (this.optionsButton); + #if MC_VER < MC_1_17_1 + this.addButton(this.getOptionsButton()); + #elif MC_VER < MC_1_20_6 + this.addRenderableWidget(this.getOptionsButton()); + #else - // TODO we need to add optionsButton to the UI via the layout instead so it centers correctly - // This wasn't working on James' machine - this.layout.visitChildren((x) -> - { - System.out.println(x); - }); + // add the button so it's rendered + this.addRenderableWidget(this.getOptionsButton()); + // add the button to the correct location in the UI + // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? + // TODO is there a way we can put the button on the left side of the FOV bar like before? + LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; + layout.wrapped.addChild(this.getOptionsButton(), 1, 2); + layout.arrangeElements(); + + #endif } } - //@Inject(method = "Lnet/minecraft/client/gui/screens/Screen;render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V", at = @At(value = "INVOKE")) - //public void renderStuff(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, CallbackInfo ci) - //{ - // int newWidth = this.width / 2 - 180; - // if (this.optionsButton.getX() != newWidth) - // { - // this.optionsButton.setX(newWidth); - // } - //} + + //================// + // helper methods // + //================// + + @Unique + public TexturedButtonWidget getOptionsButton() + { + if (this.optionsButton == null) + { + this.optionsButton + = new TexturedButtonWidget( + // Where the button is on the screen + this.width / 2 - 180, this.height / 6 - 12, + // Width and height of the button + 20, 20, + // texture UV Offset + 0, 0, + // Some textuary stuff + 20, ICON_TEXTURE, 20, 40, + // Create the button and tell it where to go + // For now it goes to the client option by default + (buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)), + // Add a title to the utton + #if MC_VER < MC_1_19_2 + new TranslatableComponent(ModInfo.ID + ".title"))); + #else + Component.translatable(ModInfo.ID + ".title")); + #endif + } + + return this.optionsButton; + } } diff --git a/versionProperties/1.20.6.properties b/versionProperties/1.20.6.properties index eaea6d61a..273c66923 100644 --- a/versionProperties/1.20.6.properties +++ b/versionProperties/1.20.6.properties @@ -3,7 +3,7 @@ java_version=21 minecraft_version=1.20.6 parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.20.6"] -accessWidenerVersion=1_20_2 +accessWidenerVersion=1_20_6 builds_for=fabric,neoforge # forge is broken due to gradle/build script issues From c00ee260752f17dc2417d0f5efe8c9cf37b966f9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 22:10:48 -0500 Subject: [PATCH 254/301] =?UTF-8?q?Properly=20shade=20libraries=20when=20u?= =?UTF-8?q?sing=20Java=20version=20=CE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 9cebd7ee5..2111ad64c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 9cebd7ee5485e31c617e375468d892b1348a3e8d +Subproject commit 2111ad64c4596c8fcd1d3b2044c79cb43ca3a081 From 582d998e2e1b3f4cded04ab2f611c7166168193c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 22:12:09 -0500 Subject: [PATCH 255/301] Fix GuiHelper rename for MC 1.19.4 and below --- .../seibel/distanthorizons/common/wrappers/gui/GuiHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java index 53b0cebaa..46fe7010d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java @@ -18,7 +18,7 @@ public class GuiHelper public static Button MakeBtn(Component base, int posX, int posZ, int width, int height, Button.OnPress action) { #if MC_VER < MC_1_19_4 - return new Button(a, b, c, d, base, action); + return new Button(posX, posZ, width, height, base, action); #else return Button.builder(base, action).bounds(posX, posZ, width, height).build(); #endif From 0ad3391beae88f3a9ca7c2043eab7f92b1236ef7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 22:15:45 -0500 Subject: [PATCH 256/301] Put config button hide option only in file --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 2111ad64c..969b02dc1 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2111ad64c4596c8fcd1d3b2044c79cb43ca3a081 +Subproject commit 969b02dc1869a211bc44d0704fc1db6cc873b048 From be6cc5ff4eb8056415a02db858e5cde9609a8e4a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 May 2024 22:19:04 -0500 Subject: [PATCH 257/301] Fix some old MC version compiling --- .../fabric/mixins/client/MixinOptionsScreen.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 9fc0f8a57..72f582380 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -23,7 +23,6 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; -import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -43,6 +42,7 @@ import java.util.Objects; #if MC_VER == MC_1_20_6 import net.minecraft.client.gui.layouts.LinearLayout; +import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; #endif /** @@ -127,7 +127,7 @@ public class MixinOptionsScreen extends Screen (buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the utton #if MC_VER < MC_1_19_2 - new TranslatableComponent(ModInfo.ID + ".title"))); + new TranslatableComponent(ModInfo.ID + ".title")); #else Component.translatable(ModInfo.ID + ".title")); #endif From 14343569fe6aa55c707e055736e6e4afaee0714e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 06:56:27 -0500 Subject: [PATCH 258/301] Fix neoforge config button position --- .../mixins/client/MixinOptionsScreen.java | 4 +- .../mixins/client/MixinOptionsScreen.java | 110 +++++++++++++----- 2 files changed, 86 insertions(+), 28 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 72f582380..ed2274cf6 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -94,7 +94,7 @@ public class MixinOptionsScreen extends Screen // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? // TODO is there a way we can put the button on the left side of the FOV bar like before? LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; - layout.wrapped.addChild(this.getOptionsButton(), 1, 2); + layout.wrapped.addChild(this.getOptionsButton(), 1, 2); layout.arrangeElements(); #endif @@ -125,7 +125,7 @@ public class MixinOptionsScreen extends Screen // Create the button and tell it where to go // For now it goes to the client option by default (buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)), - // Add a title to the utton + // Add a title to the button #if MC_VER < MC_1_19_2 new TranslatableComponent(ModInfo.ID + ".title")); #else diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java index 657b521f0..1270fc0f8 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java @@ -30,52 +30,110 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; +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 java.util.Objects; +#if MC_VER == MC_1_20_6 +import net.minecraft.client.gui.layouts.LinearLayout; +import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; +#endif + /** * Adds a button to the menu to goto the config * * @author coolGi - * @version 12-02-2021 + * @version 2024-5-20 */ @Mixin(OptionsScreen.class) public class MixinOptionsScreen extends Screen { - // Get the texture for the button + /** Texture used for the config opening button */ + @Unique private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); - protected MixinOptionsScreen(Component title) - { - super(title); - } - @Inject(at = @At("HEAD"), method = "init") + + @Unique + private TexturedButtonWidget optionsButton = null; + + #if MC_VER == MC_1_20_6 + @Shadow + @Final + protected HeaderAndFooterLayout layout; + #endif + + + + //==============// + // constructors // + //==============// + + protected MixinOptionsScreen(Component title) { super(title); } + + @Inject(at = @At("RETURN"), method = "init") private void lodconfig$init(CallbackInfo ci) { if (Config.Client.optionsButton.get()) - this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif - (new TexturedButtonWidget( - // Where the button is on the screen - this.width / 2 - 180, this.height / 6 - 12, - // Width and height of the button - 20, 20, - // Offset - 0, 0, - // Some textuary stuff - 20, ICON_TEXTURE, 20, 40, - // Create the button and tell it where to go - // For now it goes to the client option by default - (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), - // Add a title to the button - #if MC_VER < MC_1_19_2 - new TranslatableComponent(ModInfo.ID + ".title"))); - #else - Component.translatable(ModInfo.ID + ".title"))); - #endif + { + #if MC_VER < MC_1_17_1 + this.addButton(this.getOptionsButton()); + #elif MC_VER < MC_1_20_6 + this.addRenderableWidget(this.getOptionsButton()); + #else + + // add the button so it's rendered + this.addRenderableWidget(this.getOptionsButton()); + + // add the button to the correct location in the UI + // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? + // TODO is there a way we can put the button on the left side of the FOV bar like before? + LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; + layout.wrapped.addChild(this.getOptionsButton(), 1, 2); + layout.arrangeElements(); + + #endif + } + } + + + + //================// + // helper methods // + //================// + + @Unique + public TexturedButtonWidget getOptionsButton() + { + if (this.optionsButton == null) + { + this.optionsButton + = new TexturedButtonWidget( + // Where the button is on the screen + this.width / 2 - 180, this.height / 6 - 12, + // Width and height of the button + 20, 20, + // texture UV Offset + 0, 0, + // Some textuary stuff + 20, ICON_TEXTURE, 20, 40, + // Create the button and tell it where to go + // For now it goes to the client option by default + (buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)), + // Add a title to the button + #if MC_VER < MC_1_19_2 + new TranslatableComponent(ModInfo.ID + ".title")); + #else + Component.translatable(ModInfo.ID + ".title")); + #endif + } + + return this.optionsButton; } } From 4998991ebe602d88823fc9b0e215aa86fc983118 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 07:12:04 -0500 Subject: [PATCH 259/301] Fix option button in 1.20.6 being on the wrong side --- .../fabric/mixins/client/MixinOptionsScreen.java | 10 ++++++++-- .../neoforge/mixins/client/MixinOptionsScreen.java | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index ed2274cf6..7c4116b6d 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -39,6 +39,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; #if MC_VER == MC_1_20_6 import net.minecraft.client.gui.layouts.LinearLayout; @@ -92,9 +93,14 @@ public class MixinOptionsScreen extends Screen // add the button to the correct location in the UI // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? - // TODO is there a way we can put the button on the left side of the FOV bar like before? LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; - layout.wrapped.addChild(this.getOptionsButton(), 1, 2); + + // determine how wide the other option buttons are so we can put our botton to the left of them all + AtomicInteger width = new AtomicInteger(0); + layout.visitChildren(x -> { width.addAndGet(x.getWidth()); }); + width.addAndGet(-10); // padding between the DH button and the FOV slider + + layout.wrapped.addChild(this.getOptionsButton(), 1, 2, (settings) -> { settings.paddingLeft(width.get() * -1); }); layout.arrangeElements(); #endif diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java index 1270fc0f8..983b446dd 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java @@ -39,6 +39,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; #if MC_VER == MC_1_20_6 import net.minecraft.client.gui.layouts.LinearLayout; @@ -94,7 +95,13 @@ public class MixinOptionsScreen extends Screen // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? // TODO is there a way we can put the button on the left side of the FOV bar like before? LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; - layout.wrapped.addChild(this.getOptionsButton(), 1, 2); + + // determine how wide the other option buttons are so we can put our botton to the left of them all + AtomicInteger width = new AtomicInteger(0); + layout.visitChildren(x -> { width.addAndGet(x.getWidth()); }); + width.addAndGet(-10); // padding between the DH button and the FOV slider + + layout.wrapped.addChild(this.getOptionsButton(), 1, 2, (settings) -> { settings.paddingLeft(width.get() * -1); }); layout.arrangeElements(); #endif From 80d9b4540b06dfe7c59b6ed5c67a6df61e0fd532 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 07:43:45 -0500 Subject: [PATCH 260/301] Fix LZ4 in retail MC --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 969b02dc1..8c91a8479 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 969b02dc1869a211bc44d0704fc1db6cc873b048 +Subproject commit 8c91a8479595d1de04213329e550b467e32bcb20 From ff6a5aae69aefb25e7314af85aca1c5cc29925d4 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 07:45:25 -0500 Subject: [PATCH 261/301] =?UTF-8?q?Revert=20"Set=20the=20core=20to=20use?= =?UTF-8?q?=20Java=20version=20=CE=A9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c4a9e7a2a75b6e68cc19bf88e63309ff80f5c24a. --- build.gradle | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 8c60421e8..4b24fd06c 100644 --- a/build.gradle +++ b/build.gradle @@ -630,17 +630,14 @@ allprojects { p -> tasks.withType(JavaCompile) { if (isMinecraftSubProject) { - options.release = rootProject.java_version as Integer // Neoforge complains without this + options.release = rootProject.java_version as Integer options.compilerArgs += ["-Xplugin:Manifold"] + } else { + options.release = 8; // Core & Api should use Java 8 no matter what + //options.release = rootProject.java_version as Integer // But if you want to test some stuff, then this can be enabled } options.encoding = "UTF-8" } - - // Sets the project's actual Java version (it's recommended to use this over the `options.release` method above) - java { - sourceCompatibility = rootProject.java_version - targetCompatibility = rootProject.java_version - } java { withSourcesJar() From 5991aa42d9a25d7a6dc99c07edda8ef8b24d2c28 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 07:45:33 -0500 Subject: [PATCH 262/301] =?UTF-8?q?Revert=20"Add=20JVM=20Downgrader=20(DH?= =?UTF-8?q?=20now=20uses=20Java=20version=20=CE=A9)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit af6dca6e5e1cf2dc6a2009e2cccdd9d909c3fa44. --- build.gradle | 19 ------------------- fabric/build.gradle | 4 ++-- forge/build.gradle | 4 ++-- neoforge/build.gradle | 4 ++-- settings.gradle | 8 -------- 5 files changed, 6 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 4b24fd06c..a59d9a744 100644 --- a/build.gradle +++ b/build.gradle @@ -12,8 +12,6 @@ plugins { // Architectury is used here only as a replacement for forge's own loom id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false - - id 'xyz.wagyourtail.jvmdowngrader' version '0.4.0' apply true } @@ -104,7 +102,6 @@ subprojects { p -> // Apply plugins apply plugin: "java" apply plugin: "com.github.johnrengelman.shadow" - apply plugin: "xyz.wagyourtail.jvmdowngrader" if (isMinecraftSubProject) apply plugin: "systems.manifold.manifold-gradle-plugin" @@ -316,22 +313,6 @@ subprojects { p -> // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass jar.dependsOn(shadowJar) - // For downgrading our project to Java 8 - if (isMinecraftSubProject) { - task jarDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.DowngradeJar) { - inputFile = tasks.shadowJar.archiveFile - archiveClassifier = "downgraded-8" - } - task apiDowngrade(type: xyz.wagyourtail.jvmdg.gradle.task.ShadeAPI) { - inputFile = jarDowngrade.archiveFile - archiveClassifier = "downgraded-8-shaded" - } - - // We're using a custom downgrade task so we disable the original downgrade tasks - downgradeJar.enabled = false - shadeDowngradedApi.enabled = false - } - // Put stuff from gradle.properties into the mod info processResources { diff --git a/fabric/build.gradle b/fabric/build.gradle index 2d3b583fc..accf863fc 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,8 +23,8 @@ loom { } remapJar { - inputFile = apiDowngrade.archiveFile - dependsOn apiDowngrade + inputFile = shadowJar.archiveFile + dependsOn shadowJar } diff --git a/forge/build.gradle b/forge/build.gradle index ea30313f3..790890245 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -51,8 +51,8 @@ loom { } remapJar { - inputFile = apiDowngrade.archiveFile - dependsOn apiDowngrade + inputFile = shadowJar.archiveFile + dependsOn shadowJar } def addMod(path, enabled) { diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 4b5290e17..f5ab276fd 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -67,8 +67,8 @@ loom { } remapJar { - inputFile = apiDowngrade.archiveFile - dependsOn apiDowngrade + inputFile = shadowJar.archiveFile + dependsOn shadowJar // classifier null atAccessWideners.add("distanthorizons.accesswidener") diff --git a/settings.gradle b/settings.gradle index a76ea809a..fb99f9435 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,14 +33,6 @@ pluginManagement { name "ParchmentMC" url "https://maven.parchmentmc.org" } - maven { // Used for downgrading Java versions - name "Wagyourtail Release Repository" - url "https://maven.wagyourtail.xyz/releases" - } - maven { // Used for downgrading Java versions - name "Wagyourtail Snapshot Repository" - url "https://maven.wagyourtail.xyz/snapshots" - } mavenCentral() gradlePluginPortal() From e2c94de6e6d4c486dce1583fab00d5781168c1ee Mon Sep 17 00:00:00 2001 From: Yeshi0 Date: Tue, 21 May 2024 20:57:12 +0200 Subject: [PATCH 263/301] fix blurry text on auto update screen --- .../common/wrappers/gui/updater/UpdateModScreen.java | 8 +++----- .../fabric/mixins/client/MixinMinecraft.java | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 0af31a6a1..446af8432 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -147,17 +147,15 @@ public class UpdateModScreen extends DhScreen this.renderBackground(matrices, mouseX, mouseY, delta); // Render background #endif + // TODO: add the tooltips for the buttons + super.render(matrices, mouseX, mouseY, delta); // Render the buttons + // TODO: Add tooltips // Render the text's DhDrawCenteredString(matrices, this.font, Translatable(ModInfo.ID + ".updater.text1"), this.width / 2, this.height / 2 - 35, 0xFFFFFF); DhDrawCenteredString(matrices, this.font, Translatable(ModInfo.ID + ".updater.text2", currentVer, nextVer), this.width / 2, this.height / 2 - 20, 0x52FD52); - - // TODO: add the tooltips for the buttons - super.render(matrices, mouseX, mouseY, delta); // Render the buttons - - // TODO: Add tooltips } @Override diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index f4bf969a6..711179411 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -25,6 +25,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { + // will always show the auto updater if true + boolean debugAlwaysShowUpdater = false; + #if MC_VER < MC_1_20_2 #if MC_VER == MC_1_20_1 @Redirect( @@ -41,13 +44,13 @@ public class MixinMinecraft public void onOpenScreen(Minecraft instance, Screen guiScreen) { #endif - if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it + if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !debugAlwaysShowUpdater) // Don't do anything if the user doesn't want it { instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened return; } - if (SelfUpdater.onStart()) + if (SelfUpdater.onStart() | debugAlwaysShowUpdater) { instance.setScreen(new UpdateModScreen( new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons @@ -71,6 +74,7 @@ public class MixinMinecraft if ( Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it && SelfUpdater.onStart() + || debugAlwaysShowUpdater ) { runnable = () -> { From e78424def49d9d1e7c50af0c63e6e5fd2f925efe Mon Sep 17 00:00:00 2001 From: Yeshi0 Date: Tue, 21 May 2024 20:58:44 +0200 Subject: [PATCH 264/301] typo --- .../distanthorizons/fabric/mixins/client/MixinMinecraft.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 711179411..4edc2ceeb 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -50,7 +50,7 @@ public class MixinMinecraft return; } - if (SelfUpdater.onStart() | debugAlwaysShowUpdater) + if (SelfUpdater.onStart() || debugAlwaysShowUpdater) { instance.setScreen(new UpdateModScreen( new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons From 5b2497b9d421cc49c1896e86666172d2e49ea04e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 17:16:36 -0500 Subject: [PATCH 265/301] Minor MixinMinecraft reformatting --- .../fabric/mixins/client/MixinMinecraft.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 4edc2ceeb..f717720ea 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -9,9 +9,9 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; +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.Redirect; @@ -25,9 +25,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - // will always show the auto updater if true - boolean debugAlwaysShowUpdater = false; + /** + * Can be enabled for testing the auto updater UI.
+ * will always show the auto updater if set to true. + */ + @Unique + private static final boolean DEBUG_ALWAYS_SHOW_UPDATER = false; + + #if MC_VER < MC_1_20_2 #if MC_VER == MC_1_20_1 @Redirect( @@ -44,13 +50,13 @@ public class MixinMinecraft public void onOpenScreen(Minecraft instance, Screen guiScreen) { #endif - if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !debugAlwaysShowUpdater) // Don't do anything if the user doesn't want it + if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !DEBUG_ALWAYS_SHOW_UPDATER) // Don't do anything if the user doesn't want it { instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened return; } - if (SelfUpdater.onStart() || debugAlwaysShowUpdater) + if (SelfUpdater.onStart() || DEBUG_ALWAYS_SHOW_UPDATER) { instance.setScreen(new UpdateModScreen( new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons @@ -72,10 +78,13 @@ public class MixinMinecraft private void buildInitialScreens(Runnable runnable) { if ( - Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it - && SelfUpdater.onStart() - || debugAlwaysShowUpdater - ) + DEBUG_ALWAYS_SHOW_UPDATER || + ( + // Don't do anything if the user doesn't want it + Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() + && SelfUpdater.onStart() + ) + ) { runnable = () -> { Minecraft.getInstance().setScreen(new UpdateModScreen( From f2b9e428d35753309a57ca5cdfe8c7ff3f99b585 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 May 2024 18:24:30 -0500 Subject: [PATCH 266/301] Re-add a missing import to fix compiling --- .../distanthorizons/fabric/mixins/client/MixinMinecraft.java | 1 + 1 file changed, 1 insertion(+) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index f717720ea..de4766fd1 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -8,6 +8,7 @@ import com.seibel.distanthorizons.core.jar.installer.GitlabGetter; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; From a66e4ba1579d5f4e380cde9b6078a158944ee59b Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 27 May 2024 17:38:00 -0500 Subject: [PATCH 267/301] Potentially fix memory leaks when rendering is disabled --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 8c91a8479..3cf385c2a 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 8c91a8479595d1de04213329e550b467e32bcb20 +Subproject commit 3cf385c2a27553ed2aa3cd578e0cd4319376ce82 From 75a51be28cd8401c0d58140550954f2bcb4f4a8a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 27 May 2024 17:57:58 -0500 Subject: [PATCH 268/301] remove unused lightmapBindingIndex in DhApiRenderParam --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 3cf385c2a..f49a79b54 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 3cf385c2a27553ed2aa3cd578e0cd4319376ce82 +Subproject commit f49a79b54a8af3d49ce51a889720392b7efa0045 From 71ca26bba99dcd41e82cb08dc12f44d0f0aa5011 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 30 May 2024 20:14:04 -0500 Subject: [PATCH 269/301] Up the version number 2.0.4-a-dev -> 2.1.0-a --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index f49a79b54..76f28e648 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f49a79b54a8af3d49ce51a889720392b7efa0045 +Subproject commit 76f28e648cf31c1b1cc16b23cd91b3ff7ac8bbdd diff --git a/gradle.properties b/gradle.properties index 5d644a4bc..cab4d25d0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.0.4-a-dev +mod_version=2.1.0-a api_version=2.0.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons From 6073d8122a413e59d551ebc0d793997e8897b3e3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 7 Jun 2024 17:42:46 -0500 Subject: [PATCH 270/301] Up the version number 2.1.0-a -> 2.1.1-a-dev --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 76f28e648..c3abfb123 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 76f28e648cf31c1b1cc16b23cd91b3ff7ac8bbdd +Subproject commit c3abfb123db2ad57afc266559b5e3546bedac833 diff --git a/gradle.properties b/gradle.properties index cab4d25d0..b66a886ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.1.0-a +mod_version=2.1.1-a-dev api_version=2.0.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons From c533b2e8ea759a6e1c335eee2141314e0bc24e2a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 07:19:50 -0500 Subject: [PATCH 271/301] Fix config screen blur on 1.20.6 --- .../common/wrappers/gui/updater/ChangelogScreen.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index 1328a5ba9..76adb6d58 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -168,10 +168,9 @@ public class ChangelogScreen extends DhScreen #endif - this.changelogArea.render(matrices, mouseX, mouseY, delta); // Render the changelog - + // render order matters, otherwise on 1.20.6+ the blurred background will render on top of the text super.render(matrices, mouseX, mouseY, delta); // Render the buttons - + this.changelogArea.render(matrices, mouseX, mouseY, delta); // Render the changelog DhDrawCenteredString(matrices, font, title, width / 2, 15, 0xFFFFFF); // Render title } From 564e0d3263c7cb0e7773a3ab46bd37dd967b3721 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 08:11:26 -0500 Subject: [PATCH 272/301] Add update branch config "auto" --- .../common/wrappers/gui/ClassicConfigGUI.java | 2 +- .../wrappers/gui/updater/UpdateModScreen.java | 24 ++++++++++--------- coreSubProjects | 2 +- .../fabric/mixins/client/MixinMinecraft.java | 19 +++++++++++---- .../forge/mixins/client/MixinMinecraft.java | 16 +++++++++++-- .../mixins/client/MixinMinecraft.java | 17 +++++++++++-- 6 files changed, 59 insertions(+), 21 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 3e601ecd3..228c4a218 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -245,7 +245,7 @@ public class ClassicConfigGUI } // Changelog button - if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE) + if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !ModInfo.IS_DEV_BUILD) // we only have changelogs for stable builds { this.addBtn(new TexturedButtonWidget( // Where the button is on the screen diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 446af8432..01ac2bb2f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -41,16 +41,18 @@ public class UpdateModScreen extends DhScreen super(Translatable(ModInfo.ID + ".updater.title")); this.parent = parent; this.newVersionID = newVersionID; - - switch (Config.Client.Advanced.AutoUpdater.updateBranch.get()) { - case STABLE: - currentVer = ModInfo.VERSION; - nextVer = ModrinthGetter.releaseNames.get(this.newVersionID); - break; - case NIGHTLY: - currentVer = ModJarInfo.Git_Commit.substring(0,7); - nextVer = this.newVersionID.substring(0,7); - break; + + + EDhApiUpdateBranch updateBranch = EDhApiUpdateBranch.convertAutoToStableOrNightly(Config.Client.Advanced.AutoUpdater.updateBranch.get()); + if (updateBranch == EDhApiUpdateBranch.STABLE) + { + this.currentVer = ModInfo.VERSION; + this.nextVer = ModrinthGetter.releaseNames.get(this.newVersionID); + } + else + { + this.currentVer = ModJarInfo.Git_Commit.substring(0,7); + this.nextVer = this.newVersionID.substring(0,7); } } @@ -88,7 +90,7 @@ public class UpdateModScreen extends DhScreen e.printStackTrace(); } - if (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE) + if (!ModInfo.IS_DEV_BUILD) { this.addBtn(new TexturedButtonWidget( // Where the button is on the screen diff --git a/coreSubProjects b/coreSubProjects index c3abfb123..b7a5bfd27 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit c3abfb123db2ad57afc266559b5e3546bedac833 +Subproject commit b7a5bfd274724195ddc32ca9746c5b38b9fa629a diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index de4766fd1..f6b4b112a 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -8,6 +8,7 @@ import com.seibel.distanthorizons.core.jar.installer.GitlabGetter; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; +import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; @@ -87,13 +88,23 @@ public class MixinMinecraft ) ) { - runnable = () -> { + runnable = () -> + { + String versionId; + EDhApiUpdateBranch updateBranch = EDhApiUpdateBranch.convertAutoToStableOrNightly(Config.Client.Advanced.AutoUpdater.updateBranch.get()); + if (updateBranch == EDhApiUpdateBranch.STABLE) + { + versionId = ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()); + } + else + { + versionId = GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"); + } + Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE - ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) - : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + versionId )); }; } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index 699b8017f..ca7a417d5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -73,11 +73,23 @@ public class MixinMinecraft && SelfUpdater.onStart() ) { - runnable = () -> { + runnable = () -> + { + String versionId; + EDhApiUpdateBranch updateBranch = EDhApiUpdateBranch.convertAutoToStableOrNightly(Config.Client.Advanced.AutoUpdater.updateBranch.get()); + if (updateBranch == EDhApiUpdateBranch.STABLE) + { + versionId = ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()); + } + else + { + versionId = GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"); + } + Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + versionId )); }; } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java index 45e166c78..a202069a0 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinMinecraft.java @@ -8,6 +8,7 @@ import com.seibel.distanthorizons.core.jar.installer.GitlabGetter; import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; +import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.TitleScreen; import org.spongepowered.asm.mixin.Mixin; @@ -75,11 +76,23 @@ public class MixinMinecraft && SelfUpdater.onStart() ) { - runnable = () -> { + runnable = () -> + { + String versionId; + EDhApiUpdateBranch updateBranch = EDhApiUpdateBranch.convertAutoToStableOrNightly(Config.Client.Advanced.AutoUpdater.updateBranch.get()); + if (updateBranch == EDhApiUpdateBranch.STABLE) + { + versionId = ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()); + } + else + { + versionId = GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"); + } + Minecraft.getInstance().setScreen(new UpdateModScreen( // TODO: Change to runnable, instead of tittle screen new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons - (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha")) + versionId )); }; } From 955524c6322020bedc3330f72ecb54ce20d6ecf6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 08:11:34 -0500 Subject: [PATCH 273/301] Remove blendium from the list of suggested fabric mods --- fabric/src/main/resources/fabric.mod.json | 1 - 1 file changed, 1 deletion(-) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 3aa8af35d..db15ae4bf 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -56,7 +56,6 @@ }, "suggests": { - "blendium": "*" }, "breaks": $fabric_incompatibility_list, From 2c263a2549c747a02e987436e6d33477756b588f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 08:11:48 -0500 Subject: [PATCH 274/301] Up the API version 2.0.0 -> 2.1.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b66a886ee..b8928e5de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons mod_version=2.1.1-a-dev -api_version=2.0.0 +api_version=2.1.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. From ebb0f6ebad105b04fe4f74f5fb433bcea74cdc85 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 08:12:03 -0500 Subject: [PATCH 275/301] Up the manifold version 2023.1.17 -> 2024.1.15 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b8928e5de..b66ef5dbd 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=2023.1.17 +manifold_version=2024.1.15 # 2023.1.17 can be used if there are mystery Java compiler issues nightconfig_version=3.6.6 lz4_version=1.8.0 From 2708c1ee116002e10222d8121f09dfb442a8f3ab Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 08:33:41 -0500 Subject: [PATCH 276/301] Improve config comment spacing --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index b7a5bfd27..e41abdd17 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b7a5bfd274724195ddc32ca9746c5b38b9fa629a +Subproject commit e41abdd17649681367871ddf674f03c3cb2bba18 From 4cf48fd99764e32f26509477a5bcd865b44bdbb0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 11:06:42 -0500 Subject: [PATCH 277/301] Try changing LZMA preset from 4 -> 3 (faster, less compressed) won't require any lod regeneration since the decompressor is the same --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index e41abdd17..1dd6359c8 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e41abdd17649681367871ddf674f03c3cb2bba18 +Subproject commit 1dd6359c89adfcc2010a18f6cb5f7567811a7001 From 7706240acb94b4953e2be34c600c228fe9253f09 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Jun 2024 12:49:17 -0500 Subject: [PATCH 278/301] Remove OpenGL multithreading --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 1dd6359c8..e011ce3ee 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 1dd6359c89adfcc2010a18f6cb5f7567811a7001 +Subproject commit e011ce3ee065fa195a694495ec54d5f446520879 From 0f2ff2037573d54015fbfe4d0fadc8c1f2b24585 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 10 Jun 2024 21:17:57 -0500 Subject: [PATCH 279/301] Re-arange ChunkLoader --- .../mimicObject/ChunkLoader.java | 266 +++++++++--------- 1 file changed, 135 insertions(+), 131 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 5c6ef0fa1..b82370dfb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -100,138 +100,7 @@ public class ChunkLoader private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks"; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER; - #if MC_VER >= MC_1_18_2 - private static BlendingData readBlendingData(CompoundTag chunkData) - { - BlendingData blendingData = null; - if (chunkData.contains("blending_data", 10)) - { - @SuppressWarnings({"unchecked", "rawtypes"}) - Dynamic blendingDataTag = new Dynamic(NbtOps.INSTANCE, chunkData.getCompound("blending_data")); - blendingData = BlendingData.CODEC.parse(blendingDataTag).resultOrPartial(LOGGER::error).orElse(null); - } - return blendingData; - } - #endif - private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData) - { - #if MC_VER >= MC_1_18_2 - #if MC_VER < MC_1_19_4 - Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - #else - Registry biomes = level.registryAccess().registryOrThrow(Registries.BIOME); - #endif - #if MC_VER < MC_1_18_2 - Codec> biomeCodec = PalettedContainer.codec( - biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); - #elif MC_VER < MC_1_19_2 - Codec>> biomeCodec = PalettedContainer.codec( - biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); - #else - Codec>> biomeCodec = PalettedContainer.codecRW( - biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); - #endif - #endif - int i = #if MC_VER < MC_1_17_1 16; #else level.getSectionsCount(); #endif - LevelChunkSection[] chunkSections = new LevelChunkSection[i]; - - boolean isLightOn = chunkData.getBoolean("isLightOn"); - boolean hasSkyLight = level.dimensionType().hasSkyLight(); - ListTag tagSections = chunkData.getList("Sections", 10); - if (tagSections.isEmpty()) tagSections = chunkData.getList("sections", 10); - - for (int j = 0; j < tagSections.size(); ++j) - { - CompoundTag tagSection = tagSections.getCompound(j); - int sectionYPos = tagSection.getByte("Y"); - - #if MC_VER < MC_1_18_2 - if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12)) - { - LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4); - levelChunkSection.getStates().read(tagSection.getList("Palette", 10), - tagSection.getLongArray("BlockStates")); - levelChunkSection.recalcBlockCounts(); - if (!levelChunkSection.isEmpty()) - chunkSections[#if MC_VER < MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] - = levelChunkSection; - } - #else - int sectionId = level.getSectionIndexFromSectionY(sectionYPos); - if (sectionId >= 0 && sectionId < chunkSections.length) - { - PalettedContainer blockStateContainer; - #if MC_VER < MC_1_18_2 - PalettedContainer biomeContainer; - #else - PalettedContainer> biomeContainer; - #endif - - blockStateContainer = tagSection.contains("block_states", 10) - ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)) - #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif - : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - - #if MC_VER < MC_1_18_2 - biomeContainer = tagSection.contains("biomes", 10) - ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) - : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); - #else - - biomeContainer = tagSection.contains("biomes", 10) - ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)) - #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif - : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); - #endif - - #if MC_VER < MC_1_20_1 - chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); - #else - chunkSections[sectionId] = new LevelChunkSection(blockStateContainer, biomeContainer); - #endif - } - #endif - - } - return chunkSections; - } - - private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) - { - CompoundTag tagHeightmaps = chunkData.getCompound("Heightmaps"); - for (Heightmap.Types type : ChunkStatus.FULL.heightmapsAfter()) - { - String heightmap = type.getSerializationKey(); - if (tagHeightmaps.contains(heightmap, 12)) - chunk.setHeightmap(type, tagHeightmaps.getLongArray(heightmap)); - } - Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter()); - } - - private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData) - { - ListTag tagPostProcessings = chunkData.getList("PostProcessing", 9); - for (int n = 0; n < tagPostProcessings.size(); ++n) - { - ListTag listTag3 = tagPostProcessings.getList(n); - for (int o = 0; o < listTag3.size(); ++o) - { - chunk.addPackedPostProcess(listTag3.getShort(o), n); - } - } - } - - public static #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) - { - ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status")); - if (chunkStatus != null) - { - return chunkStatus.getChunkType(); - } - - return #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif - } public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) { @@ -349,6 +218,141 @@ public class ChunkLoader readPostPocessings(chunk, chunkData); return chunk; } + private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData) + { + #if MC_VER >= MC_1_18_2 + #if MC_VER < MC_1_19_4 + Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + #else + Registry biomes = level.registryAccess().registryOrThrow(Registries.BIOME); + #endif + #if MC_VER < MC_1_18_2 + Codec> biomeCodec = PalettedContainer.codec( + biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); + #elif MC_VER < MC_1_19_2 + Codec>> biomeCodec = PalettedContainer.codec( + biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); + #else + Codec>> biomeCodec = PalettedContainer.codecRW( + biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS)); + #endif + #endif + int i = #if MC_VER < MC_1_17_1 16; #else level.getSectionsCount(); #endif + LevelChunkSection[] chunkSections = new LevelChunkSection[i]; + + boolean isLightOn = chunkData.getBoolean("isLightOn"); + boolean hasSkyLight = level.dimensionType().hasSkyLight(); + ListTag tagSections = chunkData.getList("Sections", 10); + if (tagSections.isEmpty()) tagSections = chunkData.getList("sections", 10); + + for (int j = 0; j < tagSections.size(); ++j) + { + CompoundTag tagSection = tagSections.getCompound(j); + int sectionYPos = tagSection.getByte("Y"); + + #if MC_VER < MC_1_18_2 + if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12)) + { + LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4); + levelChunkSection.getStates().read(tagSection.getList("Palette", 10), + tagSection.getLongArray("BlockStates")); + levelChunkSection.recalcBlockCounts(); + if (!levelChunkSection.isEmpty()) + chunkSections[#if MC_VER < MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ] + = levelChunkSection; + } + #else + int sectionId = level.getSectionIndexFromSectionY(sectionYPos); + if (sectionId >= 0 && sectionId < chunkSections.length) + { + PalettedContainer blockStateContainer; + #if MC_VER < MC_1_18_2 + PalettedContainer biomeContainer; + #else + PalettedContainer> biomeContainer; + #endif + + blockStateContainer = tagSection.contains("block_states", 10) + ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)) + #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif + : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); + + #if MC_VER < MC_1_18_2 + biomeContainer = tagSection.contains("biomes", 10) + ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) + : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); + #else + + biomeContainer = tagSection.contains("biomes", 10) + ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)) + #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif + : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); + #endif + + #if MC_VER < MC_1_20_1 + chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); + #else + chunkSections[sectionId] = new LevelChunkSection(blockStateContainer, biomeContainer); + #endif + } + #endif + + } + return chunkSections; + } + private static #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) + { + ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status")); + if (chunkStatus != null) + { + return chunkStatus.getChunkType(); + } + + return #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif + } + private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) + { + CompoundTag tagHeightmaps = chunkData.getCompound("Heightmaps"); + for (Heightmap.Types type : ChunkStatus.FULL.heightmapsAfter()) + { + String heightmap = type.getSerializationKey(); + if (tagHeightmaps.contains(heightmap, 12)) + chunk.setHeightmap(type, tagHeightmaps.getLongArray(heightmap)); + } + Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter()); + } + private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData) + { + ListTag tagPostProcessings = chunkData.getList("PostProcessing", 9); + for (int n = 0; n < tagPostProcessings.size(); ++n) + { + ListTag listTag3 = tagPostProcessings.getList(n); + for (int o = 0; o < listTag3.size(); ++o) + { + chunk.addPackedPostProcess(listTag3.getShort(o), n); + } + } + } + #if MC_VER >= MC_1_18_2 + private static BlendingData readBlendingData(CompoundTag chunkData) + { + BlendingData blendingData = null; + if (chunkData.contains("blending_data", 10)) + { + @SuppressWarnings({"unchecked", "rawtypes"}) + Dynamic blendingDataTag = new Dynamic(NbtOps.INSTANCE, chunkData.getCompound("blending_data")); + blendingData = BlendingData.CODEC.parse(blendingDataTag).resultOrPartial(LOGGER::error).orElse(null); + } + return blendingData; + } + #endif + + + + public static LevelChunk readLight(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) + { + return null; + } private static void logErrors(ChunkPos chunkPos, int i, String string) { From 7293677ddb026046b64ad05776a172c70058eb00 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 10 Jun 2024 21:32:14 -0500 Subject: [PATCH 280/301] Batch Generation Environment refactoring --- .../BatchGenerationEnvironment.java | 220 +++++++++--------- .../mimicObject/DhLitWorldGenRegion.java | 4 +- 2 files changed, 116 insertions(+), 108 deletions(-) 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 59ffa4c5f..36cb6f1e7 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 @@ -109,8 +109,6 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv new ConfigBasedLogger(LogManager.getLogger("LodWorldGen"), () -> Config.Client.Advanced.Logging.logWorldGenLoadEvent.get()); - //TODO: Make actual proper support for StarLight - public static class PerfCalculator { private static final String[] TIME_NAMES = { @@ -294,6 +292,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv + //=================// + // synchronization // + //=================// public T joinSync(CompletableFuture future) { @@ -368,103 +369,11 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } } - private static ProtoChunk EmptyChunk(ServerLevel level, ChunkPos chunkPos) - { - return new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_VER >= MC_1_17_1 , level #endif - #if MC_VER >= MC_1_18_2 , level.registryAccess().registryOrThrow( - #if MC_VER < MC_1_19_4 - Registry.BIOME_REGISTRY - #else - Registries.BIOME - #endif - ), null #endif - ); - - } - public ChunkAccess loadOrMakeChunk(ChunkPos chunkPos) - { - ServerLevel level = this.params.level; - - - - //====================// - // get the chunk data // - //====================// - - CompoundTag chunkData = null; - try - { - IOWorker ioWorker = level.getChunkSource().chunkMap.worker; - - #if MC_VER <= MC_1_18_2 - chunkData = ioWorker.load(chunkPos); - #else - - // timeout should prevent locking up the thread if the ioWorker dies or has issues - int maxGetTimeInSec = Config.Client.Advanced.WorldGenerator.worldGenerationTimeoutLengthInSeconds.get(); - CompletableFuture> future = ioWorker.loadAsync(chunkPos); - try - { - Optional data = future.get(maxGetTimeInSec, TimeUnit.SECONDS); - if (data.isPresent()) - { - chunkData = data.get(); - } - } - catch (Exception e) - { - LOAD_LOGGER.warn("Unable to get chunk at pos ["+chunkPos+"] after ["+maxGetTimeInSec+"] milliseconds.", e); - future.cancel(true); - } - #endif - } - catch (Exception e) - { - LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Error: " + e.getMessage(), e); - } - - - - //========================// - // convert the chunk data // - //========================// - - if (chunkData == null) - { - return EmptyChunk(level, chunkPos); - } - else - { - try - { - LOAD_LOGGER.info("DistantHorizons: Loading chunk [" + chunkPos + "] from disk."); - return ChunkLoader.read(level, chunkPos, chunkData); - } - catch (Exception e) - { - LOAD_LOGGER.error( - "DistantHorizons: couldn't load or make chunk at ["+chunkPos+"]." + - "Please try optimizing your world to fix this issue. \n" + - "World optimization can be done from the singleplayer world selection screen.\n" + - "Error: ["+e.getMessage()+"]." - , e); - - return EmptyChunk(level, chunkPos); - } - } - } - private static ArrayGridList GetCutoutFrom(ArrayGridList total, int border) - { - return new ArrayGridList<>(total, border, total.gridSize - border); - } - - private static ArrayGridList GetCutoutFrom(ArrayGridList total, EDhApiWorldGenerationStep step) - { - return GetCutoutFrom(total, MaxBorderNeeded - BorderNeeded.get(step)); - } + //==================// + // world generation // + //==================// public void generateLodFromList(GenerationEvent genEvent) throws InterruptedException { @@ -487,7 +396,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv adaptor = new LightGetterAdaptor(this.params.level); lightEngine = new DummyLightEngine(adaptor); - EmptyChunkGenerator generator = (int x, int z) -> + IEmptyChunkGeneratorFunc emptyChunkGeneratorFunc = (int x, int z) -> { ChunkPos chunkPos = new ChunkPos(x, z); ChunkAccess target = null; @@ -509,12 +418,11 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } return target; }; - - totalChunks = new ArrayGridList<>(refSize, (x, z) -> generator.generate(x + refPosX, z + refPosZ)); + totalChunks = new ArrayGridList<>(refSize, (x, z) -> emptyChunkGeneratorFunc.generate(x + refPosX, z + refPosZ)); genEvent.refreshTimeout(); region = new DhLitWorldGenRegion(params.level, lightEngine, totalChunks, - ChunkStatus.STRUCTURE_STARTS, refSize / 2, generator); + ChunkStatus.STRUCTURE_STARTS, refSize / 2, emptyChunkGeneratorFunc); adaptor.setRegion(region); genEvent.threadedParam.makeStructFeat(region, params); @@ -594,6 +502,91 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv PREF_LOGGER.infoInc("{}", genEvent.timer); } } + private ChunkAccess loadOrMakeChunk(ChunkPos chunkPos) + { + ServerLevel level = this.params.level; + + + + //====================// + // get the chunk data // + //====================// + + CompoundTag chunkData = null; + try + { + IOWorker ioWorker = level.getChunkSource().chunkMap.worker; + + #if MC_VER <= MC_1_18_2 + chunkData = ioWorker.load(chunkPos); + #else + + // timeout should prevent locking up the thread if the ioWorker dies or has issues + int maxGetTimeInSec = Config.Client.Advanced.WorldGenerator.worldGenerationTimeoutLengthInSeconds.get(); + CompletableFuture> future = ioWorker.loadAsync(chunkPos); + try + { + Optional data = future.get(maxGetTimeInSec, TimeUnit.SECONDS); + if (data.isPresent()) + { + chunkData = data.get(); + } + } + catch (Exception e) + { + LOAD_LOGGER.warn("Unable to get chunk at pos ["+chunkPos+"] after ["+maxGetTimeInSec+"] milliseconds.", e); + future.cancel(true); + } + #endif + } + catch (Exception e) + { + LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Error: " + e.getMessage(), e); + } + + + + //========================// + // convert the chunk data // + //========================// + + if (chunkData == null) + { + return CreateEmptyChunk(level, chunkPos); + } + else + { + try + { + LOAD_LOGGER.info("DistantHorizons: Loading chunk [" + chunkPos + "] from disk."); + return ChunkLoader.read(level, chunkPos, chunkData); + } + catch (Exception e) + { + LOAD_LOGGER.error( + "DistantHorizons: couldn't load or make chunk at ["+chunkPos+"]." + + "Please try optimizing your world to fix this issue. \n" + + "World optimization can be done from the singleplayer world selection screen.\n" + + "Error: ["+e.getMessage()+"]." + , e); + + return CreateEmptyChunk(level, chunkPos); + } + } + } + private static ProtoChunk CreateEmptyChunk(ServerLevel level, ChunkPos chunkPos) + { + return new ProtoChunk(chunkPos, UpgradeData.EMPTY + #if MC_VER >= MC_1_17_1 , level #endif + #if MC_VER >= MC_1_18_2 , level.registryAccess().registryOrThrow( + #if MC_VER < MC_1_19_4 + Registry.BIOME_REGISTRY + #else + Registries.BIOME + #endif + ), null #endif + ); + } public void generateDirect( GenerationEvent genEvent, ArrayGridList chunksToGenerate, int border, @@ -722,12 +715,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv genEvent.refreshTimeout(); } } + private static ArrayGridList GetCutoutFrom(ArrayGridList total, int border) { return new ArrayGridList<>(total, border, total.gridSize - border); } + private static ArrayGridList GetCutoutFrom(ArrayGridList total, EDhApiWorldGenerationStep step) { return GetCutoutFrom(total, MaxBorderNeeded - BorderNeeded.get(step)); } - public interface EmptyChunkGenerator - { - ChunkAccess generate(int x, int z); - - } @Override public int getEventCount() { return this.generationEventList.size(); } @@ -776,6 +766,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv return genEvent.future; } + + + //================// + // helper methods // + //================// + /** * Called before code that may run for an extended period of time.
* This is necessary to allow canceling world gen since waiting @@ -789,4 +785,16 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } } + + + //================// + // helper classes // + //================// + + @FunctionalInterface + public interface IEmptyChunkGeneratorFunc + { + ChunkAccess generate(int x, int z); + } + } \ No newline at end of file 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 4f66f315c..8ee62a90f 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 @@ -71,7 +71,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion public final DummyLightEngine lightEngine; - public final BatchGenerationEnvironment.EmptyChunkGenerator generator; + public final BatchGenerationEnvironment.IEmptyChunkGeneratorFunc generator; public final int writeRadius; public final int size; @@ -114,7 +114,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion public DhLitWorldGenRegion( ServerLevel serverLevel, DummyLightEngine lightEngine, List chunkList, ChunkStatus chunkStatus, int writeRadius, - BatchGenerationEnvironment.EmptyChunkGenerator generator) + BatchGenerationEnvironment.IEmptyChunkGeneratorFunc generator) { super(serverLevel, chunkList #if MC_VER >= MC_1_17_1 , chunkStatus, writeRadius #endif ); this.firstPos = chunkList.get(0).getPos(); From cc4a69c10cb02f1eb1ed95bec0633e3a3927b451 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 11 Jun 2024 18:35:02 -0500 Subject: [PATCH 281/301] Move shared ChunkWrapper code form Main to Core --- .../wrappers/chunk/ChunkLightStorage.java | 239 ------------------ .../common/wrappers/chunk/ChunkWrapper.java | 98 +------ coreSubProjects | 2 +- 3 files changed, 15 insertions(+), 324 deletions(-) delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java deleted file mode 100644 index 405c0fb95..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkLightStorage.java +++ /dev/null @@ -1,239 +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.common.wrappers.chunk; - -import com.seibel.distanthorizons.coreapi.util.BitShiftUtil; - -import java.util.ArrayList; -import java.util.Arrays; - -/** - * Compact, efficient storage for light levels. - * all blocks only take up 4 bits in total, - * and if a 16x16x16 area is detected to have the same light level in all positions, - * then we store a single byte for that light level, instead of 2 kilobytes. - * - * @author Builderb0y -*/ -public class ChunkLightStorage -{ - /** the minimum Y level in the chunk which this storage is storing light levels for (inclusive). */ - public int minY; - /** the maximum Y level in the chunk which this storage is storing light levels for (exclusive). */ - public int maxY; - - /** the data stored in this storage, split up into 16x16x16 areas. */ - public LightSection[] lightSections; - - /** - * If the get method is called on a Y position above what's stored - * this value will be returned.

- * - * This needs to be manually defined since sky and block lights behave differently - * for values both above and below what's defined. - */ - public int aboveMaxYValue; - /** @see ChunkLightStorage#aboveMaxYValue */ - public int belowMinYValue; - - - - //=============// - // constructor // - //=============// - - public ChunkLightStorage(int minY, int maxY, int aboveMaxYValue, int belowMinYValue) - { - this.minY = minY; - this.maxY = maxY; - - this.aboveMaxYValue = aboveMaxYValue; - this.belowMinYValue = belowMinYValue; - } - - - - //=====================// - // getters and setters // - //=====================// - - public int get(int x, int y, int z) - { - if (y < this.minY) - { - return this.belowMinYValue; - } - else if (y >= this.maxY) - { - return this.aboveMaxYValue; - } - - - if (this.lightSections != null) - { - LightSection lightSection = this.lightSections[BitShiftUtil.divideByPowerOfTwo(y - this.minY, 4)]; - if (lightSection != null) - { - return lightSection.get(x, y, z); - } - } - - return 0; - } - - public void set(int x, int y, int z, int lightLevel) - { - if (y < this.minY || y >= this.maxY) - { - return; - } - - //populate array if it doesn't exist. - if (this.lightSections == null) - { - this.lightSections = new LightSection[BitShiftUtil.divideByPowerOfTwo(this.maxY - this.minY, 4)]; - } - - int index = (y - this.minY) >> 4; - LightSection lightSection = this.lightSections[index]; - - //populate lightSection in array if it doesn't exist. - if (lightSection == null) - { - lightSection = new LightSection(0); - this.lightSections[index] = lightSection; - } - lightSection.set(x, y, z, lightLevel); - } - - - - //================// - // helper classes // - //================// - - public static class LightSection - { - public byte constantValue; - public long[] data; - public short[] counts; - - public LightSection(int initialValue) - { - this.constantValue = (byte) (initialValue); - this.counts = new short[16]; - this.counts[initialValue] = 16 * 16 * 16; - } - - public int get(int x, int y, int z) - { - if (this.constantValue >= 0) - { - return this.constantValue; - } - - x &= 15; - y &= 15; - z &= 15; - long bits = this.data[(z << 4) | x]; - return ((int) (bits >>> (y << 2))) & 15; - } - - public void set(int x, int y, int z, int lightLevel) - { - int oldLightLevel = -1; - if (this.constantValue >= 0) - { - oldLightLevel = this.constantValue; - - //if the light level didn't change, then there's nothing to do. - if (oldLightLevel == lightLevel) return; - - //if we are a constant value and need to change something, - //then that means we need to convert to a non-constant value. - this.data = DataRecycler.get(); - - //repeat oldLightLevel 16 times as a bit pattern. - long payload = oldLightLevel; - payload |= payload << 4; - payload |= payload << 8; - payload |= payload << 16; - payload |= payload << 32; - - //fill our data with our constant value. - Arrays.fill(this.data, payload); - - //we are no longer a constant value. - this.constantValue = -1; - } - - x &= 15; - y &= 15; - z &= 15; - int index = (z << 4) | x; - long bits = this.data[index]; - //if we weren't a constant value before, now's the time to initialize oldLightLevel. - if (oldLightLevel < 0) - { - oldLightLevel = ((int) (bits >>> (y << 2))) & 15; - } - //clear the 4 bits that correspond to the light level at x, y, z... - bits &= ~(15L << (y << 2)); - //...and then re-populate those bits with the new light level. - bits |= ((long) (lightLevel)) << (y << 2); - //store the updated bits in our data. - this.data[index] = bits; - - //we have one less of the old light level... - this.counts[oldLightLevel]--; - //...and one more of the new level. - //if the number associated with the new level is now 4096 (AKA 16 ^ 3), - //then this implies every position in this section has the same light level, - //and therefore we can convert back to a constant value. - if (++this.counts[lightLevel] == 4096) - { - this.constantValue = (byte) (lightLevel); - DataRecycler.reclaim(this.data); - this.data = null; - } - } - - } - - static class DataRecycler - { - private static final ArrayList recycled = new ArrayList<>(256); - - static synchronized long[] get() - { - if (recycled.isEmpty()) - { - return new long[256]; - } - else - { - return recycled.remove(recycled.size() - 1); - } - } - - static synchronized void reclaim(long[] data) { if (recycled.size() < 256) recycled.add(data); } - } - -} \ No newline at end of file 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 ee6c373df..321d02050 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 @@ -25,13 +25,12 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.Dh import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhBlockPos; import com.seibel.distanthorizons.core.pos.DhChunkPos; -import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; -import com.seibel.distanthorizons.coreapi.ModInfo; import net.minecraft.client.multiplayer.ClientChunkCache; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; @@ -83,9 +82,6 @@ public class ChunkWrapper implements IChunkWrapper { private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - /** useful for debugging, but can slow down chunk operations quite a bit due to being called every time. */ - private static final boolean RUN_RELATIVE_POS_INDEX_VALIDATION = ModInfo.IS_DEV_BUILD; - /** can be used for interactions with the underlying chunk where creating new BlockPos objects could cause issues for the garbage collector. */ private static final ThreadLocal MUTABLE_BLOCK_POS_REF = ThreadLocal.withInitial(() -> new BlockPos.MutableBlockPos()); @@ -152,26 +148,30 @@ public class ChunkWrapper implements IChunkWrapper //=========// @Override - public int getHeight() + public int getHeight() { return getHeight(this.chunk); } + public static int getHeight(ChunkAccess chunk) { #if MC_VER < MC_1_17_1 return 255; #else - return this.chunk.getHeight(); + return chunk.getHeight(); #endif } @Override - public int getMinBuildHeight() + public int getMinBuildHeight() { return getMinBuildHeight(this.chunk); } + public static int getMinBuildHeight(ChunkAccess chunk) { #if MC_VER < MC_1_17_1 return 0; #else - return this.chunk.getMinBuildHeight(); + return chunk.getMinBuildHeight(); #endif } + @Override - public int getMaxBuildHeight() { return this.chunk.getMaxBuildHeight(); } + public int getMaxBuildHeight() { return getMaxBuildHeight(this.chunk); } + public static int getMaxBuildHeight(ChunkAccess chunk) { return chunk.getMaxBuildHeight(); } @Override public int getMinNonEmptyHeight() @@ -301,9 +301,6 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getMinBlockZ() { return this.chunk.getPos().getMinBlockZ(); } - @Override - public long getLongChunkPos() { return this.chunk.getPos().toLong(); } - @Override public void setIsDhLightCorrect(boolean isDhLightCorrect) { this.isDhLightCorrect = isDhLightCorrect; } @@ -364,13 +361,11 @@ public class ChunkWrapper implements IChunkWrapper { if (this.blockLightStorage == null) { - this.blockLightStorage = new ChunkLightStorage( - this.getMinBuildHeight(), this.getMaxBuildHeight(), - // positions above and below the handled area should be unlit - LodUtil.MIN_MC_LIGHT, LodUtil.MIN_MC_LIGHT); + this.blockLightStorage = ChunkLightStorage.createBlockLightStorage(this); } return this.blockLightStorage; } + public void setBlockLightStorage(ChunkLightStorage lightStorage) { this.blockLightStorage = lightStorage; } @Override @@ -390,13 +385,11 @@ public class ChunkWrapper implements IChunkWrapper { if (this.skyLightStorage == null) { - this.skyLightStorage = new ChunkLightStorage( - this.getMinBuildHeight(), this.getMaxBuildHeight(), - // positions above should be lit but positions below should be unlit - LodUtil.MAX_MC_LIGHT, LodUtil.MIN_MC_LIGHT); + this.skyLightStorage = ChunkLightStorage.createSkyLightStorage(this); } return this.skyLightStorage; } + public void setSkyLightStorage(ChunkLightStorage lightStorage) { this.skyLightStorage = lightStorage; } @Override @@ -492,8 +485,6 @@ public class ChunkWrapper implements IChunkWrapper return true; } - public LevelReader getColorResolver() { return this.lightSource; } - @Override public String toString() { return this.chunk.getClass().getSimpleName() + this.chunk.getPos(); } @@ -573,65 +564,4 @@ public class ChunkWrapper implements IChunkWrapper #endif - - //================// - // helper methods // - //================// - - /** used to prevent accidentally attempting to get/set values outside this chunk's boundaries */ - private void throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(int x, int y, int z) throws IndexOutOfBoundsException - { - if (!RUN_RELATIVE_POS_INDEX_VALIDATION) - { - return; - } - - - // FIXME +1 is to handle the fact that LodDataBuilder adds +1 to all block lighting calculations, also done in the constructor - int minHeight = this.getMinBuildHeight(); - int maxHeight = this.getMaxBuildHeight() + 1; - - if (x < 0 || x >= LodUtil.CHUNK_WIDTH - || z < 0 || z >= LodUtil.CHUNK_WIDTH - || y < minHeight || y > maxHeight) - { - String errorMessage = "Relative position [" + x + "," + y + "," + z + "] out of bounds. \n" + - "X/Z must be between 0 and 15 (inclusive) \n" + - "Y must be between [" + minHeight + "] and [" + maxHeight + "] (inclusive)."; - throw new IndexOutOfBoundsException(errorMessage); - } - } - - - /** - * Converts a 3D position into a 1D array index.

- * - * Source:
- * stackoverflow - */ - public int relativeBlockPosToIndex(int xRel, int y, int zRel) - { - int yRel = y - this.getMinBuildHeight(); - return (zRel * LodUtil.CHUNK_WIDTH * this.getHeight()) + (yRel * LodUtil.CHUNK_WIDTH) + xRel; - } - - /** - * Converts a 3D position into a 1D array index.

- * - * Source:
- * stackoverflow - */ - public DhBlockPos indexToRelativeBlockPos(int index) - { - final int zRel = index / (LodUtil.CHUNK_WIDTH * this.getHeight()); - index -= (zRel * LodUtil.CHUNK_WIDTH * this.getHeight()); - - final int y = index / LodUtil.CHUNK_WIDTH; - final int yRel = y + this.getMinBuildHeight(); - - final int xRel = index % LodUtil.CHUNK_WIDTH; - return new DhBlockPos(xRel, yRel, zRel); - } - - } diff --git a/coreSubProjects b/coreSubProjects index e011ce3ee..97b86d69c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit e011ce3ee065fa195a694495ec54d5f446520879 +Subproject commit 97b86d69c4031bf575280e8b3e30b8e3470598d9 From 96b4c1a9e8aa5ec0b208780c21a4587b6fab28c3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 11 Jun 2024 20:22:13 -0500 Subject: [PATCH 282/301] Use existing lighting for pre-generated chunks --- .../BatchGenerationEnvironment.java | 97 ++++++++---- .../mimicObject/ChunkLoader.java | 144 +++++++++++++++++- coreSubProjects | 2 +- 3 files changed, 214 insertions(+), 29 deletions(-) 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 36cb6f1e7..4f459eeb9 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 @@ -35,6 +35,7 @@ import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.util.objects.EventTimer; import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.util.gridList.ArrayGridList; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper; import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; @@ -381,7 +382,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv ArrayGridList chunkWrapperList; DhLitWorldGenRegion region; - DummyLightEngine lightEngine; + DummyLightEngine dummyLightEngine; LightGetterAdaptor adaptor; int borderSize = MaxBorderNeeded; @@ -394,49 +395,94 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv ArrayGridList totalChunks; adaptor = new LightGetterAdaptor(this.params.level); - lightEngine = new DummyLightEngine(adaptor); + dummyLightEngine = new DummyLightEngine(adaptor); + + + //=============================// + // try getting existing chunks // + //=============================// + + HashMap chunkSkyLightingByDhPos = new HashMap<>(); + HashMap chunkBlockLightingByDhPos = new HashMap<>(); IEmptyChunkGeneratorFunc emptyChunkGeneratorFunc = (int x, int z) -> { ChunkPos chunkPos = new ChunkPos(x, z); - ChunkAccess target = null; + DhChunkPos dhChunkPos = new DhChunkPos(x, z); + ChunkAccess newChunk = null; try { - target = this.loadOrMakeChunk(chunkPos); + // get the chunk + CompoundTag chunkData = this.getChunkNbtData(chunkPos); + newChunk = this.loadOrMakeChunk(chunkPos, chunkData); + + // get chunk lighting + ChunkLoader.CombinedChunkLightStorage combinedLights = ChunkLoader.readLight(newChunk, chunkData); + if (combinedLights != null) + { + chunkSkyLightingByDhPos.put(dhChunkPos, combinedLights.skyLightStorage); + chunkBlockLightingByDhPos.put(dhChunkPos, combinedLights.blockLightStorage); + } } - catch (RuntimeException e2) + catch (RuntimeException loadChunkError) { // Continue... } - if (target == null) + if (newChunk == null) { - target = new ProtoChunk(chunkPos, UpgradeData.EMPTY - #if MC_VER >= MC_1_17_1 , params.level #endif - #if MC_VER >= MC_1_18_2 , params.biomes, null #endif + newChunk = new ProtoChunk(chunkPos, UpgradeData.EMPTY + #if MC_VER >= MC_1_17_1 , this.params.level #endif + #if MC_VER >= MC_1_18_2 , this.params.biomes, null #endif ); } - return target; + return newChunk; }; totalChunks = new ArrayGridList<>(refSize, (x, z) -> emptyChunkGeneratorFunc.generate(x + refPosX, z + refPosZ)); genEvent.refreshTimeout(); - region = new DhLitWorldGenRegion(params.level, lightEngine, totalChunks, + region = new DhLitWorldGenRegion(this.params.level, dummyLightEngine, totalChunks, ChunkStatus.STRUCTURE_STARTS, refSize / 2, emptyChunkGeneratorFunc); adaptor.setRegion(region); - genEvent.threadedParam.makeStructFeat(region, params); + genEvent.threadedParam.makeStructFeat(region, this.params); + + //=======================// + // create chunk wrappers // + //=======================// + chunkWrapperList = new ArrayGridList<>(totalChunks.gridSize); totalChunks.forEachPos((x, z) -> { ChunkAccess chunk = totalChunks.get(x, z); if (chunk != null) { - chunkWrapperList.set(x, z, new ChunkWrapper(chunk, region, serverlevel.getLevelWrapper())); + // wrap the chunk + ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, region, this.serverlevel.getLevelWrapper()); + chunkWrapperList.set(x, z, chunkWrapper); + + // try getting the chunk lighting + if (chunkBlockLightingByDhPos.containsKey(chunkWrapper.getChunkPos())) + { + chunkWrapper.setBlockLightStorage(chunkBlockLightingByDhPos.get(chunkWrapper.getChunkPos())); + chunkWrapper.setSkyLightStorage(chunkSkyLightingByDhPos.get(chunkWrapper.getChunkPos())); + chunkWrapper.setUseDhLighting(true); + chunkWrapper.setIsDhLightCorrect(true); + } + else + { + int k = 0; + } } }); + + + //=================// + // generate chunks // + //=================// + this.generateDirect(genEvent, chunkWrapperList, borderSize, genEvent.targetGenerationStep, region); genEvent.timer.nextEvent("cleanup"); } @@ -502,16 +548,10 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv PREF_LOGGER.infoInc("{}", genEvent.timer); } } - private ChunkAccess loadOrMakeChunk(ChunkPos chunkPos) + private CompoundTag getChunkNbtData(ChunkPos chunkPos) { ServerLevel level = this.params.level; - - - //====================// - // get the chunk data // - //====================// - CompoundTag chunkData = null; try { @@ -544,11 +584,11 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Error: " + e.getMessage(), e); } - - - //========================// - // convert the chunk data // - //========================// + return chunkData; + } + private ChunkAccess loadOrMakeChunk(ChunkPos chunkPos, CompoundTag chunkData) + { + ServerLevel level = this.params.level; if (chunkData == null) { @@ -708,8 +748,11 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv // if this isn't done everything else afterward may fail Heightmap.primeHeightmaps(((ChunkWrapper)centerChunk).getChunk(), ChunkStatus.FEATURES.heightmapsAfter()); - // populate the lighting - DhLightingEngine.INSTANCE.lightChunk(centerChunk, iChunkWrapperList, maxSkyLight); + // pre-generated chunks should have lighting but new ones won't + if (!centerChunk.isLightCorrect()) + { + DhLightingEngine.INSTANCE.lightChunk(centerChunk, iChunkWrapperList, maxSkyLight); + } } genEvent.refreshTimeout(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index b82370dfb..1a7ce278b 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -22,9 +22,14 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject; import com.google.common.collect.Maps; import com.mojang.serialization.Codec; import com.mojang.serialization.Dynamic; +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.logging.ConfigBasedLogger; +import com.seibel.distanthorizons.core.util.LodUtil; +import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage; +import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; @@ -44,6 +49,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.*; @@ -100,8 +106,14 @@ public class ChunkLoader private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks"; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER; + private static boolean lightingSectionErrorLogged = false; + + //============// + // read chunk // + //============// + public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) { #if MC_VER < MC_1_18_2 @@ -349,9 +361,121 @@ public class ChunkLoader - public static LevelChunk readLight(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData) + //=====================// + // read chunk lighting // + //=====================// + + /** + * https://minecraft.wiki/w/Chunk_format + */ + public static CombinedChunkLightStorage readLight(ChunkAccess chunk, CompoundTag chunkData) { + #if MC_VER <= MC_1_17_1 + // MC 1.16 and 1.17 doesn't have the necessary NBT info return null; + #else + + CombinedChunkLightStorage combinedStorage = new CombinedChunkLightStorage(ChunkWrapper.getMinBuildHeight(chunk), ChunkWrapper.getMaxBuildHeight(chunk)); + ChunkLightStorage blockLightStorage = combinedStorage.blockLightStorage; + ChunkLightStorage skyLightStorage = combinedStorage.skyLightStorage; + + boolean foundSkyLight = false; + + + + //===================// + // get NBT tags info // + //===================// + + Tag chunkSectionTags = chunkData.get("sections"); + if (chunkSectionTags == null) + { + if (!lightingSectionErrorLogged) + { + lightingSectionErrorLogged = true; + LOGGER.error("No sections found for chunk at pos ["+chunk.getPos()+"] chunk data may be out of date."); + } + return null; + } + else if (!(chunkSectionTags instanceof ListTag)) + { + if (!lightingSectionErrorLogged) + { + lightingSectionErrorLogged = true; + LOGGER.error("Chunk section tag list have unexpected type ["+chunkSectionTags.getClass().getName()+"], expected ["+ListTag.class.getName()+"]."); + } + return null; + } + ListTag chunkSectionListTag = (ListTag) chunkSectionTags; + + + + //===================// + // get lighting info // + //===================// + + for (int sectionIndex = 0; sectionIndex < chunkSectionListTag.size(); sectionIndex++) + { + Tag chunkSectionTag = chunkSectionListTag.get(sectionIndex); + if (!(chunkSectionTag instanceof CompoundTag)) + { + if (!lightingSectionErrorLogged) + { + lightingSectionErrorLogged = true; + LOGGER.error("Chunk section tag has an unexpected type ["+chunkSectionTag.getClass().getName()+"], expected ["+CompoundTag.class.getName()+"]."); + } + return null; + } + CompoundTag chunkSectionCompoundTag = (CompoundTag) chunkSectionTag; + + + // if null all lights = 0 + byte[] blockLightNibbleArray = chunkSectionCompoundTag.getByteArray("BlockLight"); + byte[] skyLightNibbleArray = chunkSectionCompoundTag.getByteArray("SkyLight"); + + // if any sky light was found then all lights above will be max brightness + if (skyLightNibbleArray.length != 0) + { + foundSkyLight = true; + } + + for (int relX = 0; relX < LodUtil.CHUNK_WIDTH; relX++) + { + for (int relZ = 0; relZ < LodUtil.CHUNK_WIDTH; relZ++) + { + // chunk sections are also 16 blocks tall + for (int relY = 0; relY < LodUtil.CHUNK_WIDTH; relY++) + { + int blockPosIndex = relY*16*16 + relZ*16 + relX; + byte blockLight = (blockLightNibbleArray.length == 0) ? 0 : getNibbleAtIndex(blockLightNibbleArray, blockPosIndex); + byte skyLight = (skyLightNibbleArray.length == 0) ? 0 : getNibbleAtIndex(skyLightNibbleArray, blockPosIndex); + if (skyLightNibbleArray.length == 0 && foundSkyLight) + { + skyLight = LodUtil.MAX_MC_LIGHT; + } + + int y = relY + (sectionIndex * LodUtil.CHUNK_WIDTH) + ChunkWrapper.getMinBuildHeight(chunk); + blockLightStorage.set(relX, y, relZ, blockLight); + skyLightStorage.set(relX, y, relZ, skyLight); + } + } + } + } + + return combinedStorage; + #endif + } + /** source: https://minecraft.wiki/w/Chunk_format#Block_Format */ + private static byte getNibbleAtIndex(byte[] arr, int index) + { + if (index % 2 == 0) + { + return (byte)(arr[index/2] & 0x0F); + } + else + { + return (byte)((arr[index/2]>>4) & 0x0F); + } } private static void logErrors(ChunkPos chunkPos, int i, String string) @@ -359,5 +483,23 @@ public class ChunkLoader LOGGER.error("Distant Horizons: Recoverable errors when loading section [" + chunkPos.x + ", " + i + ", " + chunkPos.z + "]: " + string); } + + + //================// + // helper classes // + //================// + + public static class CombinedChunkLightStorage + { + public ChunkLightStorage blockLightStorage; + public ChunkLightStorage skyLightStorage; + + public CombinedChunkLightStorage(int minY, int maxY) + { + this.blockLightStorage = ChunkLightStorage.createBlockLightStorage(minY, maxY); + this.skyLightStorage = ChunkLightStorage.createSkyLightStorage(minY, maxY); + } + } + } diff --git a/coreSubProjects b/coreSubProjects index 97b86d69c..af9b55ad6 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 97b86d69c4031bf575280e8b3e30b8e3470598d9 +Subproject commit af9b55ad6cd1446dd96c3a5e5c9968e560b36cb7 From 48e29784380be8c571a63a0a1dbebbc229b33955 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 13 Jun 2024 07:15:11 -0500 Subject: [PATCH 283/301] Fixes #713 (Forge/Neo level unload events not being called) --- .../java/com/seibel/distanthorizons/forge/ForgeClientProxy.java | 2 +- .../seibel/distanthorizons/neoforge/NeoforgeClientProxy.java | 2 +- 2 files changed, 2 insertions(+), 2 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 e97d9b9f5..036bc979b 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -144,7 +144,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy #if MC_VER < MC_1_19_2 public void clientLevelUnloadEvent(WorldEvent.Unload event) #else - public void clientLevelUnloadEvent(LevelEvent.Load event) + public void clientLevelUnloadEvent(LevelEvent.Unload event) #endif { LOGGER.info("level unload"); diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index 8a086c0b1..cc53ba527 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -140,7 +140,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper); } @SubscribeEvent - public void clientLevelUnloadEvent(LevelEvent.Load event) + public void clientLevelUnloadEvent(LevelEvent.Unload event) { LOGGER.info("level unload"); From 94ad118c5df77b8a1a7b360c90e8c387b9858512 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 13 Jun 2024 07:30:42 -0500 Subject: [PATCH 284/301] Minor memory optimization thanks to littlewolf --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index af9b55ad6..54c2213eb 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit af9b55ad6cd1446dd96c3a5e5c9968e560b36cb7 +Subproject commit 54c2213eb61879492ac29b1bf4646fcc6020af55 From a12092c1a1a1dc077d684730c395779653a30c96 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 14 Jun 2024 07:36:25 -0500 Subject: [PATCH 285/301] Add fabric 1.21 support --- .../common/wrappers/WrapperFactory.java | 12 ++--- .../common/wrappers/block/BiomeWrapper.java | 4 ++ .../wrappers/block/BlockStateWrapper.java | 4 ++ .../common/wrappers/chunk/ChunkWrapper.java | 10 ++++ .../common/wrappers/gui/ClassicConfigGUI.java | 8 ++- .../wrappers/gui/updater/UpdateModScreen.java | 16 +++++- .../MinecraftDedicatedServerWrapper.java | 16 +++--- .../minecraft/MinecraftRenderWrapper.java | 2 +- .../BatchGenerationEnvironment.java | 19 +++++-- .../mimicObject/ChunkLoader.java | 17 ++++-- .../mimicObject/DhGenerationChunkHolder.java | 23 ++++++++ .../mimicObject/DhLitWorldGenRegion.java | 32 +++++++++-- .../worldGeneration/step/StepBiomes.java | 26 ++++++--- .../worldGeneration/step/StepFeatures.java | 12 ++--- .../worldGeneration/step/StepNoise.java | 23 +++++--- .../step/StepStructureReference.java | 12 +++-- .../step/StepStructureStart.java | 6 ++- .../worldGeneration/step/StepSurface.java | 13 +++-- coreSubProjects | 2 +- .../fabric/FabricClientProxy.java | 7 ++- .../mixins/client/MixinLevelRenderer.java | 7 ++- .../mixins/client/MixinOptionsScreen.java | 23 +++++--- .../wrappers/modAccessor/BCLibAccessor.java | 5 +- gradle.properties | 4 +- versionProperties/1.21.properties | 54 +++++++++++++++++++ 25 files changed, 290 insertions(+), 67 deletions(-) create mode 100644 common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhGenerationChunkHolder.java create mode 100644 versionProperties/1.21.properties 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 7b885fc5f..115243c1d 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 @@ -130,7 +130,7 @@ public class WrapperFactory implements IWrapperFactory } } - #if MC_VER <= MC_1_20_6 + #if MC_VER <= MC_1_21 else if (objectArray.length == 2) { // correct number of parameters from the API @@ -195,7 +195,7 @@ public class WrapperFactory implements IWrapperFactory { String[] expectedClassNames; - #if MC_VER <= MC_1_20_6 + #if MC_VER <= MC_1_21 expectedClassNames = new String[] { ChunkAccess.class.getName(), @@ -243,7 +243,7 @@ public class WrapperFactory implements IWrapperFactory Biome biome = (Biome) objectArray[0]; return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper); - #elif MC_VER <= MC_1_20_6 + #elif MC_VER <= MC_1_21 if (!(objectArray[0] instanceof Holder) || !(((Holder) objectArray[0]).value() instanceof Biome)) { throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); @@ -266,7 +266,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_6 + #elif MC_VER <= MC_1_21 expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #else // See preprocessor comment in createChunkWrapper() for full documentation @@ -287,7 +287,7 @@ public class WrapperFactory implements IWrapperFactory - #if MC_VER <= MC_1_20_6 + #if MC_VER <= MC_1_21 if (objectArray.length != 1) { throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray)); @@ -314,7 +314,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_6 + #elif MC_VER <= MC_1_21 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/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index f7282de12..5f1b205b0 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 @@ -293,7 +293,11 @@ public class BiomeWrapper implements IBiomeWrapper ResourceLocation resourceLocation; try { + #if MC_VER < MC_1_21 resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); + #else + resourceLocation = ResourceLocation.fromNamespaceAndPath(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1)); + #endif } catch (Exception e) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 4a40c6e1f..52b30b922 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -380,7 +380,11 @@ public class BlockStateWrapper implements IBlockStateWrapper ResourceLocation resourceLocation; try { + #if MC_VER < MC_1_21 resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1)); + #else + resourceLocation = ResourceLocation.fromNamespaceAndPath(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1)); + #endif } catch (Exception e) { 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 321d02050..07f65dfca 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 @@ -292,6 +292,16 @@ public class ChunkWrapper implements IChunkWrapper public ChunkAccess getChunk() { return this.chunk; } + public ChunkStatus getStatus() { return getStatus(this.getChunk()); } + public static ChunkStatus getStatus(ChunkAccess chunk) + { + #if MC_VER < MC_1_21 + return chunk.getStatus(); + #else + return chunk.getPersistedStatus(); + #endif + } + @Override public int getMaxBlockX() { return this.chunk.getPos().getMaxBlockX(); } @Override diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 228c4a218..ffb8d9412 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -255,7 +255,13 @@ public class ClassicConfigGUI // texture UV Offset 0, 0, // Some textuary stuff - 0, new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), 20, 20, + 0, + #if MC_VER < MC_1_21 + new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), + #else + ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"), + #endif + 20, 20, // Create the button and tell it where to go (buttonWidget) -> { ChangelogScreen changelogScreen = new ChangelogScreen(this); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 01ac2bb2f..f4d52e9d6 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -75,7 +75,13 @@ public class UpdateModScreen extends DhScreen // Offset 0, 0, // Some textuary stuff - 0, new ResourceLocation(ModInfo.ID, "logo.png"), 130, 65, + 0, + #if MC_VER < MC_1_21 + new ResourceLocation(ModInfo.ID, "logo.png"), + #else + ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "logo.png"), + #endif + 130, 65, // Create the button and tell it where to go // For now it goes to the client option by default (buttonWidget) -> System.out.println("Nice, you found an easter egg :)"), // TODO: Add a proper easter egg to pressing the logo (maybe with confetti) @@ -100,7 +106,13 @@ public class UpdateModScreen extends DhScreen // Offset 0, 0, // Some textuary stuff - 0, new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), 20, 20, + 0, + #if MC_VER < MC_1_21 + new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), + #else + ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/changelog.png"), + #endif + 20, 20, // Create the button and tell it where to go (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(new ChangelogScreen(this, this.newVersionID)), // TODO: Add a proper easter egg to pressing the logo (maybe with confetti) // Add a title to the button diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftDedicatedServerWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftDedicatedServerWrapper.java index af701e598..bf09dc1bd 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftDedicatedServerWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftDedicatedServerWrapper.java @@ -12,16 +12,20 @@ public class MinecraftDedicatedServerWrapper implements IMinecraftSharedWrapper private MinecraftDedicatedServerWrapper() { } public DedicatedServer dedicatedServer = null; @Override - public boolean isDedicatedServer() - { - return true; - } + public boolean isDedicatedServer() { return true; } @Override public File getInstallationDirectory() { - if (dedicatedServer == null) + if (this.dedicatedServer == null) + { throw new IllegalStateException("Trying to get Installation Direction before Dedicated server complete initialization!"); - return dedicatedServer.getServerDirectory(); + } + + #if MC_VER < MC_1_21 + return this.dedicatedServer.getServerDirectory(); + #else + return this.dedicatedServer.getServerDirectory().toFile(); + #endif } } 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 a4651ae75..eba3ef2e9 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 @@ -215,7 +215,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper #if MC_VER < MC_1_17_1 Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime()); #else - Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime()); + Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getTimer().getRealtimeDeltaTicks()); #endif return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z); } 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 4f459eeb9..a3cf7bc3e 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 @@ -440,9 +440,18 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv }; totalChunks = new ArrayGridList<>(refSize, (x, z) -> emptyChunkGeneratorFunc.generate(x + refPosX, z + refPosZ)); + int radius = refSize / 2; + int centerX = refPosX + radius; + int centerZ = refPosZ + radius; + + ChunkAccess centerChunk = totalChunks.stream().filter(chunk -> chunk.getPos().x == centerX && chunk.getPos().z == centerZ).findFirst().get(); + genEvent.refreshTimeout(); - region = new DhLitWorldGenRegion(this.params.level, dummyLightEngine, totalChunks, - ChunkStatus.STRUCTURE_STARTS, refSize / 2, emptyChunkGeneratorFunc); + region = new DhLitWorldGenRegion( + centerX, centerZ, + centerChunk, + this.params.level, dummyLightEngine, totalChunks, + ChunkStatus.STRUCTURE_STARTS, radius, emptyChunkGeneratorFunc); adaptor.setRegion(region); genEvent.threadedParam.makeStructFeat(region, this.params); @@ -513,7 +522,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv throw new RuntimeException("The generated chunk somehow has isLightCorrect() returning false"); } - boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk; + boolean isFull = ChunkWrapper.getStatus(target) == ChunkStatus.FULL || target instanceof LevelChunk; #if MC_VER >= MC_1_18_2 boolean isPartial = target.isOldNoiseGeneration(); #endif @@ -529,7 +538,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv genEvent.resultConsumer.accept(wrappedChunk); } #endif - else if (target.getStatus() == ChunkStatus.EMPTY) + else if (ChunkWrapper.getStatus(target) == ChunkStatus.EMPTY) { genEvent.resultConsumer.accept(wrappedChunk); } @@ -727,7 +736,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv for (int i = 0; i < chunksToGenerate.size(); i++) // regular for loop since enhanced for loops increase GC pressure slightly { ChunkWrapper chunkWrapper = chunksToGenerate.get(i); - if (chunkWrapper.getChunk().getStatus() != ChunkStatus.EMPTY) + if (chunkWrapper.getStatus() != ChunkStatus.EMPTY) { iChunkWrapperList.add(chunkWrapper); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 1a7ce278b..f69efe3b8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -85,6 +85,9 @@ import net.minecraft.world.level.material.Fluids; #if MC_VER == MC_1_20_6 import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.chunk.status.ChunkType; +#elif MC_VER == MC_1_21 +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.chunk.status.ChunkType; #endif import net.minecraft.world.level.material.Fluid; @@ -286,7 +289,11 @@ public class ChunkLoader blockStateContainer = tagSection.contains("block_states", 10) ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)) - #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif + #if MC_VER < MC_1_20_6 + .getOrThrow(false, LOGGER::error) + #else + .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) + #endif : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); #if MC_VER < MC_1_18_2 @@ -297,7 +304,11 @@ public class ChunkLoader biomeContainer = tagSection.contains("biomes", 10) ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)) - #if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif + #if MC_VER < MC_1_20_6 + .getOrThrow(false, LOGGER::error) + #else + .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) + #endif : new PalettedContainer>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); #endif @@ -312,7 +323,7 @@ public class ChunkLoader } return chunkSections; } - private static #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) + private static #if MC_VER < MC_1_21 ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) { ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status")); if (chunkStatus != null) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhGenerationChunkHolder.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhGenerationChunkHolder.java new file mode 100644 index 000000000..519938ce8 --- /dev/null +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhGenerationChunkHolder.java @@ -0,0 +1,23 @@ +package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject; + +#if MC_VER >= MC_1_21 + +import net.minecraft.server.level.GenerationChunkHolder; +import net.minecraft.world.level.ChunkPos; + +public class DhGenerationChunkHolder extends GenerationChunkHolder +{ + + public DhGenerationChunkHolder(ChunkPos pos) + { + super(pos); + } + + @Override + public int getTicketLevel() { return 0; } + @Override + public int getQueueLevel() { return 0; } + +} + +#endif \ No newline at end of file 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 8ee62a90f..ce4fd28a2 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 @@ -20,14 +20,17 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject; import java.lang.invoke.MethodHandles; +import java.util.EnumSet; import java.util.List; import java.util.concurrent.locks.ReentrantLock; +import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.LodUtil; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.SpawnerBlock; +import net.minecraft.world.level.chunk.status.*; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -59,7 +62,12 @@ 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 + +#if MC_VER == MC_1_21 +import net.minecraft.util.StaticCache2D; +import com.google.common.collect.ImmutableList; +import net.minecraft.server.level.GenerationChunkHolder; #endif @@ -112,11 +120,29 @@ public class DhLitWorldGenRegion extends WorldGenRegion public DhLitWorldGenRegion( + int centerChunkX, int centerChunkZ, + ChunkAccess centerChunk, ServerLevel serverLevel, DummyLightEngine lightEngine, List chunkList, ChunkStatus chunkStatus, int writeRadius, BatchGenerationEnvironment.IEmptyChunkGeneratorFunc generator) { - super(serverLevel, chunkList #if MC_VER >= MC_1_17_1 , chunkStatus, writeRadius #endif ); + #if MC_VER == MC_1_16 + super(serverLevel, chunkList); + #elif MC_VER < MC_1_21 + super(serverLevel, chunkList, chunkStatus, writeRadius); + #else + super(serverLevel, + StaticCache2D.create( + centerChunkX, centerChunkZ, + writeRadius * 2, (x,z) -> new DhGenerationChunkHolder(new ChunkPos(x, z))), + new ChunkStep(chunkStatus, + // reverse is needed because MC uses the index of the chunkStatus to determine how many items are in the list instead of the actual list count + new ChunkDependencies(ImmutableList.copyOf(ChunkStatus.getStatusList()).reverse()), + new ChunkDependencies(ImmutableList.copyOf(ChunkStatus.getStatusList()).reverse()), + writeRadius, (WorldGenContext var1, ChunkStep var2, StaticCache2D var3, ChunkAccess var4) -> null), + centerChunk); + + #endif this.firstPos = chunkList.get(0).getPos(); this.generator = generator; this.lightEngine = lightEngine; @@ -280,7 +306,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion private ChunkAccess getChunkAccess(int chunkX, int chunkZ, ChunkStatus chunkStatus, boolean returnNonNull) { ChunkAccess chunk = this.superHasChunk(chunkX, chunkZ) ? this.superGetChunk(chunkX, chunkZ) : null; - if (chunk != null && chunk.getStatus().isOrAfter(chunkStatus)) + if (chunk != null && ChunkWrapper.getStatus(chunk).isOrAfter(chunkStatus)) { return chunk; } 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 d52fdc447..7fdce78f0 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 @@ -56,29 +56,39 @@ public final class StepBiomes List chunkWrappers) { - ArrayList chunksToDo = new ArrayList(); + ArrayList chunksToDo = new ArrayList<>(); for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) continue; - ((ProtoChunk) chunk).setStatus(STATUS); - chunksToDo.add(chunk); + if (!chunkWrapper.getStatus().isOrAfter(STATUS)) + { + #if MC_VER < MC_1_21 + ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif + + chunksToDo.add(chunk); + } } for (ChunkAccess chunk : chunksToDo) { // System.out.println("StepBiomes: "+chunk.getPos()); #if MC_VER < MC_1_18_2 - environment.params.generator.createBiomes(environment.params.biomes, chunk); + this.environment.params.generator.createBiomes(this.environment.params.biomes, chunk); #elif MC_VER < MC_1_19_2 - chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion), + chunk = this.environment.joinSync(this.environment.params.generator.createBiomes(this.environment.params.biomes, Runnable::run, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #elif MC_VER < MC_1_19_4 - chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion), + chunk = this.environment.joinSync(this.environment.params.generator.createBiomes(this.environment.params.biomes, Runnable::run, this.environment.params.randomState, Blender.of(worldGenRegion), + tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); + #elif MC_VER < MC_1_21 + chunk = this.environment.joinSync(this.environment.params.generator.createBiomes(Runnable::run, this.environment.params.randomState, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else - chunk = environment.joinSync(environment.params.generator.createBiomes(Runnable::run, environment.params.randomState, Blender.of(worldGenRegion), + chunk = this.environment.joinSync(this.environment.params.generator.createBiomes(this.environment.params.randomState, Blender.of(worldGenRegion), tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #endif } 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 4f6618e1f..5ae538825 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 @@ -59,14 +59,14 @@ public final class StepFeatures for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) - { - continue; - } - - if (chunk instanceof ProtoChunk) + if (!chunkWrapper.getStatus().isOrAfter(STATUS) + && chunk instanceof ProtoChunk) { + #if MC_VER < MC_1_21 ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif } 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 a99958aac..47b524cd5 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 @@ -58,13 +58,21 @@ public final class StepNoise List chunkWrappers) { - ArrayList chunksToDo = new ArrayList(); + ArrayList chunksToDo = new ArrayList<>(); for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) continue; + if (chunkWrapper.getStatus().isOrAfter(STATUS)) + { + continue; + } + + #if MC_VER < MC_1_21 ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif chunksToDo.add(chunk); } @@ -72,15 +80,18 @@ public final class StepNoise { // System.out.println("StepNoise: "+chunk.getPos()); #if MC_VER < MC_1_17_1 - environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk); + this.environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk); #elif MC_VER < MC_1_18_2 - chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, + chunk = this.environment.joinSync(this.environment.params.generator.fillFromNoise(Runnable::run, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #elif MC_VER < MC_1_19_2 - chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), + chunk = this.environment.joinSync(this.environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), + tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); + #elif MC_VER < MC_1_21 + chunk = this.environment.joinSync(this.environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), this.environment.params.randomState, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #else - chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), environment.params.randomState, + chunk = this.environment.joinSync(this.environment.params.generator.fillFromNoise(Blender.of(worldGenRegion), this.environment.params.randomState, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk)); #endif UncheckedInterruptedException.throwIfInterrupted(); 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 3894c522d..e90819967 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 @@ -59,9 +59,15 @@ public final class StepStructureReference for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) continue; - ((ProtoChunk) chunk).setStatus(STATUS); - chunksToDo.add(chunk); + if (!chunkWrapper.getStatus().isOrAfter(STATUS)) + { + #if MC_VER < MC_1_21 + ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif + chunksToDo.add(chunk); + } } for (ChunkAccess chunk : chunksToDo) 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 24e9c90b5..8c53a0c12 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 @@ -76,9 +76,13 @@ public final class StepStructureStart for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (!chunk.getStatus().isOrAfter(STATUS)) + if (!chunkWrapper.getStatus().isOrAfter(STATUS)) { + #if MC_VER < MC_1_21 ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif chunksToDo.add(chunk); } } 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 384611a2f..0e61d70a2 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 @@ -58,9 +58,16 @@ public final class StepSurface for (ChunkWrapper chunkWrapper : chunkWrappers) { ChunkAccess chunk = chunkWrapper.getChunk(); - if (chunk.getStatus().isOrAfter(STATUS)) continue; - ((ProtoChunk) chunk).setStatus(STATUS); - chunksToDo.add(chunk); + if (!chunkWrapper.getStatus().isOrAfter(STATUS)) + { + #if MC_VER < MC_1_21 + ((ProtoChunk) chunk).setStatus(STATUS); + #else + ((ProtoChunk) chunk).setPersistedStatus(STATUS); + #endif + + chunksToDo.add(chunk); + } } for (ChunkAccess chunk : chunksToDo) diff --git a/coreSubProjects b/coreSubProjects index 54c2213eb..7b153a8aa 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 54c2213eb61879492ac29b1bf4646fcc6020af55 +Subproject commit 7b153a8aadc703209b58b8760d1dd879fdfbca4e diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index cb2153586..71e35cd76 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -208,7 +208,12 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()), modelViewMatrix, projectionMatrix, - renderContext.tickDelta()); + #if MC_VER < MC_1_21 + renderContext.tickDelta() + #else + renderContext.tickCounter().getGameTimeDeltaTicks() + #endif + ); }); // Debug keyboard event diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 34767a843..12bbb0421 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -120,7 +120,12 @@ public class MixinLevelRenderer ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, - Minecraft.getInstance().getFrameTime()); + #if MC_VER < MC_1_21 + Minecraft.getInstance().getFrameTime() + #else + Minecraft.getInstance().getTimer().getRealtimeDeltaTicks() + #endif + ); } // FIXME completely disables rendering when sodium is installed diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 7c4116b6d..d638536f7 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -23,16 +23,13 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; -import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; #if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; -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; @@ -41,11 +38,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -#if MC_VER == MC_1_20_6 +#if MC_VER >= MC_1_20_6 import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Shadow; #endif +#if MC_VER < MC_1_21 +import net.minecraft.client.gui.screens.OptionsScreen; +#else +import net.minecraft.client.gui.screens.options.OptionsScreen; +#endif + + /** * Adds a button to the menu to goto the config * @@ -57,13 +63,18 @@ public class MixinOptionsScreen extends Screen { /** Texture used for the config opening button */ @Unique - private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); + private static final ResourceLocation ICON_TEXTURE = + #if MC_VER < MC_1_21 + new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); + #else + ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png"); + #endif @Unique private TexturedButtonWidget optionsButton = null; - #if MC_VER == MC_1_20_6 + #if MC_VER >= MC_1_20_6 @Shadow @Final protected HeaderAndFooterLayout layout; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index ed9c55488..06efa7741 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -5,7 +5,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAcces #elif MC_VER == MC_1_18_2 import ru.bclib.config.ClientConfig; import ru.bclib.config.Configs; -#else +#elif MC_VER < MC_1_21 import org.betterx.bclib.config.ClientConfig; import org.betterx.bclib.config.Configs; #endif @@ -17,7 +17,8 @@ public class BCLibAccessor implements IBCLibAccessor public void setRenderCustomFog(boolean newValue) { - #if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 || MC_VER == MC_1_20_6) // These versions either don't have BCLib, or the implementation is different + // only some MC versions have BCLib and require this fix + #if (MC_VER > MC_1_17_1 && MC_VER < MC_1_20_4) // Change the value of CUSTOM_FOG_RENDERING in the bclib client config // This disabled fog from rendering within bclib diff --git a/gradle.properties b/gradle.properties index b66ef5dbd..6da075fb9 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.15 +manifold_version=2023.1.17 # 2023.1.17 can be used if there are mystery Java compiler issues nightconfig_version=3.6.6 lz4_version=1.8.0 @@ -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.21 # Defines the maximum amount of memory Minecraft is allowed when run in a development environment #minecraftMemoryJavaArg="-Xmx4G" diff --git a/versionProperties/1.21.properties b/versionProperties/1.21.properties new file mode 100644 index 000000000..e16886c23 --- /dev/null +++ b/versionProperties/1.21.properties @@ -0,0 +1,54 @@ +# 1.21 version +java_version=21 +minecraft_version=1.21 +parchment_version=1.20.6:2024.05.01 +compatible_minecraft_versions=["1.21.0"] +accessWidenerVersion=1_20_6 +builds_for=fabric +# neoforge +# forge is broken due to gradle/build script issues + +# Fabric loader +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 + # Fabric mod versions + modmenu_version=11.0.0-beta.1 + starlight_version_fabric= + phosphor_version_fabric= + lithium_version= + sodium_version=mc1.21-0.5.9 + iris_version=1.7.1+1.21 + bclib_version= + immersive_portals_version= + canvas_version= + + fabric_incompatibility_list={ "iris": "<=1.6.20" } + fabric_recommend_list={} + + # 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.19 +neoforge_version=20.6.70-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 601d4e6e3a611874fdfd2492d2c1a216c0c28de5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 14 Jun 2024 07:40:29 -0500 Subject: [PATCH 286/301] Fix CI not picking up 1.21 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d84d24eea..181343627 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ build: stage: build parallel: matrix: - - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4", "1.20.6"] + - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4", "1.20.6", "1.21"] script: # this both runs the unit tests and assembles the code - ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; From f4e71f701278d87d70cdb51e5fcc326050ded204 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 14 Jun 2024 19:05:45 -0500 Subject: [PATCH 287/301] Add NeoForge 1.21 --- .../minecraft/MinecraftRenderWrapper.java | 15 +++++++++--- gradle.properties | 2 +- .../mixins/client/MixinLevelRenderer.java | 12 +++++++--- .../mixins/client/MixinOptionsScreen.java | 24 +++++++++++++------ versionProperties/1.21.properties | 5 ++-- 5 files changed, 41 insertions(+), 17 deletions(-) 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 eba3ef2e9..e0ffe856e 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 @@ -212,15 +212,24 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper { if (MC.level.dimensionType().hasSkyLight()) { - #if MC_VER < MC_1_17_1 - Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime()); + float frameTime; + #if MC_VER < MC_1_21 + frameTime = MC.getFrameTime(); #else - Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getTimer().getRealtimeDeltaTicks()); + frameTime = MC.getTimer().getRealtimeDeltaTicks(); + #endif + + #if MC_VER < MC_1_17_1 + Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), frameTime); + #else + Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime); #endif return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z); } else + { return new Color(0, 0, 0); + } } @Override diff --git a/gradle.properties b/gradle.properties index 6da075fb9..b8928e5de 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.21 +mcVer=1.20.6 # Defines the maximum amount of memory Minecraft is allowed when run in a development environment #minecraftMemoryJavaArg="-Xmx4G" diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java index 95e5e9bff..8c3c0506c 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinLevelRenderer.java @@ -98,7 +98,6 @@ public class MixinLevelRenderer private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback) #endif { - // get MC's model view and projection matrices #if MC_VER == MC_1_16_5 // get the matrices from the OpenGL fixed pipeline float[] mcProjMatrixRaw = new float[16]; @@ -120,15 +119,21 @@ public class MixinLevelRenderer #endif + float frameTime; + #if MC_VER < MC_1_21 + frameTime = Minecraft.getInstance().getFrameTime(); + #else + frameTime = Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(); + #endif // only render before solid blocks if (renderType.equals(RenderType.solid())) { - ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); + ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, frameTime); } else if (renderType.equals(RenderType.translucent())) { - ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime()); + ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, frameTime); } if (Config.Client.Advanced.Debugging.lodOnlyMode.get()) @@ -154,4 +159,5 @@ public class MixinLevelRenderer ChunkWrapper.syncedUpdateClientLightStatus(); } + } diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java index 983b446dd..b1a661e78 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/mixins/client/MixinOptionsScreen.java @@ -23,16 +23,13 @@ import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.config.Config; -import net.minecraft.client.gui.screens.OptionsScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; #if MC_VER < MC_1_19_2 import net.minecraft.network.chat.TranslatableComponent; #endif import net.minecraft.resources.ResourceLocation; -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; @@ -41,11 +38,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -#if MC_VER == MC_1_20_6 +#if MC_VER >= MC_1_20_6 import net.minecraft.client.gui.layouts.LinearLayout; import net.minecraft.client.gui.layouts.HeaderAndFooterLayout; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Shadow; #endif +#if MC_VER < MC_1_21 +import net.minecraft.client.gui.screens.OptionsScreen; +#else +import net.minecraft.client.gui.screens.options.OptionsScreen; +#endif + + /** * Adds a button to the menu to goto the config * @@ -57,13 +63,18 @@ public class MixinOptionsScreen extends Screen { /** Texture used for the config opening button */ @Unique - private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); + private static final ResourceLocation ICON_TEXTURE = + #if MC_VER < MC_1_21 + new ResourceLocation(ModInfo.ID, "textures/gui/button.png"); + #else + ResourceLocation.fromNamespaceAndPath(ModInfo.ID, "textures/gui/button.png"); + #endif @Unique private TexturedButtonWidget optionsButton = null; - #if MC_VER == MC_1_20_6 + #if MC_VER >= MC_1_20_6 @Shadow @Final protected HeaderAndFooterLayout layout; @@ -93,7 +104,6 @@ public class MixinOptionsScreen extends Screen // add the button to the correct location in the UI // TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements? - // TODO is there a way we can put the button on the left side of the FOV bar like before? LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child; // determine how wide the other option buttons are so we can put our botton to the left of them all diff --git a/versionProperties/1.21.properties b/versionProperties/1.21.properties index e16886c23..4e9ded570 100644 --- a/versionProperties/1.21.properties +++ b/versionProperties/1.21.properties @@ -4,8 +4,7 @@ minecraft_version=1.21 parchment_version=1.20.6:2024.05.01 compatible_minecraft_versions=["1.21.0"] accessWidenerVersion=1_20_6 -builds_for=fabric -# neoforge +builds_for=fabric,neoforge # forge is broken due to gradle/build script issues # Fabric loader @@ -40,7 +39,7 @@ fabric_api_version=0.100.1+1.21 # (Neo)Forge loader forge_version=50.0.19 -neoforge_version=20.6.70-beta +neoforge_version=21.0.4-beta # (Neo)Forge mod versions starlight_version_forge= terraforged_version= From 5570f3a313c1059ef8fbcf1d73c90453160b7e25 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 14 Jun 2024 19:31:21 -0500 Subject: [PATCH 288/301] Fix some compiling issues --- .../worldGeneration/mimicObject/ChunkLoader.java | 11 +++++++++-- .../mimicObject/DhLitWorldGenRegion.java | 3 +-- gradle.properties | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index f69efe3b8..e89c5ee48 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -323,7 +323,11 @@ public class ChunkLoader } return chunkSections; } - private static #if MC_VER < MC_1_21 ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel) + private static + #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType + #elif MC_VER < MC_1_21 ChunkType + #else ChunkType #endif + readChunkType(CompoundTag tagLevel) { ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status")); if (chunkStatus != null) @@ -331,7 +335,10 @@ public class ChunkLoader return chunkStatus.getChunkType(); } - return #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif + return + #if MC_VER <= MC_1_20_6 ChunkType.PROTOCHUNK; + #elif MC_VER < MC_1_21 ChunkStatus.ChunkType.PROTOCHUNK; + #else ChunkType.PROTOCHUNK; #endif } private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) { 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 ce4fd28a2..ed585da95 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 @@ -23,14 +23,12 @@ import java.lang.invoke.MethodHandles; import java.util.EnumSet; import java.util.List; import java.util.concurrent.locks.ReentrantLock; - import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper; import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.LodUtil; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.SpawnerBlock; -import net.minecraft.world.level.chunk.status.*; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -62,6 +60,7 @@ 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.*; #endif #if MC_VER == MC_1_21 diff --git a/gradle.properties b/gradle.properties index b8928e5de..6da075fb9 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.6 +mcVer=1.21 # Defines the maximum amount of memory Minecraft is allowed when run in a development environment #minecraftMemoryJavaArg="-Xmx4G" From 7e45051ffdf8ed56514d1cbcf223a24aa58b83e6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 14 Jun 2024 22:21:52 -0500 Subject: [PATCH 289/301] Fix more MC version compiles --- .../wrappers/worldGeneration/mimicObject/ChunkLoader.java | 3 +-- .../worldGeneration/mimicObject/DhLitWorldGenRegion.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index e89c5ee48..5699051cb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -336,8 +336,7 @@ public class ChunkLoader } return - #if MC_VER <= MC_1_20_6 ChunkType.PROTOCHUNK; - #elif MC_VER < MC_1_21 ChunkStatus.ChunkType.PROTOCHUNK; + #if MC_VER <= MC_1_20_4 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif } private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) 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 ed585da95..30632bef1 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 @@ -125,7 +125,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion List chunkList, ChunkStatus chunkStatus, int writeRadius, BatchGenerationEnvironment.IEmptyChunkGeneratorFunc generator) { - #if MC_VER == MC_1_16 + #if MC_VER == MC_1_16_5 super(serverLevel, chunkList); #elif MC_VER < MC_1_21 super(serverLevel, chunkList, chunkStatus, writeRadius); From 84bd876c7197b1f553cb25da2e4198355d613b81 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 08:11:26 -0500 Subject: [PATCH 290/301] Refactor ChunkWrapper --- .../common/wrappers/chunk/ChunkWrapper.java | 128 +++++++++++------- coreSubProjects | 2 +- 2 files changed, 78 insertions(+), 52 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 07f65dfca..407da88f4 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 @@ -105,6 +105,8 @@ public class ChunkWrapper implements IChunkWrapper private int minNonEmptyHeight = Integer.MIN_VALUE; private int maxNonEmptyHeight = Integer.MAX_VALUE; + private int blockBiomeHashCode = 0; + /** * Due to vanilla `isClientLightReady()` not being designed for use by a non-render thread, it may return 'true' * before the light engine has ticked, (right after all light changes is marked by the engine to be processed). @@ -144,7 +146,7 @@ public class ChunkWrapper implements IChunkWrapper //=========// - // methods // + // getters // //=========// @Override @@ -263,7 +265,6 @@ public class ChunkWrapper implements IChunkWrapper public int getLightBlockingHeightMapValue(int xRel, int zRel) { return this.chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.MOTION_BLOCKING).getFirstAvailable(xRel, zRel); } - @Override public IBiomeWrapper getBiome(int relX, int relY, int relZ) { @@ -287,6 +288,20 @@ public class ChunkWrapper implements IChunkWrapper #endif } + @Override + public IBlockStateWrapper getBlockState(int relX, int relY, int relZ) + { + this.throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(relX, relY, relZ); + + BlockPos.MutableBlockPos blockPos = MUTABLE_BLOCK_POS_REF.get(); + + blockPos.setX(relX); + blockPos.setY(relY); + blockPos.setZ(relZ); + + return BlockStateWrapper.fromBlockState(this.chunk.getBlockState(blockPos), this.wrappedLevel); + } + @Override public DhChunkPos getChunkPos() { return this.chunkPos; } @@ -311,14 +326,18 @@ public class ChunkWrapper implements IChunkWrapper @Override public int getMinBlockZ() { return this.chunk.getPos().getMinBlockZ(); } + + + //==========// + // lighting // + //==========// + @Override public void setIsDhLightCorrect(boolean isDhLightCorrect) { this.isDhLightCorrect = isDhLightCorrect; } @Override public void setUseDhLighting(boolean useDhLighting) { this.useDhLighting = useDhLighting; } - - @Override public boolean isLightCorrect() { @@ -469,53 +488,6 @@ public class ChunkWrapper implements IChunkWrapper return this.blockLightPosList; } - @Override - public boolean doNearbyChunksExist() - { - if (this.lightSource instanceof DhLitWorldGenRegion) - { - return true; - } - - for (int dx = -1; dx <= 1; dx++) - { - for (int dz = -1; dz <= 1; dz++) - { - if (dx == 0 && dz == 0) - { - continue; - } - else if (this.lightSource.getChunk(dx + this.chunk.getPos().x, dz + this.chunk.getPos().z, ChunkStatus.BIOMES, false) == null) - { - return false; - } - } - } - - return true; - } - - @Override - public String toString() { return this.chunk.getClass().getSimpleName() + this.chunk.getPos(); } - - @Override - public IBlockStateWrapper getBlockState(int relX, int relY, int relZ) - { - this.throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(relX, relY, relZ); - - BlockPos.MutableBlockPos blockPos = MUTABLE_BLOCK_POS_REF.get(); - - blockPos.setX(relX); - blockPos.setY(relY); - blockPos.setZ(relZ); - - return BlockStateWrapper.fromBlockState(this.chunk.getBlockState(blockPos), this.wrappedLevel); - } - - @Override - public boolean isStillValid() { return this.wrappedLevel.tryGetChunk(this.chunkPos) == this; } - - public static void syncedUpdateClientLightStatus() { #if MC_VER < MC_1_18_2 @@ -574,4 +546,58 @@ public class ChunkWrapper implements IChunkWrapper #endif + + //===============// + // other methods // + //===============// + + @Override + public boolean doNearbyChunksExist() + { + if (this.lightSource instanceof DhLitWorldGenRegion) + { + return true; + } + + for (int dx = -1; dx <= 1; dx++) + { + for (int dz = -1; dz <= 1; dz++) + { + if (dx == 0 && dz == 0) + { + continue; + } + else if (this.lightSource.getChunk(dx + this.chunk.getPos().x, dz + this.chunk.getPos().z, ChunkStatus.BIOMES, false) == null) + { + return false; + } + } + } + + return true; + } + + @Override + public boolean isStillValid() { return this.wrappedLevel.tryGetChunk(this.chunkPos) == this; } + + + + //================// + // base overrides // + //================// + + @Override + public String toString() { return this.chunk.getClass().getSimpleName() + this.chunk.getPos(); } + + //@Override + //public int hashCode() + //{ + // if (this.blockBiomeHashCode == 0) + // { + // this.blockBiomeHashCode = this.getBlockBiomeHashCode(); + // } + // + // return this.blockBiomeHashCode; + //} + } diff --git a/coreSubProjects b/coreSubProjects index 7b153a8aa..385e3dc96 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7b153a8aadc703209b58b8760d1dd879fdfbca4e +Subproject commit 385e3dc964fc985b01b68dfc4c852ac4946a9cd3 From 389b09a5cd6ede0fc87ae5b49d90e61d9234cb87 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 09:42:49 -0500 Subject: [PATCH 291/301] Prevent creating LODs for already processed chunks --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 385e3dc96..81d1ed419 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 385e3dc964fc985b01b68dfc4c852ac4946a9cd3 +Subproject commit 81d1ed419e5ee583271579c355e43d750586f5f8 From 272841aae9ece7d4e281133c1ce6570a3d3658ed Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 11:05:10 -0500 Subject: [PATCH 292/301] Add a startup low memory warning --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 81d1ed419..6542e9e88 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 81d1ed419e5ee583271579c355e43d750586f5f8 +Subproject commit 6542e9e88986942928fba562b45bc77040dbfd37 From 34db7c9dac0a19abc1a685775e2e85c31fbff3cc Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 11:26:05 -0500 Subject: [PATCH 293/301] Lower the default CPU presets --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 6542e9e88..4da48c4c5 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 6542e9e88986942928fba562b45bc77040dbfd37 +Subproject commit 4da48c4c55ac2957e483f3f05cd65f4aff938a39 From e7d7033548dc00dab581d7e13ee89a67c65e3865 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 19:20:25 -0500 Subject: [PATCH 294/301] Improve F3 menu logic and visuals --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 4da48c4c5..67819b30e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4da48c4c55ac2957e483f3f05cd65f4aff938a39 +Subproject commit 67819b30ebb869d23a974258ace542837fb32b5b From cd74117de3529c9528e80f5112daa8b7ee74fa47 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 17 Jun 2024 07:42:35 -0500 Subject: [PATCH 295/301] Fix file handler tooltip --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 67819b30e..7f50de17c 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 67819b30ebb869d23a974258ace542837fb32b5b +Subproject commit 7f50de17c03a0e0cf4ac25fb1de62129adfdbab1 From 9f3de07bd857ddf9265cf3c91178787dd4ec686e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 18 Jun 2024 07:12:01 -0500 Subject: [PATCH 296/301] Increase default world gen timeout to 3 minutes (from 60 sec) --- .../wrappers/worldGeneration/BatchGenerationEnvironment.java | 2 +- coreSubProjects | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 a3cf7bc3e..b7a46b875 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 @@ -346,7 +346,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv } else if (event.hasTimeout(Config.Client.Advanced.WorldGenerator.worldGenerationTimeoutLengthInSeconds.get(), TimeUnit.SECONDS)) { - EVENT_LOGGER.error("Batching World Generator: " + event + " timed out and terminated!"); + EVENT_LOGGER.error("Batching World Generator: " + event + " timed out and terminated! Please lower your CPU load."); EVENT_LOGGER.info("Dump PrefEvent: " + event.timer); try { diff --git a/coreSubProjects b/coreSubProjects index 7f50de17c..0d16c037f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7f50de17c03a0e0cf4ac25fb1de62129adfdbab1 +Subproject commit 0d16c037f50e3e03d4f54ca1046e6f34c96d48a5 From 99c713967b48db39be1bbc37d4b008611b677f53 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 22 Jun 2024 16:21:19 -0500 Subject: [PATCH 297/301] Temporary spongepowered.vanillagradle fix/workaround --- common/build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/build.gradle b/common/build.gradle index b6df3a307..72e64e14d 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,4 +1,13 @@ +// temporary fix for broken spongepowered version +buildscript { + configurations.configureEach { + resolutionStrategy { + force 'org.spongepowered:vanillagradle:0.2.1-20240507.024226-82' + } + } +} + plugins { id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT" } From 62fb5ffb73c92cb2e8ab20f37a7ddebc2db8d6ba Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 23 Jun 2024 08:36:48 -0500 Subject: [PATCH 298/301] Add DB file lock checking --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 0d16c037f..30dda058f 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 0d16c037f50e3e03d4f54ca1046e6f34c96d48a5 +Subproject commit 30dda058febd0c56400118e9baa5150279f235a2 From b57ea416866632a92ef83a348aa338ebadf7afe0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 23 Jun 2024 08:52:55 -0500 Subject: [PATCH 299/301] neoforge build script cleanup --- build.gradle | 25 +++++++++-------- neoforge/build.gradle | 62 +++++++++++++------------------------------ 2 files changed, 32 insertions(+), 55 deletions(-) diff --git a/build.gradle b/build.gradle index a59d9a744..bf8b33c82 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) // Transfers the values set in settings.gradle to the rest of the project project.gradle.ext.getProperties().each { prop -> rootProject.ext.set(prop.key, prop.value) -// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" + //println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" } // Sets up manifold stuff writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex) @@ -106,11 +106,12 @@ subprojects { p -> apply plugin: "systems.manifold.manifold-gradle-plugin" // Apply forge's loom - if ( - (findProject(":forge") && p == project(":forge")) || - (findProject(":neoforge") && p == project(":neoforge")) - ) - apply plugin: "dev.architectury.loom" + if ((findProject(":forge") && p == project(":forge")) || + (findProject(":neoforge") && p == project(":neoforge")) + ) + { + apply plugin: "dev.architectury.loom" + } // Set the manifold version (may not be required tough) @@ -521,15 +522,17 @@ allprojects { p -> } } - // Required for ModMenu - maven { url "https://maven.terraformersmc.com/" } - - // Required for Mixins & VanillaGradle + // VanillaGradle and Mixins in common maven { url "https://repo.spongepowered.org/maven/" } - // Required for Canvas (mod) + // Canvas mod maven { url "https://maven.vram.io/" } + // ModMenu mod + maven { url "https://maven.terraformersmc.com/" } + // neoforge + maven { url "https://maven.neoforged.net/releases/" } + // These 3 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource flatDir { dirs "${rootDir}/mods/fabric" diff --git a/neoforge/build.gradle b/neoforge/build.gradle index f5ab276fd..04da288d0 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -11,43 +11,19 @@ architectury { neoForge() } -// TODO this is already defined in the main settings.gradle file, why doesn't it work unless also defined here? (If compiling does work without this block feel free to remove) -repositories { - maven { - name "Neoforge" - url "https://maven.neoforged.net/releases/" - } -} - -//loom { -// forge { -// convertAccessWideners.set(true) -// extraAccessWideners.add("lod.accesswidener") -// mixinConfigs("DistantHorizons.mixins.json") -// } -//} - loom { silentMojangMappingsLicense() // Shut the licencing warning accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") neoForge { - // Access wideners are now defined in the `remapJar.atAccessWideners` -// convertAccessWideners = true -// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name + // Access wideners are defined in the `remapJar.atAccessWideners` - // Mixins are now defined in the `mods.toml` -// mixinConfigs = [ -// "DistantHorizons.mixins.json" -// ] + // Mixins are defined in the `mods.toml` } mixin { - // Mixins are now defined in the `mods.toml` -// mixinConfigs = [ -// "DistantHorizons.mixins.json" -// ] + // Mixins are defined in the `mods.toml` } - + // "runs" isn't required, but when we do need it then it can be useful runs { client { @@ -55,7 +31,7 @@ loom { setConfigName("NeoForge Client") ideConfigGenerated(true) runDir("../run") -// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) + //vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg) } server { server() @@ -66,13 +42,7 @@ loom { } } -remapJar { - inputFile = shadowJar.archiveFile - dependsOn shadowJar -// classifier null - atAccessWideners.add("distanthorizons.accesswidener") -} def addMod(path, enabled) { if (enabled == "2") @@ -80,21 +50,24 @@ def addMod(path, enabled) { else if (enabled == "1") dependencies { modCompileOnly(path) } } - dependencies { minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - mappings loom.layered() { + mappings loom.layered() + { // Mojmap mappings officialMojangMappings() // Parchment mappings (it adds parameter mappings & javadoc) parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip") } - + + // Neoforge neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) } + + task deleteResources(type: Delete) { delete file("build/resources/main") } @@ -113,14 +86,15 @@ tasks.named('runClient') { finalizedBy(deleteResources) } +remapJar { + inputFile = shadowJar.archiveFile + dependsOn shadowJar + + atAccessWideners.add("distanthorizons.accesswidener") +} + sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } } - -//components.java { -// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { -// skip() -// } -//} From a23211d06109c36f2f428ad3bcd6333b9cdd7ef7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 24 Jun 2024 20:52:14 -0500 Subject: [PATCH 300/301] Fix NeoForge not running --- build.gradle | 8 +++++--- .../META-INF/{NeoForge.mods.toml => neoforge.mods.toml} | 0 2 files changed, 5 insertions(+), 3 deletions(-) rename neoforge/src/main/resources/META-INF/{NeoForge.mods.toml => neoforge.mods.toml} (100%) diff --git a/build.gradle b/build.gradle index bf8b33c82..fb9650a7d 100644 --- a/build.gradle +++ b/build.gradle @@ -431,9 +431,11 @@ subprojects { p -> jar { from "LICENSE.txt" manifest { - attributes 'Implementation-Title': rootProject.mod_name, - 'Implementation-Version': rootProject.mod_version, - 'Main-Class': 'com.seibel.distanthorizons.core.jar.JarMain' // When changing the main of the jar change this line + attributes( + 'Implementation-Title': rootProject.mod_name, + 'Implementation-Version': rootProject.mod_version, + 'Main-Class': 'com.seibel.distanthorizons.core.jar.JarMain' // When changing the main of the jar change this line + ) } } diff --git a/neoforge/src/main/resources/META-INF/NeoForge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from neoforge/src/main/resources/META-INF/NeoForge.mods.toml rename to neoforge/src/main/resources/META-INF/neoforge.mods.toml From 095fff96ff360513ae486764ec5942f778b50300 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 24 Jun 2024 20:53:45 -0500 Subject: [PATCH 301/301] Up version 2.1.1-dev -> 2.1.2 --- coreSubProjects | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreSubProjects b/coreSubProjects index 30dda058f..28e1eaae7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 30dda058febd0c56400118e9baa5150279f235a2 +Subproject commit 28e1eaae77547a47efb33b809ec022c9b7640eb0 diff --git a/gradle.properties b/gradle.properties index 6da075fb9..43c0bb48c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.caching=true # Mod Info mod_name=DistantHorizons -mod_version=2.1.1-a-dev +mod_version=2.1.2-a api_version=2.1.0 maven_group=com.seibel.distanthorizons mod_readable_name=Distant Horizons