aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerRecipeBook.java.patch
blob: 9be367b6e98eb173f5e027870c8c6c05acad81fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- a/net/minecraft/stats/ServerRecipeBook.java
+++ b/net/minecraft/stats/ServerRecipeBook.java
@@ -19,6 +20,8 @@
 import net.minecraft.world.item.crafting.RecipeManager;
 import org.slf4j.Logger;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class ServerRecipeBook extends RecipeBook {
     public static final String RECIPE_BOOK_TAG = "recipeBook";
     private static final Logger LOGGER = LogUtils.getLogger();
@@ -27,14 +34,16 @@
         List<ResourceLocation> list = Lists.newArrayList();
         int i = 0;
 
-        for (RecipeHolder<?> recipeHolder : recipes) {
-            ResourceLocation resourceLocation = recipeHolder.id();
-            if (!this.known.contains(resourceLocation) && !recipeHolder.value().isSpecial()) {
-                this.add(resourceLocation);
-                this.addHighlight(resourceLocation);
-                list.add(resourceLocation);
-                CriteriaTriggers.RECIPE_UNLOCKED.trigger(player, recipeHolder);
-                i++;
+        while (iterator.hasNext()) {
+            RecipeHolder<?> recipeholder = (RecipeHolder) iterator.next();
+            ResourceLocation minecraftkey = recipeholder.id();
+
+            if (!this.known.contains(minecraftkey) && !recipeholder.value().isSpecial() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, minecraftkey)) { // CraftBukkit
+                this.add(minecraftkey);
+                this.addHighlight(minecraftkey);
+                list.add(minecraftkey);
+                CriteriaTriggers.RECIPE_UNLOCKED.trigger(player, recipeholder);
+                ++i;
             }
         }