Move this check up to actually be done when it's needed

Closes #269
This commit is contained in:
Ellpeck 2016-10-03 16:50:36 +02:00
parent a3998c478d
commit 20f34ecc89

View file

@ -103,18 +103,18 @@ public class WorldGenLushCaves extends WorldGenerator{
} }
private boolean checkIndestructable(World world, BlockPos pos){ private boolean checkIndestructable(World world, BlockPos pos){
//If this isn't checked, the game crashes because it tries to destroy a chest that doesn't have any loot yet :v
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof ILootContainer){
return true;
}
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
if(state != null){ if(state != null){
Block block = state.getBlock(); Block block = state.getBlock();
if(block != null && (block.isAir(state, world, pos) || block.getHarvestLevel(state) >= 0F)){ if(block != null && (block.isAir(state, world, pos) || block.getHarvestLevel(state) >= 0F)){
return false; return false;
} }
//If this isn't checked, the game crashes because it tries to destroy a chest that doesn't have any loot yet :v
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof ILootContainer){
return true;
}
} }
return true; return true;
} }