From 625f1e700fc533c91d35e0edcb72747c8be72ac4 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 12 Aug 2024 21:05:15 -0500 Subject: [PATCH] Fix MC 1.21 / 1.21.1 --- .gitlab-ci.yml | 2 +- .../common/wrappers/WrapperFactory.java | 42 ++++----------- .../mimicObject/ChunkLoader.java | 2 +- .../mimicObject/DhLitWorldGenRegion.java | 2 +- versionProperties/1.21.1.properties | 4 +- versionProperties/1.21.properties | 53 +++++++++++++++++++ 6 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 versionProperties/1.21.properties diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f4eadabc..56aedf4af 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", "1.21.1"] + - 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", "1.21.1"] 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/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java index 293a53037..f1916a214 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 @@ -155,7 +155,7 @@ public class WrapperFactory implements IWrapperFactory } } - #if MC_VER <= MC_1_21 + //#if MC_VER <= MC_1_XX_X else if (objectArray.length == 2) { // correct number of parameters from the API @@ -201,16 +201,7 @@ public class WrapperFactory implements IWrapperFactory { throw new ClassCastException(createChunkWrapperErrorMessage(objectArray)); } - #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. - - // 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 - // be updated to state which objects this method accepts. - not implemented for this version of Minecraft! - #endif + //#endif } /** * Note: when this is updated for different MC versions, @@ -220,16 +211,13 @@ public class WrapperFactory implements IWrapperFactory { String[] expectedClassNames; - #if MC_VER <= MC_1_21 + //#if MC_VER <= MC_1_XX_X 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 + //#endif return createWrapperErrorMessage("Chunk wrapper", expectedClassNames, objectArray); } @@ -268,7 +256,7 @@ public class WrapperFactory implements IWrapperFactory Biome biome = (Biome) objectArray[0]; return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper); - #elif MC_VER <= MC_1_21 + #else if (!(objectArray[0] instanceof Holder) || !(((Holder) objectArray[0]).value() instanceof Biome)) { throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray)); @@ -276,9 +264,6 @@ public class WrapperFactory implements IWrapperFactory 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 } /** @@ -291,11 +276,8 @@ public class WrapperFactory implements IWrapperFactory #if MC_VER < MC_1_18_2 expectedClassNames = new String[] { Biome.class.getName() }; - #elif MC_VER <= MC_1_21 - 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! + expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #endif return createWrapperErrorMessage("Biome wrapper", expectedClassNames, objectArray); @@ -312,7 +294,7 @@ public class WrapperFactory implements IWrapperFactory - #if MC_VER <= MC_1_21 + //#if MC_VER <= MC_1_XX_X if (objectArray.length != 1) { throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray)); @@ -324,10 +306,7 @@ public class WrapperFactory implements IWrapperFactory 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 + //#endif } /** * Note: when this is updated for different MC versions, @@ -339,11 +318,8 @@ 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_21 - 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! + expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" }; #endif return createWrapperErrorMessage("BlockState wrapper", expectedClassNames, objectArray); 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 2b4cf1052..6e98738a6 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,7 +85,7 @@ 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 +#elif MC_VER >= MC_1_21 import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.chunk.status.ChunkType; #endif 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 30632bef1..48b5a3fb7 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 @@ -63,7 +63,7 @@ import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.status.*; #endif -#if MC_VER == MC_1_21 +#if MC_VER >= MC_1_21 import net.minecraft.util.StaticCache2D; import com.google.common.collect.ImmutableList; import net.minecraft.server.level.GenerationChunkHolder; diff --git a/versionProperties/1.21.1.properties b/versionProperties/1.21.1.properties index 0498f8503..9a4da88c7 100644 --- a/versionProperties/1.21.1.properties +++ b/versionProperties/1.21.1.properties @@ -2,7 +2,7 @@ java_version=21 minecraft_version=1.21.1 parchment_version=1.20.6:2024.05.01 -compatible_minecraft_versions=["1.21.0", "1.21.1"] +compatible_minecraft_versions=["1.21.1"] accessWidenerVersion=1_20_6 builds_for=fabric,neoforge # forge is broken due to gradle/build script issues @@ -38,7 +38,7 @@ fabric_api_version=0.100.1+1.21 enable_canvas=0 # (Neo)Forge loader -forge_version=50.0.19 +forge_version= neoforge_version=21.1.6 # (Neo)Forge mod versions starlight_version_forge= diff --git a/versionProperties/1.21.properties b/versionProperties/1.21.properties new file mode 100644 index 000000000..c2c73633b --- /dev/null +++ b/versionProperties/1.21.properties @@ -0,0 +1,53 @@ +# 1.21 version +java_version=21 +minecraft_version=1.21 +parchment_version=1.20.6:2024.05.01 +compatible_minecraft_versions=["1.21"] +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.7.4" } + 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=21.0.4-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