mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 03:26:14 +00:00
63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerDispenser.java
|
|
+++ b/net/minecraft/world/inventory/ContainerDispenser.java
|
|
@@ -6,6 +6,11 @@
|
|
import net.minecraft.world.entity.player.PlayerInventory;
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerDispenser extends Container {
|
|
|
|
private static final int SLOT_COUNT = 9;
|
|
@@ -14,6 +19,10 @@
|
|
private static final int USE_ROW_SLOT_START = 36;
|
|
private static final int USE_ROW_SLOT_END = 45;
|
|
public final IInventory dispenser;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+ // CraftBukkit end
|
|
|
|
public ContainerDispenser(int i, PlayerInventory playerinventory) {
|
|
this(i, playerinventory, new InventorySubcontainer(9));
|
|
@@ -21,6 +30,10 @@
|
|
|
|
public ContainerDispenser(int i, PlayerInventory playerinventory, IInventory iinventory) {
|
|
super(Containers.GENERIC_3x3, i);
|
|
+ // CraftBukkit start - Save player
|
|
+ this.player = playerinventory;
|
|
+ // CraftBukkit end
|
|
+
|
|
checkContainerSize(iinventory, 9);
|
|
this.dispenser = iinventory;
|
|
iinventory.startOpen(playerinventory.player);
|
|
@@ -41,6 +54,7 @@
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.dispenser.stillValid(entityhuman);
|
|
}
|
|
|
|
@@ -82,4 +96,17 @@
|
|
super.removed(entityhuman);
|
|
this.dispenser.stopOpen(entityhuman);
|
|
}
|
|
+
|
|
+ // 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
|
|
}
|