From 72bf53f8d336bf69741600ae26e96557039342e6 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Thu, 23 Feb 2017 19:45:09 -0800 Subject: [PATCH] Fix crash when teleposing Demon Will Crystals (#1062) (cherry picked from commit 970acd4) --- .../bloodmagic/block/BlockDemonCrystal.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java index 819df5e3..ff7e64ff 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java @@ -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)