summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockDropper.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/BlockDropper.patch')
-rw-r--r--nms-patches/BlockDropper.patch24
1 files changed, 12 insertions, 12 deletions
diff --git a/nms-patches/BlockDropper.patch b/nms-patches/BlockDropper.patch
index cdb5ed4e..07c21cb4 100644
--- a/nms-patches/BlockDropper.patch
+++ b/nms-patches/BlockDropper.patch
@@ -1,22 +1,22 @@
--- a/net/minecraft/server/BlockDropper.java
+++ b/net/minecraft/server/BlockDropper.java
-@@ -1,6 +1,10 @@
+@@ -1,5 +1,10 @@
package net.minecraft.server;
- import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
+// CraftBukkit end
-
++
public class BlockDropper extends BlockDispenser {
-@@ -40,8 +44,25 @@
- itemstack1 = null;
- }
+ private final IDispenseBehavior e = new DispenseBehaviorItem();
+@@ -35,8 +40,25 @@
+ if (iinventory == null) {
+ itemstack1 = this.e.a(sourceblock, itemstack);
} else {
-- itemstack1 = TileEntityHopper.addItem(iinventory, itemstack.cloneItemStack().cloneAndSubtract(1), enumdirection.opposite());
-- if (itemstack1 == null) {
+- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.cloneItemStack().cloneAndSubtract(1), enumdirection.opposite());
+- if (itemstack1.isEmpty()) {
+ // CraftBukkit start - Fire event when pushing items into other inventories
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().cloneAndSubtract(1));
+
@@ -33,9 +33,9 @@
+ if (event.isCancelled()) {
+ return;
+ }
-+ itemstack1 = TileEntityHopper.addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection.opposite());
-+ if (event.getItem().equals(oitemstack) && itemstack1 == null) {
++ itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection.opposite());
++ if (event.getItem().equals(oitemstack) && itemstack1.isEmpty()) {
+ // CraftBukkit end
itemstack1 = itemstack.cloneItemStack();
- if (--itemstack1.count <= 0) {
- itemstack1 = null;
+ itemstack1.subtract(1);
+ } else {