mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
--- a/net/minecraft/server/ContainerDispenser.java
|
|
+++ b/net/minecraft/server/ContainerDispenser.java
|
|
@@ -1,8 +1,17 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerDispenser extends Container {
|
|
|
|
public final IInventory items;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+ // CraftBukkit end
|
|
|
|
public ContainerDispenser(int i, PlayerInventory playerinventory) {
|
|
this(i, playerinventory, new InventorySubcontainer(9));
|
|
@@ -10,6 +19,10 @@
|
|
|
|
public ContainerDispenser(int i, PlayerInventory playerinventory, IInventory iinventory) {
|
|
super(Containers.GENERIC_3X3, i);
|
|
+ // CraftBukkit start - Save player
|
|
+ this.player = playerinventory;
|
|
+ // CraftBukkit end
|
|
+
|
|
a(iinventory, 9);
|
|
this.items = iinventory;
|
|
iinventory.startOpen(playerinventory.player);
|
|
@@ -37,6 +50,7 @@
|
|
|
|
@Override
|
|
public boolean canUse(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.items.a(entityhuman);
|
|
}
|
|
|
|
@@ -78,4 +92,17 @@
|
|
super.b(entityhuman);
|
|
this.items.closeContainer(entityhuman);
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventory inventory = new CraftInventory(this.items);
|
|
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|