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
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
EnumDemonWillType type = state.getValue(TYPE);
int number = tile.getCrystalCount();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileDemonCrystal) {
EnumDemonWillType type = state.getValue(TYPE);
int number = ((TileDemonCrystal) tile).getCrystalCount();
spawnAsEntity(world, pos, getItemStackDropped(type, number));
world.removeTileEntity(pos);
spawnAsEntity(world, pos, getItemStackDropped(type, number));
world.removeTileEntity(pos);
}
super.breakBlock(world, pos, state);
}
public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber)