Fix crash when teleposing Demon Will Crystals (#1062)
This commit is contained in:
parent
b55b453e6d
commit
970acd4e69
|
@ -143,13 +143,13 @@ public class BlockDemonCrystal extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state)
|
||||||
{
|
{
|
||||||
return ((EnumDemonWillType) state.getValue(TYPE)).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState()
|
||||||
{
|
{
|
||||||
return new BlockStateContainer(this, new IProperty[] { TYPE, AGE, ATTACHED });
|
return new BlockStateContainer(this, TYPE, AGE, ATTACHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -161,12 +161,16 @@ public class BlockDemonCrystal extends BlockContainer
|
||||||
@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)
|
||||||
|
|
Loading…
Reference in a new issue