Paper/nms-patches/TileEntityCampfire.patch

36 lines
1.6 KiB
Diff
Raw Normal View History

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/TileEntityCampfire.java
+++ b/net/minecraft/server/TileEntityCampfire.java
@@ -3,6 +3,11 @@
import java.util.Optional;
import java.util.Random;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.block.BlockCookEvent;
+// CraftBukkit end
public class TileEntityCampfire extends TileEntity implements Clearable, ITickable {
2019-04-25 04:00:00 +02:00
@@ -59,6 +64,20 @@
2019-04-23 04:00:00 +02:00
}).orElse(itemstack);
BlockPosition blockposition = this.getPosition();
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(this.world, this.position), source, result);
+ this.world.getServer().getPluginManager().callEvent(blockCookEvent);
+
+ if (blockCookEvent.isCancelled()) {
+ return;
+ }
+
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItem(this.world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
this.items.set(i, ItemStack.a);
this.s();