diff options
author | Wesley Wolfe <weswolf@aol.com> | 2013-12-10 01:50:59 -0600 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-12-10 16:21:09 -0600 |
commit | ca4c118994117955cc682c572c407f317a0a7530 (patch) | |
tree | e9623bde62a3ce95c377f6e74e2e23a27d2bec20 /src | |
parent | f5f71a5502e93786d18348eb7dd66a5754e37e54 (diff) | |
download | craftbukkit-ca4c118994117955cc682c572c407f317a0a7530.tar craftbukkit-ca4c118994117955cc682c572c407f317a0a7530.tar.gz craftbukkit-ca4c118994117955cc682c572c407f317a0a7530.tar.lz craftbukkit-ca4c118994117955cc682c572c407f317a0a7530.tar.xz craftbukkit-ca4c118994117955cc682c572c407f317a0a7530.zip |
Rework furnace result log. Fixes BUKKIT-5115
This changes the logic for furnace smelt event to consider a result of
null (read: air / invalid), which will still consume an item. It also
properly considers item meta in the result, instead of only checking the
item data value.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntityFurnace.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 8fd6407c..945969a3 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -255,7 +255,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { // CraftBukkit start CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]); - CraftItemStack result = CraftItemStack.asCraftMirror(itemstack.cloneItemStack()); + org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack); FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), source, result); this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent); @@ -264,17 +264,19 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { return; } - itemstack = CraftItemStack.asNMSCopy(furnaceSmeltEvent.getResult()); + result = furnaceSmeltEvent.getResult(); + itemstack = CraftItemStack.asNMSCopy(result); - if (this.items[2] == null) { - this.items[2] = itemstack.cloneItemStack(); - } else if (this.items[2].getItem() == itemstack.getItem()) { - // CraftBukkit - compare damage too - if (this.items[2].getData() == itemstack.getData()) { + if (itemstack != null) { + if (this.items[2] == null) { + this.items[2] = itemstack; + } else if (CraftItemStack.asCraftMirror(this.items[2]).isSimilar(result)) { this.items[2].count += itemstack.count; + } else { + return; } - // CraftBukkit end } + // CraftBukkit end --this.items[0].count; if (this.items[0].count <= 0) { |