Readd last API patch (with TODO)

This commit is contained in:
Nassim Jahnke 2024-10-27 09:43:00 +01:00
parent bcf52fe5fd
commit 348c855096
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
301 changed files with 42 additions and 44 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 50efe16bb80c618c3dfae03b70c8c165183af8ec..85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a 100644 index 52c601328bbf5c1642aa620c8bb466a9d2d231be..c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -949,9 +949,6 @@ public final class Bukkit { @@ -949,9 +949,6 @@ public final class Bukkit {
@ -84,7 +84,7 @@ index 50efe16bb80c618c3dfae03b70c8c165183af8ec..85ad1f7f0de9a6f9048981c3ee509b42
/** /**
* Reloads the server, refreshing settings and plugin information. * Reloads the server, refreshing settings and plugin information.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1b8d6a3333a4fa9155b79644e683e2343c134e12..640ef81d204f480f4af83d420c7e968ce569a38d 100644 index 8ba2fbaab7428a42b506fd000fbc162f68ddaed1..50ffca9bccfb582d58ccb13f0decf66e5d91aef3 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View file

@ -70,10 +70,10 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce
/** /**
* Banned player names * Banned player names
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a..2d466b308b2f8bd31c50f5d05416eadf20c9cb71 100644 index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d5e42f73c 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1611,11 +1611,27 @@ public final class Bukkit { @@ -1663,11 +1663,27 @@ public final class Bukkit {
* @param <T> The ban target * @param <T> The ban target
* *
* @return a ban list of the specified type * @return a ban list of the specified type
@ -102,10 +102,10 @@ index 85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a..2d466b308b2f8bd31c50f5d05416eadf
/** /**
* Gets a set containing all player operators. * Gets a set containing all player operators.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 640ef81d204f480f4af83d420c7e968ce569a38d..20750c09d819d62f32491db8672936b929e1098e 100644 index 50ffca9bccfb582d58ccb13f0decf66e5d91aef3..6246251caf2c6f025c824b8e7a944b8d48751fa1 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -1374,10 +1374,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param <T> The ban target * @param <T> The ban target
* *
* @return a ban list of the specified type * @return a ban list of the specified type

View file

@ -5,10 +5,10 @@ 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 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 index a9063533ea4b2b349d476127b99c822203d7dfcb..a1228d09b91dca3989a4be3120f9724a6e138040 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/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 { @@ -1450,6 +1450,13 @@ public abstract class PlayerList {
} }
public void reloadResources() { public void reloadResources() {
@ -22,27 +22,25 @@ index 2912b15ccda373cf52cec020b0e06ac2c5cf2950..a6caf3a0df22f124a4ee1cfb3981bbeb
// CraftBukkit start // CraftBukkit start
/*Iterator iterator = this.advancements.values().iterator(); /*Iterator iterator = this.advancements.values().iterator();
@@ -1505,7 +1512,15 @@ public abstract class PlayerList { @@ -1465,7 +1472,13 @@ public abstract class PlayerList {
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start - API for updating recipes on clients + // Paper start - API for updating recipes on clients
+ } + }
+ public void reloadTagData() { + public void reloadTagData() {
+ // Paper end - API for updating recipes on clients
this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries)));
+ // Paper start - API for updating recipes on clients
+ } + }
+ public void reloadRecipeData() { + public void reloadRecipeData() {
+ // Paper end - API for updating recipes on clients + // 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(); 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bb89247a87067a74d793a1acc1eb95b98ace3d9e..75c222e592d676e98b293767d00de54a61411ae7 100644 index 3cf3b353cfb4337abdbb3b6842fd8fa128271948..0433de3c2455cf18584d5ab651843f8d1d874036 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 { @@ -1179,6 +1179,18 @@ public final class CraftServer implements Server {
ReloadCommand.reload(this.console); ReloadCommand.reload(this.console);
} }
@ -61,7 +59,7 @@ index bb89247a87067a74d793a1acc1eb95b98ace3d9e..75c222e592d676e98b293767d00de54a
private void loadIcon() { private void loadIcon() {
this.icon = new CraftIconCache(null); this.icon = new CraftIconCache(null);
try { try {
@@ -1555,6 +1567,13 @@ public final class CraftServer implements Server { @@ -1558,6 +1570,13 @@ public final class CraftServer implements Server {
@Override @Override
public boolean addRecipe(Recipe recipe) { public boolean addRecipe(Recipe recipe) {
@ -75,19 +73,19 @@ index bb89247a87067a74d793a1acc1eb95b98ace3d9e..75c222e592d676e98b293767d00de54a
CraftRecipe toAdd; CraftRecipe toAdd;
if (recipe instanceof CraftRecipe) { if (recipe instanceof CraftRecipe) {
toAdd = (CraftRecipe) recipe; toAdd = (CraftRecipe) recipe;
@@ -1584,6 +1603,11 @@ public final class CraftServer implements Server { @@ -1589,6 +1608,11 @@ public final class CraftServer implements Server {
} }
} }
toAdd.addToCraftingManager(); toAdd.addToCraftingManager();
+ // Paper start - API for updating recipes on clients + // Paper start - API for updating recipes on clients
+ if (resendRecipes) { + if (true || resendRecipes) { // Always needs to be resent now... TODO
+ this.playerList.reloadRecipeData(); + this.playerList.reloadRecipeData();
+ } + }
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
return true; return true;
} }
@@ -1764,10 +1788,23 @@ public final class CraftServer implements Server { @@ -1769,9 +1793,23 @@ public final class CraftServer implements Server {
@Override @Override
public boolean removeRecipe(NamespacedKey recipeKey) { public boolean removeRecipe(NamespacedKey recipeKey) {
@ -100,15 +98,15 @@ index bb89247a87067a74d793a1acc1eb95b98ace3d9e..75c222e592d676e98b293767d00de54a
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
Preconditions.checkArgument(recipeKey != null, "recipeKey == null"); Preconditions.checkArgument(recipeKey != null, "recipeKey == null");
ResourceLocation mcKey = CraftNamespacedKey.toMinecraft(recipeKey); - return this.getServer().getRecipeManager().removeRecipe(CraftRecipe.toMinecraft(recipeKey));
- return this.getServer().getRecipeManager().removeRecipe(mcKey);
+ // Paper start - resend recipes on successful removal + // Paper start - resend recipes on successful removal
+ boolean removed = this.getServer().getRecipeManager().removeRecipe(mcKey); + final ResourceKey<net.minecraft.world.item.crafting.Recipe<?>> minecraftKey = CraftRecipe.toMinecraft(recipeKey);
+ if (removed && resendRecipes) { + final boolean removed = this.getServer().getRecipeManager().removeRecipe(minecraftKey);
+ if (removed/* && resendRecipes*/) { // TODO Always need to resend them rn - deprecate this method?
+ this.playerList.reloadRecipeData(); + this.playerList.reloadRecipeData();
+ } + }
+ return removed; + return removed;
+ // Paper end + // Paper end - resend recipes on successful removal
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show more