Example #1
0
 @Override
 public void placeObject(World world, int x, int y, int z) {
   x -= 8;
   z -= 8;
   Biome biome = world.getBiomeType(x, y, z);
   boolean sandy = biome instanceof SandyBiome;
   for (byte px = 0; px < 16; px++) {
     for (byte pz = 0; pz < 16; pz++) {
       boolean columnHasWater = false;
       for (byte py = (byte) -holeHeightMap[16 * px + pz]; py < 0; py++) {
         world.setBlockMaterial(px + x, py + y, pz + z, liquid, (short) 0, world);
         columnHasWater = true;
       }
       if (stoneWalls) {
         for (byte py = 1; py < 5; py++) {
           if (isWallBlock(px, py, pz, holeHeightMap)) {
             world.setBlockMaterial(
                 x + px, y - py, z + pz, VanillaMaterials.STONE, (short) 0, world);
           }
         }
       }
       for (byte py = 0; py < topHeightMap[16 * px + pz]; py++) {
         world.setBlockMaterial(px + x, py + y, pz + z, VanillaMaterials.AIR, (short) 0, world);
       }
       if (stonyTop) {
         for (byte py = 1; py < 5; py++) {
           if (isWallBlock(px, py, pz, topHeightMap)) {
             final Block block = world.getBlock(px + x, py + y - 1, pz + z, world);
             if (random.nextBoolean() && block.getMaterial().isOpaque()) {
               block.setMaterial(VanillaMaterials.STONE);
             }
           }
         }
       }
       if (sandy && columnHasWater) {
         int ty = topHeightMap[16 * px + pz] + y;
         if (world.getBlockMaterial(x + px, ty, z + pz).equals(VanillaMaterials.SAND)) {
           world.setBlockMaterial(
               x + px, ty, z + pz, VanillaMaterials.SANDSTONE, (short) 0, world);
         }
       }
     }
   }
   if (biomeAdaptedSurface) {
     finalizeSurface(world, x, y, z);
   }
 }