private void finalizeSurface(World world, int x, int y, int z) {
for (byte px = 0; px < 16; px++) {
for (byte pz = 0; pz < 16; pz++) {
for (byte py = -1; py < 4; py++) {
final Block block = world.getBlock(x + px, y + py, z + pz);
if (block.isAtSurface()) {
final BlockMaterial material = block.getMaterial();
if (material == VanillaMaterials.DIRT) {
final BlockMaterial top;
final Biome biome = block.getBiomeType();
if (biome instanceof GrassyBiome) {
top = ((GrassyBiome) biome).getGroundCover()[0].getMaterial(true);
} else {
top = VanillaMaterials.GRASS;
}
block.setMaterial(top);
} else if (material == VanillaMaterials.STATIONARY_WATER
&& block.translate(0, 1, 0).isMaterial(VanillaMaterials.AIR)) {
if (block.getBiomeType() instanceof SnowyBiome) {
block.setMaterial(VanillaMaterials.ICE);
}
}
}
}
}