diff options
author | Nassim Jahnke <[email protected]> | 2024-10-27 09:24:59 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-10-27 09:24:59 +0100 |
commit | bcf52fe5fd7b178e3c72f53762c8e32ca7910dc4 (patch) | |
tree | 271ee025422821214cee0eca664440136b2f0168 /patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch | |
parent | 09718757bfae5296edbd61b70938fffd2b11f1a2 (diff) | |
download | Paper-bcf52fe5fd7b178e3c72f53762c8e32ca7910dc4.tar.gz Paper-bcf52fe5fd7b178e3c72f53762c8e32ca7910dc4.zip |
Delete some old patches
Diffstat (limited to 'patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch')
-rw-r--r-- | patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch b/patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch new file mode 100644 index 0000000000..7cae857359 --- /dev/null +++ b/patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch @@ -0,0 +1,114 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sat, 21 Aug 2021 17:25:38 -0700 +Subject: [PATCH] API for updating recipes on clients + + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 2912b15ccda373cf52cec020b0e06ac2c5cf2950..a6caf3a0df22f124a4ee1cfb3981bbeb23a8630e 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1490,6 +1490,13 @@ public abstract class PlayerList { + } + + public void reloadResources() { ++ // Paper start - API for updating recipes on clients ++ this.reloadAdvancementData(); ++ this.reloadTagData(); ++ this.reloadRecipeData(); ++ } ++ public void reloadAdvancementData() { ++ // Paper end - API for updating recipes on clients + // CraftBukkit start + /*Iterator iterator = this.advancements.values().iterator(); + +@@ -1505,7 +1512,15 @@ public abstract class PlayerList { + } + // CraftBukkit end + ++ // 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()); + 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 bb89247a87067a74d793a1acc1eb95b98ace3d9e..75c222e592d676e98b293767d00de54a61411ae7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1176,6 +1176,18 @@ public final class CraftServer implements Server { + ReloadCommand.reload(this.console); + } + ++ // Paper start - API for updating recipes on clients ++ @Override ++ public void updateResources() { ++ this.playerList.reloadResources(); ++ } ++ ++ @Override ++ public void updateRecipes() { ++ this.playerList.reloadRecipeData(); ++ } ++ // Paper end - API for updating recipes on clients ++ + private void loadIcon() { + this.icon = new CraftIconCache(null); + try { +@@ -1555,6 +1567,13 @@ public final class CraftServer implements Server { + + @Override + public boolean addRecipe(Recipe recipe) { ++ // Paper start - API for updating recipes on clients ++ return this.addRecipe(recipe, false); ++ } ++ ++ @Override ++ public boolean addRecipe(Recipe recipe, boolean resendRecipes) { ++ // Paper end - API for updating recipes on clients + CraftRecipe toAdd; + if (recipe instanceof CraftRecipe) { + toAdd = (CraftRecipe) recipe; +@@ -1584,6 +1603,11 @@ public final class CraftServer implements Server { + } + } + toAdd.addToCraftingManager(); ++ // Paper start - API for updating recipes on clients ++ if (resendRecipes) { ++ this.playerList.reloadRecipeData(); ++ } ++ // Paper end - API for updating recipes on clients + return true; + } + +@@ -1764,10 +1788,23 @@ public final class CraftServer implements Server { + + @Override + public boolean removeRecipe(NamespacedKey recipeKey) { ++ // Paper start - API for updating recipes on clients ++ return this.removeRecipe(recipeKey, false); ++ } ++ ++ @Override ++ public boolean removeRecipe(NamespacedKey recipeKey, boolean resendRecipes) { ++ // 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); ++ // Paper start - resend recipes on successful removal ++ boolean removed = this.getServer().getRecipeManager().removeRecipe(mcKey); ++ if (removed && resendRecipes) { ++ this.playerList.reloadRecipeData(); ++ } ++ return removed; ++ // Paper end + } + + @Override |