String blockRaw = args[i];
if (blockRaw.charAt(0) == '*') {
if (blockRaw.equals("*fluid")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
if (block.getMaterial().isLiquid()) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*tree")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
if (block.isWood(world, x, y, z) || block.isLeaves(world, x, y, z)) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.startsWith("*repl")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
if (block.isReplaceable(world, x, y, z)) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*stone")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
if (block.getMaterial() == Material.rock) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*sand")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
if (block.getMaterial() == Material.sand) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*dirt")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
Material m = block.getMaterial();
if (m == Material.grass || m == Material.ground || m == Material.clay || m == Material.snow
|| m == Material.craftedSnow || m == Material.ice || m == Material.packedIce) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*plants")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
Material m = block.getMaterial();
if (m == Material.plants || m == Material.vine || m == Material.cactus || m == Material.leaves) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
} else if (blockRaw.equals("*fire")) {
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
Block block = chunk.getBlock(cX, y, cZ);
Material m = block.getMaterial();
if (m == Material.fire || m == Material.lava || block.isBurning(world, x, y, z)) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
}
continue;
}
int meta = -1;
t = blockRaw.indexOf('#');
if (t > 0) {
meta = CommandBase.parseInt(sender, blockRaw.substring(t + 1));
blockRaw = blockRaw.substring(0, t);
}
Block block = Block.getBlockFromName(blockRaw);
if (block == Blocks.air) {
continue;
}
for (int x = xS; x <= xL; ++x) {
for (int z = zS; z <= zL; ++z) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
int cX = x & 15, cZ = z & 15;
for (int y = yS; y <= yL; ++y) {
boolean v = meta == -1 || chunk.getBlockMetadata(cX, y, cZ) == meta;
if (v && chunk.getBlock(cX, y, cZ) == block) {
if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
set.add(chunk);
}
}
}
}
}
}
if (world instanceof WorldServer) {
TObjectHashIterator<Chunk> c = set.iterator();
for (int k = 0, e = set.size(); k < e; ++k) {
Chunk chunk = c.next();
PlayerManager manager = ((WorldServer) world).getPlayerManager();
if (manager == null) {
return;
}
PlayerInstance watcher = manager.getOrCreateChunkWatcher(chunk.xPosition, chunk.zPosition, false);