protect against ClassCastException when a tank is used in eg a Carpenter's block

This commit is contained in:
Matthias Mann committed 2015-08-10 23:18:30 +02:00
1 parent 6c7216b0d0
commit ac1ca7865e
1 file changed
+3 -3
@@ -130,9 +130,9 @@ public class BlockTank extends AbstractMachineBlock<TileTank> implements IAdvanc
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileTank tank = (TileTank) world.getTileEntity(x, y, z);
if(tank != null) {
FluidStack stack = tank.tank.getFluid();
TileEntity tank = world.getTileEntity(x, y, z);
if(tank instanceof TileTank) {
FluidStack stack = ((TileTank) tank).tank.getFluid();
return stack == null || stack.amount <= 0 ? 0 : stack.getFluid().getLuminosity(stack);
}
return super.getLightValue(world, x, y, z);