From b764318acc7a820103b02c0d01fde3ae6fa5b406 Mon Sep 17 00:00:00 2001 From: Minecraftschurli Date: Wed, 2 Aug 2023 20:58:13 +0200 Subject: [PATCH] update to 1.19.4 --- build.gradle | 4 ++-- gradle.properties | 14 ++++++------- .../potionbundles/PotionBundleRecipe.java | 4 ++-- .../potionbundles/PotionBundles.java | 20 ++++++++++++++----- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index a807522..5ed5684 100644 --- a/build.gradle +++ b/build.gradle @@ -75,8 +75,8 @@ repositories { dependencies { minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}" - compileOnly fg.deobf("mezz.jei:jei-1.19.3-common-api:${project.jei_version}") - runtimeOnly fg.deobf("mezz.jei:jei-1.19.3-forge:${project.jei_version}") + compileOnly fg.deobf("mezz.jei:jei-1.19.4-common-api:${project.jei_version}") + runtimeOnly fg.deobf("mezz.jei:jei-1.19.4-forge:${project.jei_version}") implementation 'org.jetbrains:annotations:23.0.0' } diff --git a/gradle.properties b/gradle.properties index f5bdb0b..95d6296 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,18 +17,18 @@ java_version=17 forgegradle_version=5.1.+ librarian_version=1.+ -loader_version_range=[44,) +loader_version_range=[45,) -mc_version=1.19.3 -mc_version_range=[1.19.3,1.20) +mc_version=1.19.4 +mc_version_range=[1.19.4,1.20) -forge_version=44.1.0 -forge_version_range=[44.1,) +forge_version=45.1.0 +forge_version_range=[45.1,) -mappings_version=1.19.3 +mappings_version=1.19.4 mappings_channel=official -jei_version=12.1.1.9 +jei_version=13.1.0.9 curse_project_id=382836 modrinth_project_id=ZZLWU8jS diff --git a/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundleRecipe.java b/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundleRecipe.java index c3a302b..c531cbd 100644 --- a/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundleRecipe.java +++ b/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundleRecipe.java @@ -2,6 +2,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import net.minecraft.core.RegistryAccess; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; @@ -69,9 +70,8 @@ public boolean matches(CraftingContainer inv, @Nonnull Level world) { return potions == this.bundle.getMaxUses() && string; } - @Nonnull @Override - public ItemStack assemble(CraftingContainer inv) { + public ItemStack assemble(CraftingContainer inv, RegistryAccess access) { Potion potion = null; List customEffects = null; ItemStack string = null; diff --git a/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundles.java b/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundles.java index 65467af..6d9ded6 100644 --- a/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundles.java +++ b/src/main/java/com/github/ichhabehunger54/potionbundles/PotionBundles.java @@ -1,6 +1,10 @@ package com.github.ichhabehunger54.potionbundles; +import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.core.RegistryAccess; +import net.minecraft.server.MinecraftServer; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -64,13 +68,19 @@ private static void addBundlesForAllPotions(CreativeModeTabEvent.BuildContents p @Nonnull private static ItemStack getStringFromRecipe(@Nonnull AbstractPotionBundle bundle) { - RecipeManager recipeManager = DistExecutor.unsafeRunForDist( - () -> () -> Minecraft.getInstance().getConnection().getRecipeManager(), - () -> () -> ServerLifecycleHooks.getCurrentServer().getRecipeManager() + Pair pair = DistExecutor.unsafeRunForDist( + () -> () -> { + ClientPacketListener connection = Minecraft.getInstance().getConnection(); + return Pair.of(connection.getRecipeManager(), connection.registryAccess()); + }, + () -> () -> { + MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); + return Pair.of(server.getRecipeManager(), server.registryAccess()); + } ); - for (Recipe recipe : recipeManager.getRecipes()) { + for (Recipe recipe : pair.getFirst().getRecipes()) { if (recipe.getSerializer() != POTION_BUNDLE_RECIPE_SERIALIZER.get()) continue; - if (recipe.getResultItem().getItem() != bundle) continue; + if (recipe.getResultItem(pair.getSecond()).getItem() != bundle) continue; PotionBundleRecipe potionBundleRecipe = (PotionBundleRecipe) recipe; Ingredient stringIngredient = potionBundleRecipe.getString(); ItemStack[] stacks = stringIngredient.getItems();