Paper/CraftBukkit-Patches/0047-Properly-Consume-Bonemeal-in-Dispensers.patch

48 lines
2.3 KiB
Diff
Raw Normal View History

From f8cc5317e0a3da43d265764426cbd2d62fecad67 Mon Sep 17 00:00:00 2001
From: Alex Ciuba <alexciuba@gmail.com>
Date: Mon, 10 Jun 2013 16:04:38 -0400
Subject: [PATCH] Properly Consume Bonemeal in Dispensers
Don't consume bonemeal if there is no crop in front. Fixes BUKKIT-3790
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
2013-12-01 11:40:53 +08:00
index 713bbe8..92b3789 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
@@ -20,9 +20,8 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
int k = isourceblock.getBlockZ() + enumfacing.e();
// CraftBukkit start
- ItemStack itemstack1 = itemstack.a(1);
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
- CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+ CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem());
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
if (!BlockDispenser.eventFired) {
@@ -30,12 +29,10 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
}
if (event.isCancelled()) {
- itemstack.count++;
return itemstack;
}
if (!event.getItem().equals(craftItem)) {
- itemstack.count++;
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(eventStack.getItem());
@@ -46,7 +43,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
}
// CraftBukkit end
- if (ItemDye.a(itemstack1, world, i, j, k)) { // CraftBukkit - itemstack -> itemstack1
+ if (ItemDye.a(itemstack, world, i, j, k)) {
if (!world.isStatic) {
world.triggerEffect(2005, i, j, k, 0);
}
--
2013-12-01 11:40:53 +08:00
1.8.3.2