2024-12-11 22:26:55 +01:00
|
|
|
--- a/net/minecraft/stats/ServerRecipeBook.java
|
|
|
|
+++ b/net/minecraft/stats/ServerRecipeBook.java
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -29,6 +29,8 @@
|
|
|
|
import net.minecraft.world.item.crafting.display.RecipeDisplayId;
|
2022-02-28 16:00:00 +01:00
|
|
|
import org.slf4j.Logger;
|
2018-09-30 01:24:51 +02:00
|
|
|
|
2021-03-08 22:47:33 +01:00
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
2024-12-11 22:26:55 +01:00
|
|
|
public class ServerRecipeBook extends RecipeBook {
|
2018-09-30 01:24:51 +02:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final String RECIPE_BOOK_TAG = "recipeBook";
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -72,7 +74,7 @@
|
2023-09-21 18:40:00 +02:00
|
|
|
RecipeHolder<?> recipeholder = (RecipeHolder) iterator.next();
|
2024-12-11 22:26:55 +01:00
|
|
|
ResourceKey<Recipe<?>> resourcekey = recipeholder.id();
|
2018-09-30 01:24:51 +02:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
- if (!this.known.contains(resourcekey) && !recipeholder.value().isSpecial()) {
|
2024-12-11 22:26:55 +01:00
|
|
|
+ if (!this.known.contains(resourcekey) && !recipeholder.value().isSpecial() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, resourcekey.location())) { // CraftBukkit
|
2024-10-22 17:15:00 +02:00
|
|
|
this.add(resourcekey);
|
|
|
|
this.addHighlight(resourcekey);
|
|
|
|
this.displayResolver.displaysForRecipe(resourcekey, (recipedisplayentry) -> {
|
|
|
|
@@ -82,7 +84,7 @@
|
|
|
|
}
|
|
|
|
}
|
2018-11-10 10:30:58 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
- if (!list.isEmpty()) {
|
2024-12-11 22:26:55 +01:00
|
|
|
+ if (!list.isEmpty() && player.connection != null) { // SPIGOT-4478 during PlayerLoginEvent
|
|
|
|
player.connection.send(new ClientboundRecipeBookAddPacket(list, false));
|
2024-10-22 17:15:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@@ -105,7 +107,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (!list.isEmpty()) {
|
2024-12-11 22:26:55 +01:00
|
|
|
+ if (!list.isEmpty() && player.connection != null) { // SPIGOT-4478 during PlayerLoginEvent
|
|
|
|
player.connection.send(new ClientboundRecipeBookRemovePacket(list));
|
2024-10-22 17:15:00 +02:00
|
|
|
}
|
2018-11-10 10:30:58 +01:00
|
|
|
|