aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch
new file mode 100644
index 0000000000..725f337033
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/DispenserMenu.java.patch
@@ -0,0 +1,66 @@
+--- a/net/minecraft/world/inventory/DispenserMenu.java
++++ b/net/minecraft/world/inventory/DispenserMenu.java
+@@ -6,6 +6,11 @@
+ import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.item.ItemStack;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.inventory.CraftInventory;
++import org.bukkit.craftbukkit.inventory.CraftInventoryView;
++// CraftBukkit end
++
+ public class DispenserMenu extends AbstractContainerMenu {
+
+ private static final int SLOT_COUNT = 9;
+@@ -13,14 +18,22 @@
+ private static final int INV_SLOT_END = 36;
+ private static final int USE_ROW_SLOT_START = 36;
+ private static final int USE_ROW_SLOT_END = 45;
+- private final Container dispenser;
++ public final Container dispenser;
++ // CraftBukkit start
++ private CraftInventoryView bukkitEntity = null;
++ private Inventory player;
++ // CraftBukkit end
+
+ public DispenserMenu(int i, Inventory inventory) {
+ this(i, inventory, new SimpleContainer(9));
+ }
+
+- public DispenserMenu(int i, Inventory inventory, Container container) {
+- super(MenuType.GENERIC_3x3, i);
++ public DispenserMenu(int containerId, Inventory playerInventory, Container container) {
++ super(MenuType.GENERIC_3x3, containerId);
++ // CraftBukkit start - Save player
++ this.player = playerInventory;
++ // CraftBukkit end
++
+ checkContainerSize(container, 9);
+ this.dispenser = container;
+ container.startOpen(inventory.player);
+@@ -49,6 +61,7 @@
+ @Override
+ @Override
+ public boolean stillValid(Player player) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return this.dispenser.stillValid(player);
+ }
+
+@@ -92,4 +103,17 @@
+ super.removed(player);
+ this.dispenser.stopOpen(player);
+ }
++
++ // CraftBukkit start
++ @Override
++ public CraftInventoryView getBukkitView() {
++ if (bukkitEntity != null) {
++ return bukkitEntity;
++ }
++
++ CraftInventory inventory = new CraftInventory(this.dispenser);
++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
++ return bukkitEntity;
++ }
++ // CraftBukkit end
+ }