Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Don't consume bonemeal if there is no crop present. Fixes BUKKIT-3790
Bonemeal dispense behavior already took care of decrementing the item stack, therefore we shouldn't manage the size manually. Pulled from PR #1172
Dieser Commit ist enthalten in:
Ursprung
0aa187f151
Commit
80935e5c2b
@ -20,9 +20,8 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
|
|||||||
int k = isourceblock.getBlockZ() + enumfacing.e();
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack itemstack1 = itemstack.a(1);
|
|
||||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
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));
|
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||||
if (!BlockDispenser.eventFired) {
|
if (!BlockDispenser.eventFired) {
|
||||||
@ -30,12 +29,10 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
itemstack.count++;
|
|
||||||
return itemstack;
|
return itemstack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.getItem().equals(craftItem)) {
|
if (!event.getItem().equals(craftItem)) {
|
||||||
itemstack.count++;
|
|
||||||
// Chain to handler for new item
|
// Chain to handler for new item
|
||||||
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(eventStack.getItem());
|
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(eventStack.getItem());
|
||||||
@ -46,7 +43,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (ItemDye.a(itemstack1, world, i, j, k)) { // CraftBukkit - itemstack -> itemstack1
|
if (ItemDye.a(itemstack, world, i, j, k)) {
|
||||||
if (!world.isStatic) {
|
if (!world.isStatic) {
|
||||||
world.triggerEffect(2005, i, j, k, 0);
|
world.triggerEffect(2005, i, j, k, 0);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren