Paper/nms-patches/SlotFurnaceResult.patch
hibo98 3f3c65f471 [BUKKIT-3451] Use correct item amount for FurnaceExtractEvent.
Also don't call FurnaceExtractEvent when the item amount is 0.
2016-02-07 10:09:05 +11:00

33 lines
1.2 KiB
Diff

--- a/net/minecraft/server/SlotFurnaceResult.java
+++ b/net/minecraft/server/SlotFurnaceResult.java
@@ -1,5 +1,10 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.FurnaceExtractEvent;
+// CraftBukkit end
+
public class SlotFurnaceResult extends Slot {
private EntityHuman a;
@@ -50,6 +55,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;