Files
2019-02-24 22:29:41 +08:00

48 lines
1.6 KiB
Diff

--- ../src-base/minecraft/net/minecraft/inventory/ContainerHopper.java
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerHopper.java
@@ -3,14 +3,20 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerHopper extends Container
{
private final IInventory hopperInventory;
+ private CraftInventoryView bukkitEntity = null;
+ private InventoryPlayer player;
+
public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player)
{
this.hopperInventory = hopperInventoryIn;
+ this.player = playerInventory;
hopperInventoryIn.openInventory(player);
int i = 51;
@@ -35,6 +41,7 @@
public boolean canInteractWith(EntityPlayer playerIn)
{
+ if (!this.checkReachable) return true;
return this.hopperInventory.isUsableByPlayer(playerIn);
}
@@ -78,4 +85,15 @@
super.onContainerClosed(playerIn);
this.hopperInventory.closeInventory(playerIn);
}
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventory inventory = new CraftInventory(this.hopperInventory);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
}