3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 23:30:10 +01:00
Paper/nms-patches/TileEntityCampfire.patch
2020-06-25 10:00:00 +10:00

36 Zeilen
1.6 KiB
Diff

--- 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 {
@@ -55,6 +60,20 @@
}).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.b);
this.k();