mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 13:46:10 +03:00
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/ContainerHopper.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerHopper.java
|
|
@@ -1,6 +1,10 @@
|
|
package net.minecraft.inventory;
|
|
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
@@ -8,10 +12,26 @@
|
|
public class ContainerHopper extends Container
|
|
{
|
|
private final IInventory hopperInventory;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private InventoryPlayer player;
|
|
|
|
+ @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;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player)
|
|
{
|
|
this.hopperInventory = hopperInventoryIn;
|
|
+ this.player = playerInventory; // CraftBukkit - save player
|
|
hopperInventoryIn.openInventory(player);
|
|
int i = 51;
|
|
|
|
@@ -36,6 +56,7 @@
|
|
|
|
public boolean canInteractWith(EntityPlayer playerIn)
|
|
{
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.hopperInventory.isUseableByPlayer(playerIn);
|
|
}
|
|
|