public void onPlayerStoppedUsing(ItemStack var1, World var2, EntityPlayer var3, int var4) {
    int var5 = var3.getFoodStats().getFoodLevel();

    if (var5 > 6) {
      int var6 = this.getMaxItemUseDuration(var1) - var4;
      float var7 = (float) var6 / 20.0F;
      var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;

      if (var7 >= 1.0F && var5 > 7) {
        for (int var18 = 0; var18 < 8; ++var18) {
          double var9 = Math.PI * (double) var18 / 4.0D;
          double var11 = var3.posX + 5.5D * Math.sin(var9);
          double var13 = var3.posZ + 5.5D * Math.cos(var9);
          double var15 = (double) var2.getHeightValue((int) (var11 - 0.5D), (int) (var13 - 0.5D));
          EntityLightningBolt var17 = new EntityLightningBolt(var2, var11, var15, var13);

          //					if (!var2.isRemote)
          //					{
          var2.spawnEntityInWorld(var17);
          //					}
        }

        if (!var3.capabilities.isCreativeMode) {
          var3.getFoodStats().addStats(-1, 1.0f);
        }
      } else {
        double var8 = var3.posX;
        double var10 = var3.posZ;
        var8 -= 6.0D * Math.sin((double) (var3.rotationYaw / 180.0F) * Math.PI);
        var10 += 6.0D * Math.cos((double) (var3.rotationYaw / 180.0F) * Math.PI);
        double var12 = (double) var2.getHeightValue((int) (var8 - 0.5D), (int) (var10 - 0.5D));
        EntityLightningBolt var14 = new EntityLightningBolt(var2, var8, var12, var10);

        //				if (!var2.isRemote)
        //				{
        var2.spawnEntityInWorld(var14);
        //				}

        if (!var3.capabilities.isCreativeMode) {
          var3.getFoodStats().addStats(-1, 1.0f);
        }
      }

      var1.damageItem(1, var3);
      var3.swingItem();
      var2.playSoundAtEntity(var3, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F));
    }
  }
  @Override
  public void generate(
      Random random,
      int chunkX,
      int chunkZ,
      World world,
      IChunkProvider chunkGenerator,
      IChunkProvider chunkProvider) {
    BiomeGenBase biome = world.getBiomeGenForCoords(chunkX * 16, chunkZ * 16);
    BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);

    if (types.length == 1 && types[0] == BiomeDictionary.Type.PLAINS) {
      int flaxPlants = 0;
      while (random.nextFloat() < 0.8f && flaxPlants < 10) flaxPlants++;

      for (int flower = 0; flower < flaxPlants; ++flower) {
        int x = chunkX * 16 + random.nextInt(16) + 8;
        int z = chunkZ * 16 + random.nextInt(16) + 8;
        int y = random.nextInt(world.getHeightValue(x, z) + 32);

        plantGen.func_150550_a(YGCBlocks.flaxPlant, 7 - (random.nextFloat() < 0.1f ? 1 : 0));
        plantGen.generate(world, random, x, y, z);
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    // rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    rDecorateSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    float l = simplex.noise2(chunkX / 100f, chunkY / 100f) * 6f + 0.8f;

    if (l > 0f && rand.nextInt(12) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      (new WorldGenLog(1, 3 + rand.nextInt(4), false)).generate(world, rand, x22, y22, z22);
    }

    for (int b = 0; b < 2f * strength; b++) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);

      if (rand.nextInt(8) == 0) {

        if (rand.nextInt(10) == 0) {
          (new WorldGenTreeShrub(rand.nextInt(5) + 4, rand.nextInt(2), rand.nextInt(2)))
              .generate(world, rand, i1, k1, j1);
        } else {
          (new WorldGenTreeShrub(rand.nextInt(4) + 1, rand.nextInt(2), rand.nextInt(2)))
              .generate(world, rand, i1, k1, j1);
        }
      }
    }
  }
  public void decorate(World par1World, Random par2Random, int par3, int par4) {
    super.decorate(par1World, par2Random, par3, par4);

    if (par2Random.nextInt(1000) == 0) {
      int k = par3 + par2Random.nextInt(16) + 8;
      int l = par4 + par2Random.nextInt(16) + 8;
      WorldGenDesertWells worldgendesertwells = new WorldGenDesertWells();
      worldgendesertwells.generate(par1World, par2Random, k, par1World.getHeightValue(k, l) + 1, l);
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      PerlinNoise perlin,
      CellNoise cell,
      float strength,
      float river) {
    for (int l = 0; l < 2f * strength; ++l) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (k1 < 68 || rand.nextInt(4) == 0) {
        (new DecoBlob(Blocks.cobblestone, 0)).generate(world, rand, i1, k1, j1);
      }
    }

    if (rand.nextInt((int) (4f / strength)) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      if (y22 < 70) {
        (new DecoLog(1, 3 + rand.nextInt(4), false)).generate(world, rand, x22, y22, z22);
      }
    }

    for (int f23 = 0; f23 < 1f * strength; f23++) {
      int j15 = chunkX + rand.nextInt(16) + 8;
      int j17 = 64 + rand.nextInt(64);
      int j20 = chunkY + rand.nextInt(16) + 8;
      (new DecoFlowers(new int[] {9, 0, 3})).generate(world, rand, j15, j17, j20);
    }

    for (int l14 = 0; l14 < 3f * strength; l14++) {
      int l19 = chunkX + rand.nextInt(16) + 8;
      int k22 = 64 + rand.nextInt(64);
      int j24 = chunkY + rand.nextInt(16) + 8;
      (new DecoGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
    }
  }
  private void generateLockedChest(World world, Random random, int chunkX, int chunkZ) {
    if (random.nextInt(100) < 5) {
      int x = chunkX + random.nextInt(16);
      int z = chunkZ + random.nextInt(16);
      int y = world.getHeightValue(x, z);

      if (world.isAirBlock(x, y, z) && !world.isAirBlock(x, y - 1, z)) {
        generateChest(world, x, y, z, random);
      }
    }
  }
 /**
  * Attempts to generate a single jar cluster
  *
  * @param jarsPerCluster max number of jars to generate in this cluster
  */
 public void doJarGen(
     World world, Random rand, int chunkX, int chunkZ, int jarsPerCluster, boolean isUnderground) {
   int i = chunkX + rand.nextInt(16) + 8;
   int k = chunkZ + rand.nextInt(16) + 8;
   int j = (world.provider.isHellWorld ? rand.nextInt(128) : world.getHeightValue(i, k) + 1);
   int n = jarsPerCluster - rand.nextInt(jarsPerCluster);
   if (Config.genJarsInWater() && !isUnderground) {
     while (j > 0 && world.getBlock(i, j, k).getMaterial() == Material.water) {
       --j;
     }
   }
   generate2(world, rand, i, j, k, n, isUnderground);
 }
  public void generate(
      Random random, int i, int k, World world, IChunkProvider provider, IChunkProvider provider2) {
    i *= 16;
    k *= 16;

    i += random.nextInt(16);
    k += random.nextInt(16);

    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k);

    if (BiomeDictionary.isBiomeOfType(biome, Type.SWAMP)
        || BiomeDictionary.isBiomeOfType(biome, Type.FOREST)
        || BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE)
        || BiomeDictionary.isBiomeOfType(biome, Type.PLAINS)) {
      if (!BiomeDictionary.isBiomeOfType(biome, Type.COLD)) {
        if (emasher.blocks.Blocks.hemp().canBlockStay(world, i, world.getHeightValue(i, k), k)
            && random.nextInt(100) == 0) {
          world.setBlock(i, world.getHeightValue(i, k), k, emasher.blocks.Blocks.hemp(), 0, 2);
        }
      }
    }
  }
  @Override
  public void decorate(World par1World, Random par2Random, int chunkX, int chunkZ) {
    biomeDecorator.decorateChunk(par1World, par2Random, this, chunkX, chunkZ);

    if (chunkX == 0 && chunkZ == 0) {
      mosY = par1World.getHeightValue(chunkX, chunkZ);
      new MosEisleyLeft1().generate(par1World, par2Random, chunkX, mosY, chunkZ);
    } else if (chunkX == 0 && chunkZ == 16) {
      new MosEisleyLeft2().generate(par1World, par2Random, chunkX, mosY, chunkZ);
    } else if (chunkX == 0 && chunkZ == 32) {
      new MosEisleyLeft3().generate(par1World, par2Random, chunkX, mosY, chunkZ);
    } else if (chunkX == 0 && chunkZ == 48) {
      new MosEisleyLeft4().generate(par1World, par2Random, chunkX, mosY, chunkZ);
    } else if (chunkX == 0 && chunkZ == 64) {
      new MosEisleyLeft5().generate(par1World, par2Random, chunkX, mosY, chunkZ);
    }

    if (par2Random.nextInt(400) == 0) {
      int k = chunkX + par2Random.nextInt(16) + 8;
      int l = chunkZ + par2Random.nextInt(16) + 8;
      WorldGenSuperTatooineHomestead worldGenSuperHomestead = new WorldGenSuperTatooineHomestead();
      worldGenSuperHomestead.generate(
          par1World, par2Random, k, par1World.getHeightValue(k, l) - 3, l);
    }

    if (par2Random.nextInt(30) == 0) {
      int k = chunkX + par2Random.nextInt(16) + 8;
      int l = chunkZ + par2Random.nextInt(16) + 8;
      WorldGenMV worldGenMV = new WorldGenMV();
      worldGenMV.generate(par1World, par2Random, k, par1World.getHeightValue(k, l) + 2, l);
    }

    if (par2Random.nextInt(300) == 0) {
      int k = chunkX + par2Random.nextInt(16) + 8;
      int l = chunkZ + par2Random.nextInt(16) + 8;
      WorldGenTatooineHomestead worldGenHomestead = new WorldGenTatooineHomestead();
      worldGenHomestead.generate(par1World, par2Random, k, par1World.getHeightValue(k, l) - 3, l);
    }
  }
  private void generateBattle(World world, Random random, int x, int z) {

    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);

    if ((biome == BiomeGenBase.desert)) {
      for (int a = 0; a < 1; a++) {
        int i = x + random.nextInt(256);
        int j = z + random.nextInt(256);
        int k = world.getHeightValue(i, j);
        new StructureDungeon1().generate(world, random, i, j, k);
        System.out.println("Generiert");
      }
    }
  }
  private void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenPalaeoraphe tree = new WorldGenPalaeoraphe();

    if ((biome instanceof BiomeGenSwamp)) // then add ||BiomeGenXYZ if you want more.
    {
      for (int x = 0; x < 2; x++) {
        int i = chunkX + rand.nextInt(128);
        int k = chunkZ + rand.nextInt(128);
        int j = world.getHeightValue(i, k);
        tree.generate(world, rand, i, j, k);
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {
    RealisticBiomeBase.rDecorateSeedBiome(
        world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    float l = simplex.noise2(chunkX / 80f, chunkY / 80f) * 60f - 15f;

    if (rand.nextInt(24) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);

      if (y22 < 100) {
        if (rand.nextBoolean()) {
          (new WorldGenLog(logBlock, 1, Blocks.leaves, -1, 2 + rand.nextInt(2)))
              .generate(world, rand, x22, y22, z22);
        } else {
          (new WorldGenLog(Blocks.log, 0, Blocks.leaves, -1, 2 + rand.nextInt(2)))
              .generate(world, rand, x22, y22, z22);
        }
      }
    }

    //        for (int f23 = 0; f23 < 8f * strength; f23++)
    //        {
    //            int j15 = chunkX + rand.nextInt(16) + 8;
    //            int j17 = rand.nextInt(128);
    //            int j20 = chunkY + rand.nextInt(16) + 8;
    //            (new WorldGenFlowers(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
    // 11})).generate(world, rand, j15, j17, j20);
    //        }
    //
    //        for (int l14 = 0; l14 < 12f * strength; l14++)
    //        {
    //            int l19 = chunkX + rand.nextInt(16) + 8;
    //            int k22 = rand.nextInt(128);
    //            int j24 = chunkY + rand.nextInt(16) + 8;
    //            (new WorldGenGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
    //        }
  }
  private void generateStructure(World world, Random rand, int chunkX, int chunkZ) {
    // Need to create a new instance each time or the generate() methods may
    // overlap themselves and cause a crash
    // WorldGeneratorAcademy gen = new WorldGeneratorAcademy();
    FossilWaterStructureGenerator gen = new FossilWaterStructureGenerator();
    int struct; // This will store a random index of the structure to
    // generate
    struct = rand.nextInt(gen.structures.size());
    int x = chunkX + rand.nextInt(16);
    int z = chunkZ + rand.nextInt(16);
    // nice way of getting a height to work from; it returns the topmost
    // non-air block at an x/z position, such as tall grass, dirt or leaves
    int y = world.getHeightValue(x, z);

    // find ground level, ignoring blocks such as grass and water

    while ((!world.doesBlockHaveSolidTopSurface(world, x, y, z)) // && y >
    // world.provider.getAverageGroundLevel())
    // && (!world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z + 11))
    ) {
      --y;
    }

    if (!world.doesBlockHaveSolidTopSurface(world, x, y, z)
        || (Block.getIdFromBlock(world.getBlock(x, y + 2, z)) != Block.getIdFromBlock(Blocks.water))
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z + 11))
    // && world.canBlockSeeTheSky(x, y, z)
    ) {
      return;
    } else {
      Revival.Console("Gen: Shipwreck Spawn at " + x + ", " + y + ", " + z);
    }

    int widthX = ((Structure) gen.structures.get(struct)).getWidthX();
    int widthZ = ((Structure) gen.structures.get(struct)).getWidthZ();
    int height = ((Structure) gen.structures.get(struct)).getHeight();
    // Set structure and random facing, then generate; no offset needed here
    gen.setStructure((Structure) gen.structures.get(struct));
    gen.setStructureFacing(rand.nextInt(4));
    gen.generate(world, rand, x, y - (rand.nextInt(3) + 3), z);
  }
  public void rRemoveEmeralds(World world, Random rand, int chunkX, int chunkZ) {
    int endX = (chunkX * 16) + 16;
    int endZ = (chunkZ * 16) + 16;
    boolean enableDebugging = ConfigRTG.enableDebugging;

    // Get the highest possible existing block location.
    int maxY = world.getHeightValue(chunkX, chunkZ);

    for (int x = chunkX * 16; x < endX; ++x) {
      for (int z = chunkZ * 16; z < endZ; ++z) {
        for (int y = 0; y < maxY; ++y) {
          if (world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, emeraldEmeraldBlock)) {

            world.setBlock(x, y, z, emeraldStoneBlock, emeraldStoneMeta, 2);

            if (enableDebugging) {
              FMLLog.log(Level.INFO, "Emerald replaced at %d, %d, %d", x, y, z);
            }
          }
        }
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    // rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    float l = simplex.noise2(chunkX / 100f, chunkY / 100f) * 6f + 0.8f;

    if (l > 0f && rand.nextInt(6) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);

      Block log;
      byte logMeta;

      log = Blocks.log;
      logMeta = (byte) 0;

      (new WorldGenLog(log, logMeta, Blocks.leaves, -1, 3 + rand.nextInt(3)))
          .generate(world, rand, x22, y22, z22);
    }

    rDecorateSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    float l = simplex.noise2(chunkX / 80f, chunkY / 80f) * 60f - 15f;

    for (int b1 = 0; b1 < 2 * strength; b1++) {
      if (rand.nextInt(2) == 0) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 230) {
          if (rand.nextInt(32) == 0) {
            WorldGenerator worldgenerator = TreeGen.greatOak(rand);
            worldgenerator.setScale(1.0D, 1.0D, 1.0D);
            worldgenerator.generate(world, rand, j6, z52, k10);
          } else {
            WorldGenerator worldgenerator = TreeGen.birch();
            worldgenerator.setScale(1.0D, 1.0D, 1.0D);
            worldgenerator.generate(world, rand, j6, z52, k10);
          }
        }
      }
    }

    if (l > 5f) {
      for (int b2 = 0; b2 < 4f * strength; b2++) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 220) {
          WorldGenerator worldgenerator =
              rand.nextInt(2) == 0
                  ? TreeGen.birch()
                  : rand.nextInt(10) != 0
                      ? new WorldGenTrees(false)
                      : new WorldGenForest(false, false);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }
    }

    if (rand.nextInt((int) (32f / strength)) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      if (y22 < 100) {
        if (rand.nextBoolean()) {
          (new WorldGenLog(Blocks.log, 0, Blocks.leaves, -1, 3 + rand.nextInt(4)))
              .generate(world, rand, x22, y22, z22);
        } else {
          (new WorldGenLog(Blocks.log, 2, Blocks.leaves, -1, 3 + rand.nextInt(4)))
              .generate(world, rand, x22, y22, z22);
        }
      }
    }

    for (int f24 = 0; f24 < 3f * strength; f24++) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (k1 < 110) {
        (new WorldGenTreeShrub(rand.nextInt(4) + 1, 0, rand.nextInt(3)))
            .generate(world, rand, i1, k1, j1);
      }
    }

    for (int f23 = 0; f23 < 8f * strength; f23++) {
      int j15 = chunkX + rand.nextInt(16) + 8;
      int j17 = rand.nextInt(128);
      int j20 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenFlowers(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}))
          .generate(world, rand, j15, j17, j20);
    }

    for (int l14 = 0; l14 < 12f * strength; l14++) {
      int l19 = chunkX + rand.nextInt(16) + 8;
      int k22 = rand.nextInt(128);
      int j24 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
    }
  }
Exemple #17
0
  @Override
  public boolean generate(World world, Random random, int i, int j, int k) {
    int width = random.nextInt(4) + 6;
    int depth = random.nextInt(2) + 5;

    int x2;
    int z2;

    int height = world.getHeightValue(i, k);
    if (world.getHeightValue(i + width, k + depth) >= height) {
      x2 = i + width;
      z2 = k + depth;
    } else if (world.getHeightValue(i - width, k + depth) >= height) {
      x2 = i - width;
      z2 = k + depth;
    } else if (world.getHeightValue(i + width, k - depth) >= height) {
      x2 = i + width;
      z2 = k - depth;
    } else if (world.getHeightValue(i - width, k - depth) >= height) {
      x2 = i - width;
      z2 = k - depth;
    } else {
      return false;
    }

    for (int x = Math.min(x2, i); x <= Math.max(x2, i); x++) {
      for (int z = Math.min(z2, k); z <= Math.max(z2, k); z++) {
        int wallHeight = random.nextInt(4);
        for (int y = -1; y < 15; y++) {
          if (x == x2 || z == z2 || x == i || z == k || y == -1) {
            if (y < wallHeight) {
              if (random.nextFloat() > 0.1) {
                world.setBlock(x, y + height, z, Atum.atumLargeBrick.blockID);
              } else {
                world.setBlock(x, y + height, z, Atum.atumSmallBrick.blockID);
              }
            } else if (y == wallHeight) {
              if (random.nextFloat() > 0.7) {
                if (random.nextFloat() > 0.1) {
                  world.setBlock(x, y + height, z, Atum.atumSlabs.blockID, 2, 0);
                } else {
                  world.setBlock(x, y + height, z, Atum.atumSlabs.blockID, 3, 0);
                }
              }
            }
          } else {
            world.setBlockToAir(x, y + height, z);
          }
        }
      }
    }

    int chestX = width / 2 + i;
    int chestZ = Math.max(z2, k) - 1;
    int meta = 0;
    if (random.nextFloat() > 0.5) {
      chestX = random.nextInt(width - 1) + 1 + Math.min(i, x2);
      if (random.nextFloat() > 0.5) {
        chestZ = Math.max(z2, k) - 1;
        meta = 3;
      } else {
        chestZ = Math.min(z2, k) + 1;
        meta = 1;
      }
    } else {
      chestZ = random.nextInt(depth - 1) + 1 + Math.min(k, z2);
      if (random.nextFloat() > 0.5) {
        chestX = Math.max(x2, i) - 1;
        meta = 2;
      } else {
        chestX = Math.min(x2, i) + 1;
        meta = 4;
      }
    }
    int chestY = world.getHeightValue(chestX, chestZ);
    world.setBlock(chestX, chestY, chestZ, Atum.cursedChest.blockID, 0, 2);
    IInventory chest = (IInventory) world.getBlockTileEntity(chestX, chestY, chestZ);
    AtumLoot.fillChest(chest, 5, 0.5F);

    return false;
  }
  public void rPopulatePreDecorate(
      IChunkProvider ichunkprovider,
      World worldObj,
      Random rand,
      int chunkX,
      int chunkZ,
      boolean flag) {
    int worldX = chunkX * 16;
    int worldZ = chunkZ * 16;
    boolean gen = true;

    gen =
        TerrainGen.populate(
            ichunkprovider,
            worldObj,
            rand,
            chunkX,
            chunkZ,
            flag,
            PopulateChunkEvent.Populate.EventType.LAKE);

    // Underground water lakes.
    if (ConfigRTG.enableWaterUndergroundLakes) {

      if (gen && (waterUndergroundLakeChance > 0)) {

        int i2 = worldX + rand.nextInt(16) + 8;
        int l4 = RandomUtil.getRandomInt(rand, 1, 50);
        int i8 = worldZ + rand.nextInt(16) + 8;

        if (rand.nextInt(waterUndergroundLakeChance) == 0
            && (RandomUtil.getRandomInt(rand, 1, ConfigRTG.waterUndergroundLakeChance) == 1)) {

          (new WorldGenLakes(Blocks.water)).generate(worldObj, rand, i2, l4, i8);
        }
      }
    }

    // Surface water lakes.
    if (ConfigRTG.enableWaterSurfaceLakes) {

      if (gen && (waterSurfaceLakeChance > 0)) {

        int i2 = worldX + rand.nextInt(16) + 8;
        int i8 = worldZ + rand.nextInt(16) + 8;
        int l4 = worldObj.getHeightValue(i2, i8);

        // Surface lakes.
        if (rand.nextInt(waterSurfaceLakeChance) == 0
            && (RandomUtil.getRandomInt(rand, 1, ConfigRTG.waterSurfaceLakeChance) == 1)) {

          if (l4 > 63) {

            (new WorldGenLakes(Blocks.water)).generate(worldObj, rand, i2, l4, i8);
          }
        }
      }
    }

    gen =
        TerrainGen.populate(
            ichunkprovider,
            worldObj,
            rand,
            chunkX,
            chunkZ,
            flag,
            PopulateChunkEvent.Populate.EventType.LAVA);

    // Underground lava lakes.
    if (ConfigRTG.enableLavaUndergroundLakes) {

      if (gen && (lavaUndergroundLakeChance > 0)) {

        int i2 = worldX + rand.nextInt(16) + 8;
        int l4 = RandomUtil.getRandomInt(rand, 1, 50);
        int i8 = worldZ + rand.nextInt(16) + 8;

        if (rand.nextInt(lavaUndergroundLakeChance) == 0
            && (RandomUtil.getRandomInt(rand, 1, ConfigRTG.lavaUndergroundLakeChance) == 1)) {

          (new WorldGenLakes(Blocks.lava)).generate(worldObj, rand, i2, l4, i8);
        }
      }
    }

    // Surface lava lakes.
    if (ConfigRTG.enableLavaSurfaceLakes) {

      if (gen && (lavaSurfaceLakeChance > 0)) {

        int i2 = worldX + rand.nextInt(16) + 8;
        int i8 = worldZ + rand.nextInt(16) + 8;
        int l4 = worldObj.getHeightValue(i2, i8);

        // Surface lakes.
        if (rand.nextInt(lavaSurfaceLakeChance) == 0
            && (RandomUtil.getRandomInt(rand, 1, ConfigRTG.lavaSurfaceLakeChance) == 1)) {

          if (l4 > 63) {

            (new WorldGenLakes(Blocks.lava)).generate(worldObj, rand, i2, l4, i8);
          }
        }
      }
    }

    if (ConfigRTG.generateDungeons) {

      gen =
          TerrainGen.populate(
              ichunkprovider,
              worldObj,
              rand,
              chunkX,
              chunkZ,
              flag,
              PopulateChunkEvent.Populate.EventType.DUNGEON);
      for (int k1 = 0; k1 < 8 && gen; k1++) {
        int j5 = worldX + rand.nextInt(16) + 8;
        int k8 = rand.nextInt(128);
        int j11 = worldZ + rand.nextInt(16) + 8;

        (new WorldGenDungeons()).generate(worldObj, rand, j5, k8, j11);
      }
    }
  }
  public void populate(IChunkProvider ichunkprovider, int i, int j) {
    BlockSand.fallInstantly = true;
    int k = i * 16;
    int l = j * 16;
    BiomeGenBase biomegenbase = worldObj_16.getWorldChunkManager().getBiomeGenAt(k + 16, l + 16);
    field_913_j.setSeed(worldObj_16.getSeed());
    long l1 = (field_913_j.nextLong() / 2L) * 2L + 1L;
    long l2 = (field_913_j.nextLong() / 2L) * 2L + 1L;
    field_913_j.setSeed((long) i * l1 + (long) j * l2 ^ worldObj_16.getSeed());
    double d = 0.25D;

    MinecraftForge.EVENT_BUS.post(
        new PopulateChunkEvent.Pre(ichunkprovider, worldObj_16, field_913_j, i, j, false));

    if (mapFeaturesEnabled) {
      strongholdGenerator.generateStructuresInChunk(worldObj_16, field_913_j, i, j);
    }

    if (field_913_j.nextInt(4) == 0) {
      int i111 = k + field_913_j.nextInt(16) + 8;
      int l44 = field_913_j.nextInt(128);
      int i88 = l + field_913_j.nextInt(16) + 8;
      (new BWG4oldGenLakes(Block.waterStill.blockID))
          .generate(worldObj_16, field_913_j, i111, l44, i88);
    }
    if (field_913_j.nextInt(8) == 0) {
      int j111 = k + field_913_j.nextInt(16) + 8;
      int i55 = field_913_j.nextInt(field_913_j.nextInt(120) + 8);
      int j88 = l + field_913_j.nextInt(16) + 8;
      if (i55 < 64 || field_913_j.nextInt(10) == 0) {
        (new BWG4oldGenLakes(Block.lavaStill.blockID))
            .generate(worldObj_16, field_913_j, j111, i55, j88);
      }
    }

    for (int i1 = 0; i1 < 8; i1++) {
      int i4 = k + field_913_j.nextInt(16) + 8;
      int k6 = field_913_j.nextInt(128);
      int l8 = l + field_913_j.nextInt(16) + 8;
      (new BWG4decoDungeons(3, true, false, false)).generate(worldObj_16, field_913_j, i4, k6, l8);
    }

    for (int j1 = 0; j1 < 10; j1++) {
      int j4 = k + field_913_j.nextInt(16);
      int l6 = field_913_j.nextInt(128);
      int i9 = l + field_913_j.nextInt(16);
      (new BWG4oldGenClay(32, 1)).generate(worldObj_16, field_913_j, j4, l6, i9);
    }

    for (int k1 = 0; k1 < 20; k1++) {
      int k4 = k + field_913_j.nextInt(16);
      int i7 = field_913_j.nextInt(128);
      int j9 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.dirt.blockID, 32, 1))
          .generate(worldObj_16, field_913_j, k4, i7, j9);
    }

    for (int i2 = 0; i2 < 10; i2++) {
      int l4 = k + field_913_j.nextInt(16);
      int j7 = field_913_j.nextInt(128);
      int k9 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.gravel.blockID, 32, 1))
          .generate(worldObj_16, field_913_j, l4, j7, k9);
    }

    for (int j2 = 0; j2 < 20; j2++) {
      int i5 = k + field_913_j.nextInt(16);
      int k7 = field_913_j.nextInt(128);
      int l9 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.oreCoal.blockID, 16, 1))
          .generate(worldObj_16, field_913_j, i5, k7, l9);
    }

    for (int k2 = 0; k2 < 20; k2++) {
      int j5 = k + field_913_j.nextInt(16);
      int l7 = field_913_j.nextInt(64);
      int i10 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.oreIron.blockID, 8, 1))
          .generate(worldObj_16, field_913_j, j5, l7, i10);
    }

    for (int i3 = 0; i3 < 2; i3++) {
      int k5 = k + field_913_j.nextInt(16);
      int i8 = field_913_j.nextInt(32);
      int j10 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.oreGold.blockID, 8, 1))
          .generate(worldObj_16, field_913_j, k5, i8, j10);
    }

    for (int j3 = 0; j3 < 8; j3++) {
      int l5 = k + field_913_j.nextInt(16);
      int j8 = field_913_j.nextInt(16);
      int k10 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.oreRedstone.blockID, 7, 1))
          .generate(worldObj_16, field_913_j, l5, j8, k10);
    }

    for (int k3 = 0; k3 < 1; k3++) {
      int i6 = k + field_913_j.nextInt(16);
      int k8 = field_913_j.nextInt(16);
      int l10 = l + field_913_j.nextInt(16);
      (new BWG4oldGenMinable(Block.oreDiamond.blockID, 7, 1))
          .generate(worldObj_16, field_913_j, i6, k8, l10);
    }

    d = 0.5D;
    int l3 =
        (int)
            ((field_920_c.func_806_a((double) k * d, (double) l * d) / 8D
                    + field_913_j.nextDouble() * 4D
                    + 4D)
                / 3D);
    int j6 = 0;
    if (field_913_j.nextInt(10) == 0) {
      j6++;
    }
    if (biomegenbase == BiomeGenBase.ALPHAforest) {
      j6 += l3 + 5;
    }
    if (biomegenbase == BiomeGenBase.ALPHArainforest) {
      j6 += l3 + 5;
    }
    if (biomegenbase == BiomeGenBase.ALPHAseasonalForest) {
      j6 += l3 + 2;
    }
    if (biomegenbase == BiomeGenBase.ALPHAtaiga) {
      j6 += l3 + 5;
    }
    if (biomegenbase == BiomeGenBase.ALPHAdesert) {
      j6 -= 20;
    }
    if (biomegenbase == BiomeGenBase.ALPHAtundra) {
      j6 -= 20;
    }
    if (biomegenbase == BiomeGenBase.ALPHAplains) {
      j6 -= 20;
    }
    Object obj = new BWG4oldGenTrees(1);
    if (field_913_j.nextInt(10) == 0) {
      obj = new BWG4oldGenBigTree(1);
    }
    if (biomegenbase == BiomeGenBase.ALPHArainforest && field_913_j.nextInt(3) == 0) {
      obj = new BWG4oldGenBigTree(1);
    }
    for (int i11 = 0; i11 < j6; i11++) {
      int i13 = k + field_913_j.nextInt(16) + 8;
      int l15 = l + field_913_j.nextInt(16) + 8;
      ((WorldGenerator) (obj)).setScale(1.0D, 1.0D, 1.0D);
      ((WorldGenerator) (obj))
          .generate(worldObj_16, field_913_j, i13, worldObj_16.getHeightValue(i13, l15), l15);
    }

    for (int j11 = 0; j11 < 2; j11++) {
      int j13 = k + field_913_j.nextInt(16) + 8;
      int i16 = field_913_j.nextInt(128);
      int k18 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenFlowers(Block.plantYellow.blockID))
          .generate(worldObj_16, field_913_j, j13, i16, k18);
    }

    if (field_913_j.nextInt(2) == 0) {
      int k11 = k + field_913_j.nextInt(16) + 8;
      int k13 = field_913_j.nextInt(128);
      int j16 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenFlowers(Block.plantRed.blockID))
          .generate(worldObj_16, field_913_j, k11, k13, j16);
    }
    if (field_913_j.nextInt(4) == 0) {
      int l11 = k + field_913_j.nextInt(16) + 8;
      int l13 = field_913_j.nextInt(128);
      int k16 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenFlowers(Block.mushroomBrown.blockID))
          .generate(worldObj_16, field_913_j, l11, l13, k16);
    }
    if (field_913_j.nextInt(8) == 0) {
      int i12 = k + field_913_j.nextInt(16) + 8;
      int i14 = field_913_j.nextInt(128);
      int l16 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenFlowers(Block.mushroomRed.blockID))
          .generate(worldObj_16, field_913_j, i12, i14, l16);
    }
    for (int j12 = 0; j12 < 10; j12++) {
      int j14 = k + field_913_j.nextInt(16) + 8;
      int i17 = field_913_j.nextInt(128);
      int l18 = l + field_913_j.nextInt(16) + 8;
      (new BWG4oldGenReed()).generate(worldObj_16, field_913_j, j14, i17, l18);
    }

    if (field_913_j.nextInt(32) == 0) {
      int k12 = k + field_913_j.nextInt(16) + 8;
      int k14 = field_913_j.nextInt(128);
      int j17 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenPumpkin()).generate(worldObj_16, field_913_j, k12, k14, j17);
    }
    int l12 = 0;
    if (biomegenbase == BiomeGenBase.ALPHAdesert) {
      l12 += 10;
    }
    for (int l14 = 0; l14 < l12; l14++) {
      int k17 = k + field_913_j.nextInt(16) + 8;
      int i19 = field_913_j.nextInt(128);
      int i20 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenCactus()).generate(worldObj_16, field_913_j, k17, i19, i20);
    }

    for (int i15 = 0; i15 < 50; i15++) {
      int l17 = k + field_913_j.nextInt(16) + 8;
      int j19 = field_913_j.nextInt(field_913_j.nextInt(120) + 8);
      int j20 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenLiquids(Block.waterMoving.blockID))
          .generate(worldObj_16, field_913_j, l17, j19, j20);
    }

    for (int j15 = 0; j15 < 20; j15++) {
      int i18 = k + field_913_j.nextInt(16) + 8;
      int k19 = field_913_j.nextInt(field_913_j.nextInt(field_913_j.nextInt(112) + 8) + 8);
      int k20 = l + field_913_j.nextInt(16) + 8;
      (new WorldGenLiquids(Block.lavaMoving.blockID))
          .generate(worldObj_16, field_913_j, i18, k19, k20);
    }

    SpawnerAnimals.performWorldGenSpawning(
        worldObj_16, biomegenbase, k + 8, l + 8, 16, 16, field_913_j);

    field_4178_w = BWG4WorldChunkManager.getColdTemperatures(field_4178_w, k + 8, l + 8, 16, 16);
    for (int k15 = k + 8; k15 < k + 8 + 16; k15++) {
      for (int j18 = l + 8; j18 < l + 8 + 16; j18++) {
        int l19 = k15 - (k + 8);
        int l20 = j18 - (l + 8);
        int i21 = worldObj_16.getPrecipitationHeight(k15, j18);
        double d1 =
            field_4178_w[l19 * 16 + l20] - ((double) (i21 - 64) / 64D) * 0.29999999999999999D;
        if (d1 < 0.5D && i21 > 0 && i21 < 128 && worldObj_16.isAirBlock(k15, i21, j18)) {
          if (worldObj_16.getBlockMaterial(k15, i21 - 1, j18).blocksMovement()
              && worldObj_16.getBlockMaterial(k15, i21 - 1, j18) != Material.ice) {
            worldObj_16.setBlock(k15, i21, j18, Block.snow.blockID, 0, 2);
          } else if (worldObj_16.getBlockMaterial(k15, i21 - 1, j18) == Material.water) {
            worldObj_16.setBlock(k15, i21 - 1, j18, Block.ice.blockID, 0, 2);
          }
        }
      }
    }

    MinecraftForge.EVENT_BUS.post(
        new PopulateChunkEvent.Post(ichunkprovider, worldObj_16, field_913_j, i, j, false));

    BlockSand.fallInstantly = false;
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    for (int i23 = 0; i23 < 1; i23++) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);

      if (k1 < 80) {
        (new WorldGenBlockBlob(Blocks.cobblestone, 0)).generate(world, rand, i1, k1, j1);
      }
    }

    if (river > 0.7f) {
      if (river > 0.86f) {
        for (int b33 = 0; b33 < 10f * strength; b33++) {
          int j6 = chunkX + rand.nextInt(16) + 8;
          int k10 = chunkY + rand.nextInt(16) + 8;
          int z52 = world.getHeightValue(j6, k10);

          if (z52 < 100f || (z52 < 120f && rand.nextInt(10) == 0)) {
            WorldGenerator worldgenerator =
                rand.nextInt(4) != 0 ? new WorldGenShrub(0, 0) : new WorldGenTreeSavanna(1);
            worldgenerator.setScale(1.0D, 1.0D, 1.0D);
            worldgenerator.generate(world, rand, j6, z52, k10);
          }
        }
      }

      for (int k18 = 0; k18 < 12f * strength; k18++) {
        int k21 = chunkX + rand.nextInt(16) + 8;
        int j23 = rand.nextInt(160);
        int k24 = chunkY + rand.nextInt(16) + 8;
        if (j23 < 120f) {
          (new WorldGenCacti(false)).generate(world, rand, k21, j23, k24);
        }
      }

      for (int f25 = 0; f25 < 2f * strength; f25++) {
        int i18 = chunkX + rand.nextInt(16) + 8;
        int i23 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenReed()).generate(world, rand, i18, 60 + rand.nextInt(8), i23);
      }

      if (rand.nextInt(28) == 0) {
        int j16 = chunkX + rand.nextInt(16) + 8;
        int j18 = rand.nextInt(128);
        int j21 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21);
      }

      for (int f23 = 0; f23 < 3; f23++) {
        int j15 = chunkX + rand.nextInt(16) + 8;
        int j17 = rand.nextInt(128);
        int j20 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenFlowers(new int[] {9, 9, 9, 9, 3, 3, 3, 3, 3, 2, 2, 2, 11, 11, 11}))
            .generate(world, rand, j15, j17, j20);
      }

      for (int l14 = 0; l14 < 15; l14++) {
        int l19 = chunkX + rand.nextInt(16) + 8;
        int k22 = rand.nextInt(128);
        int j24 = chunkY + rand.nextInt(16) + 8;

        if (rand.nextInt(3) == 0) {
          (new WorldGenGrass(Blocks.double_plant, 2)).generate(world, rand, l19, k22, j24);
        } else {
          (new WorldGenGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
        }
      }
    } else {
      int a = 6 - (int) (simplex.noise2(chunkX / 100f, chunkY / 100f) * 10);
      if (a < 1 || rand.nextInt(a) == 0) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 100f || (z52 < 120f && rand.nextInt(10) == 0)) {
          WorldGenerator worldgenerator =
              rand.nextInt(14) != 0 ? new WorldGenShrub(0, 0) : new WorldGenTreeSavanna(1);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }

      for (int k18 = 0; k18 < 70; k18++) {
        int k21 = chunkX + rand.nextInt(16) + 8;
        int j23 = 64 + rand.nextInt(64);
        int k24 = chunkY + rand.nextInt(16) + 8;
        if (j23 < 120f) {
          (new WorldGenCacti(false)).generate(world, rand, k21, j23, k24);
        }
      }

      if (rand.nextInt((int) (3f / strength)) == 0) {
        int i18 = chunkX + rand.nextInt(16) + 8;
        int i23 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenReed()).generate(world, rand, i18, 60 + rand.nextInt(8), i23);
      }

      if (rand.nextInt(28) == 0) {
        int j16 = chunkX + rand.nextInt(16) + 8;
        int j18 = rand.nextInt(128);
        int j21 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21);
      }

      for (int f23 = 0; f23 < 3; f23++) {
        int j15 = chunkX + rand.nextInt(16) + 8;
        int j17 = rand.nextInt(128);
        int j20 = chunkY + rand.nextInt(16) + 8;
        (new WorldGenFlowers(new int[] {9, 9, 9, 9, 3, 3, 3, 3, 3, 2, 2, 2, 11, 11, 11}))
            .generate(world, rand, j15, j17, j20);
      }

      for (int l14 = 0; l14 < 15; l14++) {
        int l19 = chunkX + rand.nextInt(16) + 8;
        int k22 = rand.nextInt(128);
        int j24 = chunkY + rand.nextInt(16) + 8;

        if (rand.nextInt(3) == 0) {
          (new WorldGenGrass(Blocks.double_plant, 2)).generate(world, rand, l19, k22, j24);
        } else {
          (new WorldGenGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
        }
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      PerlinNoise perlin,
      CellNoise cell,
      float strength,
      float river) {
    if (rand.nextInt((int) (15f / strength)) == 0) {
      int i2 = chunkX + rand.nextInt(16) + 8;
      int i8 = chunkY + rand.nextInt(16) + 8;
      int l4 = world.getHeightValue(i2, i8);
      if (l4 > 63 && l4 < 105) {
        (new WorldGenLakes(Blocks.water)).generate(world, rand, i2, l4, i8);
      }
    }

    for (int l = 0; l < 6f * strength; ++l) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (k1 < 95 && (k1 < 64 || rand.nextInt(15) == 0)) {
        (new DecoBlob(Blocks.mossy_cobblestone, 0)).generate(world, rand, i1, k1, j1);
      }
    }

    if (rand.nextInt((int) (25f / strength)) == 0) {
      int j16 = chunkX + rand.nextInt(16) + 8;
      int j18 = rand.nextInt(128);
      int j21 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21);
    }

    for (int f23 = 0; f23 < 2f * strength; f23++) {
      int j15 = chunkX + rand.nextInt(16) + 8;
      int j17 = rand.nextInt(128);
      int j20 = chunkY + rand.nextInt(16) + 8;
      (new DecoFlowers(new int[] {9, 0, 3})).generate(world, rand, j15, j17, j20);
    }

    for (int l14 = 0; l14 < 3f * strength; l14++) {
      int l19 = chunkX + rand.nextInt(16) + 8;
      int k22 = rand.nextInt(128);
      int j24 = chunkY + rand.nextInt(16) + 8;
      (new DecoGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
    }

    // trees
    float l = perlin.noise2(chunkX / 100f, chunkY / 100f) * 5f - 0.5f;
    for (int b1 = 0; b1 < l * 2f * strength; b1++) {
      int j6 = chunkX + rand.nextInt(16) + 8;
      int k10 = chunkY + rand.nextInt(16) + 8;
      int z52 = world.getHeightValue(j6, k10);

      if (z52 < 75) {
        WorldGenerator worldgenerator =
            rand.nextInt(8) != 0
                ? new DecoSmallSpruce(1 + rand.nextInt(2))
                : new DecoSmallPine(1 + rand.nextInt(3), 2 + rand.nextInt(4));
        worldgenerator.setScale(1.0D, 1.0D, 1.0D);
        worldgenerator.generate(world, rand, j6, z52, k10);
      } else if (z52 < 110) {
        WorldGenerator worldgenerator =
            rand.nextInt(4) != 0
                ? new DecoSmallSpruce(rand.nextInt(2))
                : new DecoSmallPine(2 + rand.nextInt(2), 4 + rand.nextInt(5));
        worldgenerator.setScale(1.0D, 1.0D, 1.0D);
        worldgenerator.generate(world, rand, j6, z52, k10);
      }
    }

    if (l > -0.4f) {
      for (int b = 0; b < 2f * strength; b++) {
        int i1 = chunkX + rand.nextInt(16) + 8;
        int j1 = chunkY + rand.nextInt(16) + 8;
        int k1 = world.getHeightValue(i1, j1);
        if (k1 < 110) {
          if (rand.nextInt(10) == 0) {
            (new DecoShrub(rand.nextInt(5) + 4, rand.nextInt(2), rand.nextInt(2)))
                .generate(world, rand, i1, k1, j1);
          } else {
            (new DecoShrub(rand.nextInt(4) + 1, rand.nextInt(2), rand.nextInt(2)))
                .generate(world, rand, i1, k1, j1);
          }
        }
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    // boulders
    for (int l = 0; l < 3f * strength; ++l) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);

      if (k1 < 95 && rand.nextInt(16) == 0) {
        (new WorldGenBlob(Blocks.mossy_cobblestone, 0, rand)).generate(world, rand, i1, k1, j1);
      }
    }

    // trees
    float l = simplex.noise2(chunkX / 100f, chunkY / 100f) * 6f + 0.8f;
    for (int b1 = 0; b1 < l * 4f * strength; b1++) {
      int j6 = chunkX + rand.nextInt(16) + 8;
      int k10 = chunkY + rand.nextInt(16) + 8;
      int z52 = world.getHeightValue(j6, k10);

      if (rand.nextInt(24) == 0) {
        // WorldGenerator worldgenerator = new WorldGenTreeSpruceSmall(1 + rand.nextInt(2));
        WorldGenerator worldgenerator = new WorldGenTreePineEuro();
        worldgenerator.setScale(1.0D, 1.0D, 1.0D);
        worldgenerator.generate(world, rand, j6, z52, k10);
      }
    }

    if (l > 0f && rand.nextInt(6) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      (new WorldGenLog(1, 3 + rand.nextInt(4), false)).generate(world, rand, x22, y22, z22);
    }

    for (int b = 0; b < 2f * strength; b++) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (rand.nextInt(10) == 0) {
        (new WorldGenTreeShrub(rand.nextInt(5) + 4, rand.nextInt(2), rand.nextInt(2)))
            .generate(world, rand, i1, k1, j1);
      } else {
        (new WorldGenTreeShrub(rand.nextInt(4) + 1, rand.nextInt(2), rand.nextInt(2)))
            .generate(world, rand, i1, k1, j1);
      }
    }

    if (rand.nextInt((int) (3f / strength)) == 0) {
      int k15 = chunkX + rand.nextInt(16) + 8;
      int k17 = rand.nextInt(64) + 64;
      int k20 = chunkY + rand.nextInt(16) + 8;

      if (rand.nextBoolean()) {
        (new WorldGenFlowers(Blocks.brown_mushroom)).generate(world, rand, k15, k17, k20);
      } else {
        (new WorldGenFlowers(Blocks.red_mushroom)).generate(world, rand, k15, k17, k20);
      }
    }

    if (rand.nextInt((int) (20f / strength)) == 0) {
      int j16 = chunkX + rand.nextInt(16) + 8;
      int j18 = rand.nextInt(128);
      int j21 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21);
    }

    for (int l14 = 0; l14 < 10f * strength; l14++) {
      int l19 = chunkX + rand.nextInt(16) + 8;
      int k22 = rand.nextInt(128);
      int j24 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    // rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    float l = simplex.noise2(chunkX / 80f, chunkY / 80f) * 60f - 15f;
    // float l = simplex.noise3(chunkX / 80f, chunkY / 80f, simplex.noise2(chunkX / 60f, chunkY /
    // 60f)) * 60f - 15f;

    for (int l1 = 0; l1 < 2f * strength; ++l1) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);

      if (k1 < 80 && rand.nextInt(20) == 0) {
        if (rand.nextInt(8) != 0) {
          (new WorldGenBlob(Blocks.mossy_cobblestone, 0, rand)).generate(world, rand, i1, k1, j1);
        } else {
          (new WorldGenBlob(Blocks.web, 0, rand)).generate(world, rand, i1, k1, j1);
        }
      }
    }

    if (l > 0f) {
      for (int b2 = 0; b2 < 24f * strength; b2++) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 120) {
          WorldGenerator worldgenerator =
              new WorldGenTreeMangrove(
                  Blocks.log2,
                  1,
                  Blocks.leaves2,
                  1,
                  9 + rand.nextInt(5),
                  3 + rand.nextInt(2),
                  13f,
                  3,
                  0.32f,
                  0.1f);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }
    }

    if (rand.nextInt((int) (10f / strength)) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      if (y22 < 100) {
        (new WorldGenLog(Blocks.log2, 1, Blocks.leaves2, -1, 9 + rand.nextInt(5)))
            .generate(world, rand, x22, y22, z22);
      }
    }

    for (int f24 = 0; f24 < strength; f24++) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (k1 < 110) {
        (new WorldGenTreeShrub(rand.nextInt(4) + 1, 0, rand.nextInt(3)))
            .generate(world, rand, i1, k1, j1);
      }
    }

    if (TerrainGen.decorate(world, rand, chunkX, chunkY, GRASS)) {

      for (int l14 = 0; l14 < 10f * strength; l14++) {
        int l19 = chunkX + rand.nextInt(16) + 8;
        int k22 = rand.nextInt(128);
        int j24 = chunkY + rand.nextInt(16) + 8;
        int grassMeta;

        if (rand.nextInt(16) == 0) {
          grassMeta = 0;
        } else {
          grassMeta = 1;
        }

        (new WorldGenGrass(Blocks.tallgrass, grassMeta)).generate(world, rand, l19, k22, j24);
      }

      for (int l14 = 0; l14 < 8f * strength; l14++) {
        int l19 = chunkX + rand.nextInt(16) + 8;
        int k22 = rand.nextInt(128);
        int j24 = chunkY + rand.nextInt(16) + 8;

        if (rand.nextInt(6) == 0) {
          (new WorldGenGrass(Blocks.double_plant, RandomUtil.getRandomInt(rand, 2, 3)))
              .generate(world, rand, l19, k22, j24);
        }
      }

      for (int l14 = 0; l14 < 4f * strength; l14++) {
        int l19 = chunkX + rand.nextInt(16) + 8;
        int k22 = rand.nextInt(128);
        int j24 = chunkY + rand.nextInt(16) + 8;
        int grassMeta;

        if (rand.nextInt(16) == 0) {
          grassMeta = 0;
        } else {
          grassMeta = RandomUtil.getRandomInt(rand, 1, 2);
        }

        (new WorldGenGrass(Blocks.tallgrass, grassMeta)).generate(world, rand, l19, k22, j24);
      }
    }

    rDecorateSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    int k15 = chunkX + rand.nextInt(16) + 8;
    int k20 = chunkY + rand.nextInt(16) + 8;
    int k17 = world.getHeightValue(k15, k20);

    if (rand.nextBoolean()) {
      (new WorldGenFlowers(Blocks.brown_mushroom)).generate(world, rand, k15, k17, k20);
    } else {
      (new WorldGenFlowers(Blocks.red_mushroom)).generate(world, rand, k15, k17, k20);
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      PerlinNoise perlin,
      CellNoise cell,
      float strength,
      float river) {
    if (rand.nextInt((int) (2f / strength)) == 0) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);
      if (k1 < 85) {
        (new DecoBlob(Blocks.cobblestone, 0)).generate(world, rand, i1, k1, j1);
      }
    }

    float t = perlin.noise2(chunkX / 30f, chunkY / 30f) * 8f;
    t = t > 4f ? 4f : t;

    if (t > 0f) {
      if (rand.nextInt((int) ((10f - t) / strength)) == 0) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 82) {
          WorldGenerator worldgenerator =
              new DecoJungleTall(
                  Blocks.log,
                  2,
                  Blocks.leaves,
                  2,
                  6 + rand.nextInt(4),
                  3 + rand.nextInt(2),
                  9f + rand.nextFloat() * 4f,
                  3,
                  0.32f,
                  0.1f);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }
    }

    if (river > 0.8f) {
      for (int b33 = 0; b33 < 8f * strength; b33++) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 82) {
          WorldGenerator worldgenerator =
              rand.nextInt(2) != 0 ? new WorldGenShrub(0, 0) : new DecoSavannah(1, false);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }
    } else {
      for (int b33 = 0; b33 < (1f + t) * strength; b33++) {
        int j6 = chunkX + rand.nextInt(16) + 8;
        int k10 = chunkY + rand.nextInt(16) + 8;
        int z52 = world.getHeightValue(j6, k10);

        if (z52 < 82) {
          WorldGenerator worldgenerator =
              rand.nextInt(6) != 0 ? new WorldGenShrub(0, 0) : new DecoSavannah(1, false);
          worldgenerator.setScale(1.0D, 1.0D, 1.0D);
          worldgenerator.generate(world, rand, j6, z52, k10);
        }
      }
    }

    if (rand.nextInt((int) (3f / strength)) == 0) {
      int i18 = chunkX + rand.nextInt(16) + 8;
      int i23 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenReed()).generate(world, rand, i18, 60 + rand.nextInt(8), i23);
    }

    if (rand.nextInt(28) == 0) {
      int j16 = chunkX + rand.nextInt(16) + 8;
      int j18 = rand.nextInt(128);
      int j21 = chunkY + rand.nextInt(16) + 8;
      (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21);
    }

    for (int f23 = 0; f23 < 3; f23++) {
      int j15 = chunkX + rand.nextInt(16) + 8;
      int j17 = rand.nextInt(128);
      int j20 = chunkY + rand.nextInt(16) + 8;
      (new DecoFlowers(new int[] {9, 9, 9, 9, 3, 3, 3, 3, 3, 2, 2, 2, 11, 11, 11}))
          .generate(world, rand, j15, j17, j20);
    }

    for (int k18 = 0; k18 < 26f * strength; k18++) {
      int k21 = chunkX + rand.nextInt(16) + 8;
      int j23 = 66 + rand.nextInt(20);
      int k24 = chunkY + rand.nextInt(16) + 8;
      (new DecoCacti(false)).generate(world, rand, k21, j23, k24);
    }

    for (int l14 = 0; l14 < 8f * strength; l14++) {
      int l19 = chunkX + rand.nextInt(16) + 8;
      int k22 = 60 + rand.nextInt(40);
      int j24 = chunkY + rand.nextInt(16) + 8;

      if (rand.nextInt(3) == 0) {
        (new DecoGrass(Blocks.double_plant, 2)).generate(world, rand, l19, k22, j24);
      } else {
        (new DecoGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24);
      }
    }
  }
  @Override
  public void rDecorate(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river) {

    /**
     * Using rDecorateSeedBiome() to partially decorate the biome? If so, then comment out this
     * method.
     */
    rOreGenSeedBiome(world, rand, chunkX, chunkY, simplex, cell, strength, river, baseBiome);

    for (int l = 0; l < 6f * strength; ++l) {
      int i1 = chunkX + rand.nextInt(16) + 8;
      int j1 = chunkY + rand.nextInt(16) + 8;
      int k1 = world.getHeightValue(i1, j1);

      if (k1 < 95 && rand.nextInt(16) == 0) {
        (new WorldGenBlob(Blocks.cobblestone, 0, rand)).generate(world, rand, i1, k1, j1);
      }
    }

    float l = simplex.noise2(chunkX / 100f, chunkY / 100f) * 12f + 4f;
    for (int b1 = 0; b1 < l * strength; b1++) {
      int j6 = chunkX + rand.nextInt(16) + 8;
      int k10 = chunkY + rand.nextInt(16) + 8;
      int z52 = world.getHeightValue(j6, k10);

      if (z52 < 90) {
        WorldGenerator worldgenerator =
            rand.nextInt(8) != 0
                ? new WorldGenTreePine(4, rand.nextInt(4) == 0 ? 1 : 0)
                : rand.nextInt(3) != 0
                    ? new WorldGenTreePineSmall(3 + rand.nextInt(6), 6 + rand.nextInt(8), 0)
                    : new WorldGenIceSpike();
        worldgenerator.setScale(1.0D, 1.0D, 1.0D);
        worldgenerator.generate(world, rand, j6, z52, k10);
      } else if (z52 < 120) {
        WorldGenerator worldgenerator =
            rand.nextInt(4) != 0
                ? new WorldGenTreePineSmall(
                    1 + rand.nextInt(3), 3 + rand.nextInt(5), rand.nextInt(2))
                : new WorldGenIceSpike();
        worldgenerator.setScale(1.0D, 1.0D, 1.0D);
        worldgenerator.generate(world, rand, j6, z52, k10);
      }
    }

    if (rand.nextInt((int) (12f / strength)) == 0) {
      int x22 = chunkX + rand.nextInt(16) + 8;
      int z22 = chunkY + rand.nextInt(16) + 8;
      int y22 = world.getHeightValue(x22, z22);
      if (y22 < 100) {
        (new WorldGenLog(1, 3 + rand.nextInt(4), false)).generate(world, rand, x22, y22, z22);
      }
    }
  }
  @Override
  public boolean generate(World world, Random random, int x, int y, int z) {
    int topBlockY = world.getHeightValue(x, z);
    int CurrentBiome = world.getBiomeGenForCoords(x, z).biomeID;

    for (Block topBlock = world.getBlock(x, topBlockY, z); topBlock == Blocks.air; topBlockY--) {
      topBlock = world.getBlock(x, topBlockY, z);
      if (topBlock != Blocks.air && topBlockY > 1) {
        topLayerBlock = topBlock;
        y = topBlockY + 1;
      }
    }

    if (BiomeSpecific == true) {
      canSpawnInBiome = false;
      for (int d = 0; d < SpawnableBiomes.length; d++) {
        if (CurrentBiome == SpawnableBiomes[d]) {
          canSpawnInBiome = true;
        }
      }
    }

    if (topLayerBlock == surface && random.nextInt(SpawnChance) == 1 && canSpawnInBiome == true) {
      world.setBlock(x, y, z, feature);

      this.XO = x;
      this.YO = y;
      this.ZO = z;

      // Randomized Growth
      if (spread == true) {

        // Number of times to try spawning in feature (Maximum)
        int runs = 0;
        int maxRuns = 16 * 16 * ClusterSizeHeight;

        // Fix so that features grow upwards and Loop Guard isn't alerted

        for (int i = 0; i < ClusterSize; ) {

          int rx = random.nextInt(ClusterSize) + XO;
          int rz = random.nextInt(ClusterSize) + ZO;
          int ry = random.nextInt(ClusterSizeHeight) + YO;

          if (world.getBlock(rx, ry, rz) == Blocks.air) {
            if (world.getBlock(rx, ry - 1, rz) == surface) {
              if (isTouchingFeature(world, rx, ry, rz)) {

                world.setBlock(rx, ry, rz, feature);
                i++;
              }
            }
            if (world.getBlock(rx, ry - 1, rz) == feature) {
              world.setBlock(rx, ry, rz, feature);
              i++;
            }
          } else if (world.getBlock(rx, ry, rz) == feature) {
            i++;
          }

          // Loop Guard:
          runs++;
          if (runs >= maxRuns - 2) {
            break;
          }
        }
      }

      return true;

    } else {
      return false;
    }
  }