From 6e60d58e47838a5ee9dd78587252f3cc7298aaf6 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Tue, 3 Nov 2015 21:46:22 +0000 Subject: [PATCH] Fixed the Dandelifeon being able to destroy Bedrock and pretty much any other block. Closes #1484 --- .../subtile/generating/SubTileDandelifeon.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java index c496fefa9..f6a784143 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java @@ -164,19 +164,23 @@ public class SubTileDandelifeon extends SubTileGenerating { void setBlockForGeneration(int x, int y, int z, int gen, int prevGen) { World world = supertile.getWorldObj(); Block blockAt = world.getBlock(x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); if(gen == -2) { int val = prevGen * MANA_PER_GEN; - if(((TileCell) world.getTileEntity(x, y, z)).isSameFlower(supertile)) - mana = Math.min(getMaxMana(), mana + val); - - world.setBlockToAir(x, y, z); + if(tile instanceof TileCell) { + if(((TileCell) tile).isSameFlower(supertile)) + mana = Math.min(getMaxMana(), mana + val); + world.setBlockToAir(x, y, z); + + } } else if(blockAt == ModBlocks.cellBlock) { if(gen < 0 || gen > MAX_GENERATIONS) world.setBlockToAir(x, y, z); - else ((TileCell) world.getTileEntity(x, y, z)).setGeneration(supertile, gen); + else ((TileCell) tile).setGeneration(supertile, gen); } else if(gen >= 0 && blockAt.isAir(supertile.getWorldObj(), x, y, z)) { world.setBlock(x, y, z, ModBlocks.cellBlock); - ((TileCell) world.getTileEntity(x, y, z)).setGeneration(supertile, gen); + tile = world.getTileEntity(x, y, z); + ((TileCell) tile).setGeneration(supertile, gen); } }