summaryrefslogtreecommitdiffstats
path: root/nms-patches/SlotFurnaceResult.patch
blob: eee722f9aa3510fcc87d99525006c97397ee7155 (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
--- a/net/minecraft/server/SlotFurnaceResult.java
+++ b/net/minecraft/server/SlotFurnaceResult.java
@@ -2,6 +2,10 @@
 
 import java.util.Iterator;
 import java.util.Map.Entry;
+// CraftBukkit start
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.FurnaceExtractEvent;
+// CraftBukkit end
 
 public class SlotFurnaceResult extends Slot {
 
@@ -66,6 +70,18 @@
                     i = j;
                 }
 
+                // CraftBukkit start - fire FurnaceExtractEvent
+                Player player = (Player) a.getBukkitEntity();
+                TileEntityFurnace furnace = ((TileEntityFurnace) this.inventory);
+                org.bukkit.block.Block block = a.world.getWorld().getBlockAt(furnace.position.getX(), furnace.position.getY(), furnace.position.getZ());
+
+                if (b != 0) {
+                    FurnaceExtractEvent event = new FurnaceExtractEvent(player, block, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(itemstack.getItem()), b, i);
+                    a.world.getServer().getPluginManager().callEvent(event);
+                    i = event.getExpToDrop();
+                }
+                // CraftBukkit end
+
                 while (i > 0) {
                     j = EntityExperienceOrb.getOrbValue(i);
                     i -= j;