Fixes DriveBakedModel to not crash when SLOT_STATE is null (#3545)

Uses a null object in case the TE is not available for whichever reason.
This commit is contained in:
fscan
2018-06-18 19:03:28 +02:00
committed by yueh
parent 0ef854ca4b
commit b431d5d681
2 changed files with 11 additions and 6 deletions
@@ -74,13 +74,8 @@ public class BlockDrive extends AEBaseTileBlock
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
TileDrive te = this.getTileEntity( world, pos );
if( te == null )
{
return super.getExtendedState( state, world, pos );
}
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
return extState.withProperty( SLOTS_STATE, DriveSlotsState.fromChestOrDrive( te ) );
return extState.withProperty( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
}
@Override