Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-24 15:20:11 +01:00
42 Zeilen
2.4 KiB
Diff
42 Zeilen
2.4 KiB
Diff
|
--- ../work/decompile-bb26c12b/net/minecraft/server/BlockDropper.java 2014-11-27 08:59:46.525422622 +1100
|
||
|
+++ src/main/java/net/minecraft/server/BlockDropper.java 2014-11-27 08:42:10.124850965 +1100
|
||
|
@@ -1,5 +1,10 @@
|
||
|
package net.minecraft.server;
|
||
|
|
||
|
+// CraftBukkit start
|
||
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||
|
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||
|
+// CraftBukkit end
|
||
|
+
|
||
|
public class BlockDropper extends BlockDispenser {
|
||
|
|
||
|
private final IDispenseBehavior O = new DispenseBehaviorItem();
|
||
|
@@ -38,8 +43,25 @@
|
||
|
itemstack1 = null;
|
||
|
}
|
||
|
} else {
|
||
|
- itemstack1 = TileEntityHopper.addItem(iinventory, itemstack.cloneItemStack().a(1), enumdirection.opposite());
|
||
|
- if (itemstack1 == null) {
|
||
|
+ // CraftBukkit start - Fire event when pushing items into other inventories
|
||
|
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().a(1));
|
||
|
+
|
||
|
+ org.bukkit.inventory.Inventory destinationInventory;
|
||
|
+ // Have to special case large chests as they work oddly
|
||
|
+ if (iinventory instanceof InventoryLargeChest) {
|
||
|
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
|
||
|
+ } else {
|
||
|
+ destinationInventory = iinventory.getOwner().getInventory();
|
||
|
+ }
|
||
|
+
|
||
|
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
|
||
|
+ world.getServer().getPluginManager().callEvent(event);
|
||
|
+ if (event.isCancelled()) {
|
||
|
+ return;
|
||
|
+ }
|
||
|
+ itemstack1 = TileEntityHopper.addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection.opposite());
|
||
|
+ if (event.getItem().equals(oitemstack) && itemstack1 == null) {
|
||
|
+ // CraftBukkit end
|
||
|
itemstack1 = itemstack.cloneItemStack();
|
||
|
if (--itemstack1.count == 0) {
|
||
|
itemstack1 = null;
|