Fixed nullpointer caused by getting capabilities with null facing

This commit is contained in:
Ellpeck 2016-06-18 17:30:12 +02:00
parent 58b959c593
commit 1575a8aa62

View file

@ -211,7 +211,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
@Override @Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){ public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ if(this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
return (T)this.invWrappers[facing.ordinal()]; return (T)this.invWrappers[facing == null ? 0 : facing.ordinal()];
} }
else{ else{
return super.getCapability(capability, facing); return super.getCapability(capability, facing);