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,14 +158,18 @@ 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);
if (tile instanceof TileDemonCrystal) {
EnumDemonWillType type = state.getValue(TYPE); EnumDemonWillType type = state.getValue(TYPE);
int number = tile.getCrystalCount(); 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)
{ {
ItemStack stack = null; ItemStack stack = null;