mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 13:09:22 +01:00
parent
af67fb87cc
commit
79660f3f6f
2 changed files with 11 additions and 2 deletions
|
@ -223,13 +223,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nonnull EnumFacing facing){
|
||||
return this.getCapability(capability, facing) != null;
|
||||
return this.canHandleCapability(capability) || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nonnull EnumFacing facing){
|
||||
if(this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
|
||||
if(this.canHandleCapability(capability)){
|
||||
return (T)this.invWrappers[facing.ordinal()];
|
||||
}
|
||||
else{
|
||||
|
@ -237,6 +237,10 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
}
|
||||
}
|
||||
|
||||
private boolean canHandleCapability(Capability capability){
|
||||
return this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
}
|
||||
|
||||
public boolean hasInvWrapperCapabilities(){
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -122,6 +122,11 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
|||
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nonnull EnumFacing facing){
|
||||
return this.isBoundThingInRange() ? this.worldObj.getTileEntity(this.boundPosition).hasCapability(capability, facing) : super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nonnull EnumFacing facing){
|
||||
|
|
Loading…
Reference in a new issue