From 698fda3f2fd2b64f7b06dbde17e1b98ccfaf7b5d Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Fri, 12 Jul 2024 13:28:15 +0200 Subject: [PATCH] Update to MC 1.21 --- build.gradle | 6 ++++-- gradle.properties | 14 ++++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../jei/JEIIntegratedTerminalsConfig.java | 4 ++-- ...redientItemStackCraftingGridSetRecipe.java | 20 ++++++++++--------- .../proxy/CommonProxy.java | 2 +- .../{mods.toml => neoforge.mods.toml} | 10 +++++----- 7 files changed, 31 insertions(+), 27 deletions(-) rename src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (89%) diff --git a/build.gradle b/build.gradle index d3b94d3..31d288a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'net.neoforged.gradle.userdev' version '7.0.97' + id 'net.neoforged.gradle.userdev' version '7.0.145' id 'net.darkhax.curseforgegradle' version '1.0.8' id 'com.github.kt3k.coveralls' version '2.8.2' id 'com.diffplug.spotless' version '5.14.3' @@ -32,7 +32,7 @@ base { } // Set Java details -java.toolchain.languageVersion = JavaLanguageVersion.of(17) +java.toolchain.languageVersion = JavaLanguageVersion.of(21) compileJava.options.compilerArgs << "-Xmaxerrs" << "9999" println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) @@ -274,6 +274,8 @@ publishing { idea { module { + downloadSources = true + downloadJavadoc = true for (String excludeDirName in ["run", "out", "logs", "gradle"]) { File excludeDir = new File(projectDir, excludeDirName) excludeDirs.add(excludeDir) diff --git a/gradle.properties b/gradle.properties index b4dc5f0..cd1b1d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ mod_id=integratedterminals-compat mod_version=1.0.0 -minecraft_version=1.20.4 -neoforge_version=20.4.160-beta -cyclopscore_version=1.19.0-423 +minecraft_version=1.21 +neoforge_version=21.0.43-beta +cyclopscore_version=1.19.1-462 release_type=release fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44 -integrateddynamics_version=1.21.2-740 -integratedterminals_version=1.4.12-326 -commoncapabilities_version=2.9.1-116 +integrateddynamics_version=1.21.4-773 +integratedterminals_version=1.4.13-340 +commoncapabilities_version=2.9.1-126 curios_version=7.3.4+1.20.4 -jei_version=17.3.0.52 +jei_version=19.5.0.31 # Workaround for Spotless bug # https://github.com/diffplug/spotless/issues/834 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..20db9ad 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.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/jei/JEIIntegratedTerminalsConfig.java b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/jei/JEIIntegratedTerminalsConfig.java index a5dbd4d..da7b540 100644 --- a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/jei/JEIIntegratedTerminalsConfig.java +++ b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/jei/JEIIntegratedTerminalsConfig.java @@ -61,7 +61,7 @@ public static int getItemStackMatchCondition(ItemStack itemStack) { // So if we would run into problems with this, this filtering is what we'd need to do. String subTypeInfo = JEIIntegratedTerminalsConfig.subTypeManager.getSubtypeInfo(VanillaTypes.ITEM_STACK, itemStack, UidContext.Ingredient); - return subTypeInfo == null ? ItemMatch.ITEM : ItemMatch.ITEM | ItemMatch.TAG; + return subTypeInfo == null ? ItemMatch.ITEM : ItemMatch.ITEM | ItemMatch.DATA; } @Override @@ -94,7 +94,7 @@ public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { @Override public ResourceLocation getPluginUid() { - return new ResourceLocation(Reference.MOD_ID, "main"); + return ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "main"); } @Override diff --git a/src/main/java/org/cyclops/integratedterminalscompat/network/packet/TerminalStorageIngredientItemStackCraftingGridSetRecipe.java b/src/main/java/org/cyclops/integratedterminalscompat/network/packet/TerminalStorageIngredientItemStackCraftingGridSetRecipe.java index b2d0bb9..dd7bd14 100644 --- a/src/main/java/org/cyclops/integratedterminalscompat/network/packet/TerminalStorageIngredientItemStackCraftingGridSetRecipe.java +++ b/src/main/java/org/cyclops/integratedterminalscompat/network/packet/TerminalStorageIngredientItemStackCraftingGridSetRecipe.java @@ -2,7 +2,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; @@ -33,9 +34,10 @@ * @author rubensworks * */ -public class TerminalStorageIngredientItemStackCraftingGridSetRecipe extends PacketCodec { +public class TerminalStorageIngredientItemStackCraftingGridSetRecipe extends PacketCodec { - public static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "terminal_storage_ingredient_itemstack_crafting_grid_set_recipe"); + public static final Type ID = new Type<>(ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "terminal_storage_ingredient_itemstack_crafting_grid_set_recipe")); + public static final StreamCodec CODEC = getCodec(TerminalStorageIngredientItemStackCraftingGridSetRecipe::new); @CodecField private String tabId; @@ -62,14 +64,14 @@ public TerminalStorageIngredientItemStackCraftingGridSetRecipe(String tabId, int } @Override - public void encode(FriendlyByteBuf output) { + public void encode(RegistryFriendlyByteBuf output) { super.encode(output); // slottedIngredientsFromPlayer and slottedIngredientsFromStorage are encoded manually for more space efficiency output.writeInt(slottedIngredientsFromPlayer.size()); for (Map.Entry> entry : slottedIngredientsFromPlayer.entrySet()) { output.writeInt(entry.getKey()); - output.writeItem(entry.getValue().getLeft()); + ItemStack.OPTIONAL_STREAM_CODEC.encode(output, entry.getValue().getLeft()); output.writeInt(entry.getValue().getRight()); } @@ -78,21 +80,21 @@ public void encode(FriendlyByteBuf output) { output.writeInt(entry.getKey()); output.writeInt(entry.getValue().size()); for (Pair subEntry : entry.getValue()) { - output.writeItem(subEntry.getLeft()); + ItemStack.OPTIONAL_STREAM_CODEC.encode(output, subEntry.getLeft()); output.writeInt(subEntry.getRight()); } } } @Override - public void decode(FriendlyByteBuf input) { + public void decode(RegistryFriendlyByteBuf input) { super.decode(input); // slottedIngredientsFromPlayer and slottedIngredientsFromStorage are encoded manually for more space efficiency int entriesSlottedIngredientsFromPlayer = input.readInt(); this.slottedIngredientsFromPlayer = Maps.newHashMap(); for (int i = 0; i < entriesSlottedIngredientsFromPlayer; i++) { - this.slottedIngredientsFromPlayer.put(input.readInt(), Pair.of(input.readItem(), input.readInt())); + this.slottedIngredientsFromPlayer.put(input.readInt(), Pair.of(ItemStack.OPTIONAL_STREAM_CODEC.decode(input), input.readInt())); } int entriesSlottedIngredientsFromStorage = input.readInt(); @@ -102,7 +104,7 @@ public void decode(FriendlyByteBuf input) { int entries = input.readInt(); List> alternatives = Lists.newArrayListWithExpectedSize(entries); for (int j = 0; j < entries; j++) { - alternatives.add(Pair.of(input.readItem(), input.readInt())); + alternatives.add(Pair.of(ItemStack.OPTIONAL_STREAM_CODEC.decode(input), input.readInt())); } this.slottedIngredientsFromStorage.put(key, alternatives); } diff --git a/src/main/java/org/cyclops/integratedterminalscompat/proxy/CommonProxy.java b/src/main/java/org/cyclops/integratedterminalscompat/proxy/CommonProxy.java index 8f189f3..dca5966 100644 --- a/src/main/java/org/cyclops/integratedterminalscompat/proxy/CommonProxy.java +++ b/src/main/java/org/cyclops/integratedterminalscompat/proxy/CommonProxy.java @@ -22,6 +22,6 @@ public ModBase getMod() { public void registerPacketHandlers(PacketHandler packetHandler) { super.registerPacketHandlers(packetHandler); - packetHandler.register(TerminalStorageIngredientItemStackCraftingGridSetRecipe.ID, TerminalStorageIngredientItemStackCraftingGridSetRecipe::new); + packetHandler.register(TerminalStorageIngredientItemStackCraftingGridSetRecipe.ID, TerminalStorageIngredientItemStackCraftingGridSetRecipe.CODEC); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 89% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml index 1a8ee57..674dea1 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -15,25 +15,25 @@ Integrated Terminals compatibility with other mods. This mod is automatically pa [[dependencies.integratedterminalscompat]] modId="cyclopscore" type="required" - versionRange="[1.19.0,)" + versionRange="[1.19.1,)" ordering="NONE" side="BOTH" [[dependencies.integratedterminalscompat]] modId="integrateddynamics" type="required" - versionRange="[1.16.7,)" + versionRange="[1.21.4,)" ordering="NONE" side="BOTH" [[dependencies.integratedterminalscompat]] modId="commoncapabilities" type="required" - versionRange="[2.9.0,)" + versionRange="[2.9.1,)" ordering="NONE" side="BOTH" [[dependencies.integratedterminalscompat]] modId="neoforge" type="required" - versionRange="[20.4,)" + versionRange="[21.0.43-beta,)" ordering="NONE" side="BOTH" [[dependencies.integratedterminalscompat]] @@ -45,6 +45,6 @@ Integrated Terminals compatibility with other mods. This mod is automatically pa [[dependencies.integratedterminalscompat]] modId="minecraft" type="required" - versionRange="[1.20.4,]" + versionRange="[1.21,]" ordering="NONE" side="BOTH"