Files
CatServer/patches/net/minecraft/inventory/InventoryEnderChest.java.patch
2019-02-24 22:29:41 +08:00

43 lines
1.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/inventory/InventoryEnderChest.java
+++ ../src-work/minecraft/net/minecraft/inventory/InventoryEnderChest.java
@@ -5,14 +5,24 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityEnderChest;
+import org.bukkit.Location;
+import org.bukkit.inventory.InventoryHolder;
public class InventoryEnderChest extends InventoryBasic
{
private TileEntityEnderChest associatedChest;
+ private final EntityPlayer owner;
+
public InventoryEnderChest()
{
+ this(null);
+ }
+
+ public InventoryEnderChest(EntityPlayer owner)
+ {
super("container.enderchest", false, 27);
+ this.owner = owner;
}
public void setChestTileEntity(TileEntityEnderChest chestTileEntity)
@@ -84,4 +94,14 @@
super.closeInventory(player);
this.associatedChest = null;
}
+
+ public InventoryHolder getBukkitOwner() {
+ return owner != null ? owner.getBukkitEntity() : null;
+ }
+
+ @Override
+ public Location getLocation() {
+ return new Location(this.associatedChest.getWorld().getWorld(), this.associatedChest.getPos().getX(), this.associatedChest.getPos().getY(), this.associatedChest.getPos().getZ());
+ }
+
}