From ba24f1b59da13d3cdd7462c26247ae79678674d5 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 27 Oct 2024 09:43:00 +0100 Subject: [PATCH] Readd last API patch (with TODO) --- .../API-for-updating-recipes-on-clients.patch | 0 .../API-for-updating-recipes-on-clients.patch | 18 ++++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) rename patches/{unapplied => }/api/API-for-updating-recipes-on-clients.patch (100%) rename patches/{unapplied => }/server/API-for-updating-recipes-on-clients.patch (84%) diff --git a/patches/unapplied/api/API-for-updating-recipes-on-clients.patch b/patches/api/API-for-updating-recipes-on-clients.patch similarity index 100% rename from patches/unapplied/api/API-for-updating-recipes-on-clients.patch rename to patches/api/API-for-updating-recipes-on-clients.patch diff --git a/patches/unapplied/server/API-for-updating-recipes-on-clients.patch b/patches/server/API-for-updating-recipes-on-clients.patch similarity index 84% rename from patches/unapplied/server/API-for-updating-recipes-on-clients.patch rename to patches/server/API-for-updating-recipes-on-clients.patch index 6556a6fdf3..d9150e6557 100644 --- a/patches/unapplied/server/API-for-updating-recipes-on-clients.patch +++ b/patches/server/API-for-updating-recipes-on-clients.patch @@ -29,15 +29,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - API for updating recipes on clients + } + public void reloadTagData() { -+ // Paper end - API for updating recipes on clients this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); -+ // Paper start - API for updating recipes on clients + } + public void reloadRecipeData() { + // Paper end - API for updating recipes on clients - ClientboundUpdateRecipesPacket packetplayoutrecipeupdate = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes()); + RecipeManager craftingmanager = this.server.getRecipeManager(); + ClientboundUpdateRecipesPacket packetplayoutrecipeupdate = new ClientboundUpdateRecipesPacket(craftingmanager.getSynchronizedItemProperties(), craftingmanager.getSynchronizedStonecutterRecipes()); Iterator iterator1 = this.players.iterator(); - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -80,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } toAdd.addToCraftingManager(); + // Paper start - API for updating recipes on clients -+ if (resendRecipes) { ++ if (true || resendRecipes) { // Always needs to be resent now... TODO + this.playerList.reloadRecipeData(); + } + // Paper end - API for updating recipes on clients @@ -100,15 +98,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - API for updating recipes on clients Preconditions.checkArgument(recipeKey != null, "recipeKey == null"); - ResourceLocation mcKey = CraftNamespacedKey.toMinecraft(recipeKey); -- return this.getServer().getRecipeManager().removeRecipe(mcKey); +- return this.getServer().getRecipeManager().removeRecipe(CraftRecipe.toMinecraft(recipeKey)); + // Paper start - resend recipes on successful removal -+ boolean removed = this.getServer().getRecipeManager().removeRecipe(mcKey); -+ if (removed && resendRecipes) { ++ final ResourceKey> minecraftKey = CraftRecipe.toMinecraft(recipeKey); ++ final boolean removed = this.getServer().getRecipeManager().removeRecipe(minecraftKey); ++ if (removed/* && resendRecipes*/) { // TODO Always need to resend them rn - deprecate this method? + this.playerList.reloadRecipeData(); + } + return removed; -+ // Paper end ++ // Paper end - resend recipes on successful removal } @Override