From eec2d1f009dc202dbf322de9ec6aca1b15cc3a80 Mon Sep 17 00:00:00 2001 From: Minecraftschurli Date: Tue, 30 Jul 2024 11:05:09 +0200 Subject: [PATCH] Update to 1.21 --- gradle.properties | 18 +++++++++--------- .../potionbundles/ClientHandler.java | 2 +- .../potionbundles/JEICompat.java | 5 ++--- .../potionbundles/PotionBundleRecipe.java | 14 +++++--------- .../lingering_potion_bundle.json | 0 .../{recipes => recipe}/potion_bundle.json | 0 .../splash_potion_bundle.json | 0 .../potionbundles/test/PotionBundleTest.java | 2 +- .../{structures => structure}/empty_3x3.nbt | Bin 9 files changed, 18 insertions(+), 23 deletions(-) rename src/main/resources/data/potionbundles/{recipes => recipe}/lingering_potion_bundle.json (100%) rename src/main/resources/data/potionbundles/{recipes => recipe}/potion_bundle.json (100%) rename src/main/resources/data/potionbundles/{recipes => recipe}/splash_potion_bundle.json (100%) rename src/test/resources/data/potionbundles/{structures => structure}/empty_3x3.nbt (100%) diff --git a/gradle.properties b/gradle.properties index 69ae236..01b339f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,19 +23,19 @@ license.name=GPLv3 license.url=https://www.gnu.org/licenses/gpl-3.0.en.html license.file=LICENSE -neogradle.subsystems.parchment.minecraftVersion=1.20.6 -neogradle.subsystems.parchment.mappingsVersion=2024.06.16 +neogradle.subsystems.parchment.minecraftVersion=1.21 +neogradle.subsystems.parchment.mappingsVersion=2024.07.28 -mc_version=1.20.6 -mc_version_range=[1.20.6,1.21) +mc_version=1.21 +mc_version_range=[1.21,1.21.1) -neo_version=20.6.119 -neo_version_range=[20.6.115,21) +neo_version=21.0.143 +neo_version_range=[21.0.143,21.1) -dependency.jei.version=18.0.0.65 -dependency.jei.version.range=[18,19) +dependency.jei.version=19.5.2.66 +dependency.jei.version.range=[19.5,20) -loader.version=[3,) +loader.version=[4,) mc-publish.curseforge=382836 mc-publish.modrinth=ZZLWU8jS diff --git a/src/main/java/com/github/minecraftschurlimods/potionbundles/ClientHandler.java b/src/main/java/com/github/minecraftschurlimods/potionbundles/ClientHandler.java index a2cd500..ea74cf7 100644 --- a/src/main/java/com/github/minecraftschurlimods/potionbundles/ClientHandler.java +++ b/src/main/java/com/github/minecraftschurlimods/potionbundles/ClientHandler.java @@ -20,7 +20,7 @@ public static void clientSetup(FMLClientSetupEvent e) { e.enqueueWork(() -> { @SuppressWarnings("deprecation") ItemPropertyFunction propertyFunction = (stack, world, living, seed) -> stack.getOrDefault(PotionBundles.USES, 0); - ResourceLocation uses = new ResourceLocation(PotionBundles.MODID, "uses"); + ResourceLocation uses = ResourceLocation.fromNamespaceAndPath(PotionBundles.MODID, "uses"); for (DeferredHolder item : PotionBundles.ITEMS.getEntries()) { ItemProperties.register(item.get(), uses, propertyFunction); } diff --git a/src/main/java/com/github/minecraftschurlimods/potionbundles/JEICompat.java b/src/main/java/com/github/minecraftschurlimods/potionbundles/JEICompat.java index f477868..52de8f6 100644 --- a/src/main/java/com/github/minecraftschurlimods/potionbundles/JEICompat.java +++ b/src/main/java/com/github/minecraftschurlimods/potionbundles/JEICompat.java @@ -4,7 +4,6 @@ import mezz.jei.api.constants.RecipeTypes; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.JeiPlugin; -import mezz.jei.api.constants.ModIds; import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter; import mezz.jei.api.registration.IRecipeRegistration; import mezz.jei.api.registration.ISubtypeRegistration; @@ -37,7 +36,7 @@ public class JEICompat implements IModPlugin { @Override public ResourceLocation getPluginUid() { - return new ResourceLocation(PotionBundles.MODID, PotionBundles.MODID); + return ResourceLocation.fromNamespaceAndPath(PotionBundles.MODID, PotionBundles.MODID); } @Override @@ -74,7 +73,7 @@ private Stream> mapRecipes(final PotionBundleRecipe inputs.set(maxUses, recipe.getString()); ItemStack output = PotionContents.createItemStack(bundleItem, potion); PotionBundleUtils.setUses(output, maxUses); - ResourceLocation id = new ResourceLocation(ModIds.MINECRAFT_ID, group + "." + output.getDescriptionId() + "." + Potion.getName(Optional.of(potion), "")); + ResourceLocation id = ResourceLocation.withDefaultNamespace(group + "." + output.getDescriptionId() + "." + Potion.getName(Optional.of(potion), "")); return new RecipeHolder<>(id, new ShapelessRecipe(group, CraftingBookCategory.EQUIPMENT, output, inputs)); }); } diff --git a/src/main/java/com/github/minecraftschurlimods/potionbundles/PotionBundleRecipe.java b/src/main/java/com/github/minecraftschurlimods/potionbundles/PotionBundleRecipe.java index 172ca58..982800d 100644 --- a/src/main/java/com/github/minecraftschurlimods/potionbundles/PotionBundleRecipe.java +++ b/src/main/java/com/github/minecraftschurlimods/potionbundles/PotionBundleRecipe.java @@ -10,14 +10,10 @@ import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.PotionContents; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CustomRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; import java.util.Objects; @@ -51,11 +47,11 @@ public PotionBundleRecipe(Ingredient string, Item potion, AbstractPotionBundle b } @Override - public boolean matches(CraftingContainer inv, Level world) { + public boolean matches(CraftingInput inv, Level world) { int potions = 0; boolean string = false; PotionContents potionContents = null; - for (int i = 0; i < inv.getContainerSize(); i++) { + for (int i = 0; i < inv.size(); i++) { ItemStack is = inv.getItem(i); if (this.string.test(is)) { if (string) return false; @@ -81,10 +77,10 @@ public boolean matches(CraftingContainer inv, Level world) { } @Override - public ItemStack assemble(CraftingContainer inv, HolderLookup.Provider provider) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider provider) { PotionBundleString string = null; PotionContents potionContents = null; - for (int i = 0; i < inv.getContainerSize(); i++) { + for (int i = 0; i < inv.size(); i++) { ItemStack is = inv.getItem(i); if (potionContents == null && is.is(this.potion)) { potionContents = is.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); diff --git a/src/main/resources/data/potionbundles/recipes/lingering_potion_bundle.json b/src/main/resources/data/potionbundles/recipe/lingering_potion_bundle.json similarity index 100% rename from src/main/resources/data/potionbundles/recipes/lingering_potion_bundle.json rename to src/main/resources/data/potionbundles/recipe/lingering_potion_bundle.json diff --git a/src/main/resources/data/potionbundles/recipes/potion_bundle.json b/src/main/resources/data/potionbundles/recipe/potion_bundle.json similarity index 100% rename from src/main/resources/data/potionbundles/recipes/potion_bundle.json rename to src/main/resources/data/potionbundles/recipe/potion_bundle.json diff --git a/src/main/resources/data/potionbundles/recipes/splash_potion_bundle.json b/src/main/resources/data/potionbundles/recipe/splash_potion_bundle.json similarity index 100% rename from src/main/resources/data/potionbundles/recipes/splash_potion_bundle.json rename to src/main/resources/data/potionbundles/recipe/splash_potion_bundle.json diff --git a/src/test/java/com/github/minecraftschurlimods/potionbundles/test/PotionBundleTest.java b/src/test/java/com/github/minecraftschurlimods/potionbundles/test/PotionBundleTest.java index 0bb2d75..d4bc7f8 100644 --- a/src/test/java/com/github/minecraftschurlimods/potionbundles/test/PotionBundleTest.java +++ b/src/test/java/com/github/minecraftschurlimods/potionbundles/test/PotionBundleTest.java @@ -39,8 +39,8 @@ public static void testPotionBundle(GameTestHelper helper) { MobEffectInstance customEffect = new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 20); ItemStack bundle = potionBundle.createStack(string, Potions.WATER, List.of(customEffect), null); assertUses(bundle, maxUses, "Uses don't use items max uses"); - int duration = potionBundle.getUseDuration(bundle); Player player = setupPlayer(helper, bundle); + int duration = potionBundle.getUseDuration(bundle, player); GameTestSequence sequence = helper.startSequence(); for (int i = 0; i < maxUses; i++) { int index = i + 1; diff --git a/src/test/resources/data/potionbundles/structures/empty_3x3.nbt b/src/test/resources/data/potionbundles/structure/empty_3x3.nbt similarity index 100% rename from src/test/resources/data/potionbundles/structures/empty_3x3.nbt rename to src/test/resources/data/potionbundles/structure/empty_3x3.nbt