if (holes < minHoles || holes > maxHoles)
return false;
NBTTagCompound tag = (NBTTagCompound) ((WeightedRandomNBTTag)WeightedRandom.getRandomItem(rand, spawners)).tag;
ChestGenHooks table = ChestGenHooks.getInfo(((DungeonMob)WeightedRandom.getRandomItem(rand, lootTables)).type);
for (x = xStart - xWidth - 1; x <= xStart + xWidth + 1; ++x) {
for (z = zStart - zWidth - 1; z <= zStart + zWidth + 1; ++z) {
for (y = yStart + height; y >= floor; --y) {
if ((abs(x - xStart) != xWidth + 1 || abs(z - zStart) != zWidth + 1) && y != ceiling) {
world.setBlockToAir(x, y, z);
}
else if (y >= 0 && !canGenerateInBlock(world, x, y - 1, z, genBlock)) {
world.setBlockToAir(x, y, z);
}
else if (canGenerateInBlock(world, x, y, z, genBlock)) {
if (y == floor)
generateBlock(world, x, y, z, this.floor);
else
generateBlock(world, x, y, z, walls);
}
}
}
}
for (int i = maxChests; i --> 0; ) {
for (int j = 0; j < 3; ++j) {
x = xStart + nextInt(rand, xWidth * 2 + 1) - xWidth;
z = zStart + nextInt(rand, zWidth * 2 + 1) - zWidth;
if (world.isAirBlock(x, yStart, z)) {
int walls = 0;
if (isWall(world, x - 1, yStart, z))
++walls;
if (isWall(world, x + 1, yStart, z))
++walls;
if (isWall(world, x, yStart, z + 1))
++walls;
if (isWall(world, x, yStart, z + 1))
++walls;
if (walls >= 1 && walls <= 2) {
world.setBlock(x, yStart, z, Blocks.chest, 0, 2);
TileEntityChest chest = (TileEntityChest)world.getTileEntity(x, yStart, z);
if (chest != null) {
WeightedRandomChestContent.generateChestContents(rand, table.getItems(rand), chest, table.getCount(rand));
}
break;
}
}