From 27446965db5cbc9b8f4fafdb689552d3d219b472 Mon Sep 17 00:00:00 2001 From: s809 <11816467-s809@users.noreply.gitlab.com> Date: Sat, 30 Dec 2023 21:57:03 +0500 Subject: [PATCH] Make 1.16.5 build Make Netty version specific for each MC version --- .gitlab-ci.yml | 3 +-- build.gradle | 8 +++++--- .../common/wrappers/world/DimensionTypeWrapper.java | 5 +++++ .../src/main/resources/1_16.distanthorizons.accesswidener | 3 +++ .../seibel/distanthorizons/fabric/FabricClientProxy.java | 2 +- gradle.properties | 1 - versionProperties/1.16.5.properties | 3 +++ versionProperties/1.17.1.properties | 3 +++ versionProperties/1.18.2.properties | 3 +++ versionProperties/1.19.2.properties | 3 +++ versionProperties/1.19.4.properties | 3 +++ versionProperties/1.20.1.properties | 3 +++ versionProperties/1.20.2.properties | 3 +++ versionProperties/1.20.4.properties | 3 +++ 14 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0653bb904..cfdf858b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,8 +30,7 @@ build: stage: build parallel: matrix: - - MC_VER: ["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"] + - 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/build.gradle b/build.gradle index cb022673b..448772dfe 100644 --- a/build.gradle +++ b/build.gradle @@ -216,8 +216,10 @@ subprojects { p -> // forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") // Netty - // Breaks 1.16.5 - forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}") + forgeShadowMe("io.netty:netty-buffer:${rootProject.netty_version}") + forgeShadowMe("io.netty:netty-codec:${rootProject.netty_version}") + forgeShadowMe("io.netty:netty-transport:${rootProject.netty_version}") + forgeShadowMe("io.netty:netty-handler:${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}") { @@ -562,7 +564,7 @@ allprojects { p -> 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" diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/DimensionTypeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/DimensionTypeWrapper.java index 9f7dd1ccc..dc6636609 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/DimensionTypeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/DimensionTypeWrapper.java @@ -64,7 +64,12 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper @Override public String getDimensionName() { + #if MC_VER >= MC_1_17_1 return dimensionType.effectsLocation().getPath(); + #else // < 1.17.1 + // effectsLocation() is marked as client only, so using the backing field directly + return dimensionType.effectsLocation.getPath(); + #endif } @Override diff --git a/common/src/main/resources/1_16.distanthorizons.accesswidener b/common/src/main/resources/1_16.distanthorizons.accesswidener index 969ac463d..efb1e6a1f 100644 --- a/common/src/main/resources/1_16.distanthorizons.accesswidener +++ b/common/src/main/resources/1_16.distanthorizons.accesswidener @@ -47,4 +47,7 @@ accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite frames accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesY [I accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage; +# DimensionTypeWrapper workaround +accessible field net/minecraft/world/level/dimension/DimensionType effectsLocation Lnet/minecraft/resources/ResourceLocation; + extendable class com/mojang/math/Matrix4f 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 638d326f8..99068a62e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -233,7 +233,7 @@ public class FabricClientProxy (Minecraft client, ClientPacketListener handler, FriendlyByteBuf friendlyByteBuf, PacketSender responseSender) -> { // converting to a ByteBuf is necessary otherwise Fabric will complain when the game boots - ByteBuf nettyByteBuf = friendlyByteBuf.asByteBuf(); + ByteBuf nettyByteBuf = friendlyByteBuf.asReadOnly(); // remove the Bukkit/Forge packet ID byte nettyByteBuf.readByte(); diff --git a/gradle.properties b/gradle.properties index fbd09c11b..d1f6aed55 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,6 @@ sqlite_jdbc_version=3.43.0.0 # Minecraft related libaries (included in MC's jar) log4j_version=2.20.0 -netty_version=4.1.94.Final lwjgl_version=3.3.1 joml_version=1.10.2 diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index dc8d54645..ee712dca8 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.16.4", "1.16.5"] accessWidenerVersion=1_16 builds_for=fabric,forge +# Netty +netty_version=4.1.25.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.42.0+1.16 diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 44be229a8..78028ea73 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.17", "1.17.1"] accessWidenerVersion=1_17 builds_for=fabric,forge +# Netty +netty_version=4.1.25.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.46.1+1.17 diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index e987c439f..acc1338c8 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.18.2"] accessWidenerVersion=1_18 builds_for=fabric,forge +# Netty +netty_version=4.1.68.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.76.0+1.18.2 diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index c4fe3195f..a503c798c 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.19.2"] accessWidenerVersion=1_19_2 builds_for=fabric,forge +# Netty +netty_version=4.1.77.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.76.1+1.19.2 diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index c3a91dfda..88460bb9d 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.19.4"] accessWidenerVersion=1_19_4 builds_for=fabric,forge +# Netty +netty_version=4.1.82.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.87.1+1.19.4 diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index ba4d8188b..bf9328dd2 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.20", "1.20.1"] accessWidenerVersion=1_20 builds_for=fabric,forge +# Netty +netty_version=4.1.82.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.90.4+1.20.1 diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 1f15abab5..668e1dd05 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.20.2"] accessWidenerVersion=1_20_2 builds_for=fabric,forge +# Netty +netty_version=4.1.97.Final + # Fabric loader fabric_loader_version=0.14.24 fabric_api_version=0.90.4+1.20.2 diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 479aaa056..b0015695b 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -6,6 +6,9 @@ compatible_minecraft_versions=["1.20.3", "1.20.4"] accessWidenerVersion=1_20_2 builds_for=fabric,forge,neoforged +# Netty +netty_version=4.1.97.Final + # Fabric loader fabric_loader_version=0.15.1 fabric_api_version=0.91.2+1.20.4