Fix crash when teleposing Demon Will Crystals (#1062)

(cherry picked from commit 970acd4)
This commit is contained in:
Nicholas Ignoffo 2017-02-23 19:45:09 -08:00
parent 88efd672d5
commit 72bf53f8d3

View file

@ -158,12 +158,16 @@ public class BlockDemonCrystal extends Block
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state) public void breakBlock(World world, BlockPos pos, IBlockState state)
{ {
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
EnumDemonWillType type = state.getValue(TYPE); if (tile instanceof TileDemonCrystal) {
int number = tile.getCrystalCount(); EnumDemonWillType type = state.getValue(TYPE);
int number = ((TileDemonCrystal) tile).getCrystalCount();
spawnAsEntity(world, pos, getItemStackDropped(type, number)); spawnAsEntity(world, pos, getItemStackDropped(type, number));
world.removeTileEntity(pos); world.removeTileEntity(pos);
}
super.breakBlock(world, pos, state);
} }
public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber) public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber)