Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/main/java/mcjty/lib/tileentity/GenericTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ public boolean receiveDataFromServer(String command, @Nonnull TypedMap result) {
}


@Deprecated
protected boolean needsCustomInvWrapper() {
return false;
}
Expand All @@ -396,7 +397,7 @@ protected boolean needsCustomInvWrapper() {

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (needsCustomInvWrapper()) {
if (facing == null ? this instanceof IInventory : this instanceof ISidedInventory) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return true;
}
Expand All @@ -407,18 +408,18 @@ public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if (needsCustomInvWrapper()) {
if (facing == null) {
if (facing == null) {
if (this instanceof IInventory) {
if (invHandlerNull == null) {
invHandlerNull = new InvWrapper((IInventory) this);
}
return (T) invHandlerNull;
} else {
if (invHandlerSided == null) {
invHandlerSided = new NullSidedInvWrapper((ISidedInventory) this);
}
return (T) invHandlerSided;
}
} else if (this instanceof ISidedInventory) {
if (invHandlerSided == null) {
invHandlerSided = new NullSidedInvWrapper((ISidedInventory) this);
}
return (T) invHandlerSided;
}
}
return super.getCapability(capability, facing);
Expand Down