mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:39:58 +03:00
37 lines
1.6 KiB
Diff
37 lines
1.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java
|
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java
|
|
@@ -48,4 +48,33 @@
|
|
{
|
|
return (ITextComponent)(this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0]));
|
|
}
|
|
+
|
|
+ private net.minecraftforge.items.IItemHandler itemHandler;
|
|
+
|
|
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler()
|
|
+ {
|
|
+ return new net.minecraftforge.items.wrapper.InvWrapper(this);
|
|
+ }
|
|
+
|
|
+ @SuppressWarnings("unchecked")
|
|
+ @Override
|
|
+ @javax.annotation.Nullable
|
|
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
|
+ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler);
|
|
+ return super.getCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.Location getLocation() {
|
|
+ if (world == null) return null;
|
|
+ return new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ());
|
|
+ }
|
|
}
|