@Override
 protected void generateOres() {
   MinecraftForge.ORE_GEN_BUS.post(
       new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
   if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT))
     this.genStandardOre1(20, this.dirtGen, 0, 256);
   if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, chunk_X, chunk_Z, GRAVEL))
     this.genStandardOre1(10, this.gravelGen, 0, 256);
   MinecraftForge.ORE_GEN_BUS.post(
       new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
 }
  /**
   * This method should be called if both of the following conditions are true:
   *
   * <p>1) You are manually decorating a biome by overrding rDecorate(). 2) You are NOT calling
   * rDecorateSeedBiome() within rDecorate().
   */
  public void rOreGenSeedBiome(
      World world,
      Random rand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float strength,
      float river,
      BiomeGenBase seedBiome) {

    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(world, rand, chunkX, chunkY));

    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.dirtGen, chunkX, chunkY, DIRT))
      genStandardOre1(20, seedBiome.theBiomeDecorator.dirtGen, 0, 256, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.gravelGen, chunkX, chunkY, GRAVEL))
      genStandardOre1(
          10, seedBiome.theBiomeDecorator.gravelGen, 0, 256, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.coalGen, chunkX, chunkY, COAL))
      genStandardOre1(20, seedBiome.theBiomeDecorator.coalGen, 0, 128, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.ironGen, chunkX, chunkY, IRON))
      genStandardOre1(20, seedBiome.theBiomeDecorator.ironGen, 0, 64, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.goldGen, chunkX, chunkY, GOLD))
      genStandardOre1(2, seedBiome.theBiomeDecorator.goldGen, 0, 32, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.redstoneGen, chunkX, chunkY, REDSTONE))
      genStandardOre1(
          8, seedBiome.theBiomeDecorator.redstoneGen, 0, 16, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.diamondGen, chunkX, chunkY, DIAMOND))
      genStandardOre1(
          1, seedBiome.theBiomeDecorator.diamondGen, 0, 16, world, rand, chunkX, chunkY);
    if (TerrainGen.generateOre(
        world, rand, seedBiome.theBiomeDecorator.lapisGen, chunkX, chunkY, LAPIS))
      genStandardOre2(1, seedBiome.theBiomeDecorator.lapisGen, 16, 16, world, rand, chunkX, chunkY);

    if (ConfigRTG.generateOreEmerald && generatesEmeralds) {
      rGenerateEmeralds(world, rand, chunkX, chunkY);
    }

    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(world, rand, chunkX, chunkY));
  }
Пример #3
0
  @Override
  public void populate(int chunkX, int chunkZ) {
    BlockFalling.fallInstantly = true;

    int worldX = chunkX * 16;
    int worldZ = chunkZ * 16;
    BlockPos blockPos = new BlockPos(worldX, 0, worldZ);
    Biome biome = worldObj.getBiomeGenForCoords(blockPos.add(16, 0, 16));
    BiomeDecorator decorator = biome.theBiomeDecorator;
    int worldHeight = worldObj.provider.getActualHeight();

    ForgeEventFactory.onChunkPopulate(true, this, worldObj, rand, chunkX, chunkZ, false);

    int x, y, z;

    if (CavelandConfig.generateLakes) {
      if (TerrainGen.populate(this, worldObj, rand, chunkX, chunkZ, false, EventType.LAKE)) {
        x = rand.nextInt(16) + 8;
        y = rand.nextInt(worldHeight - 16);
        z = rand.nextInt(16) + 8;

        lakeWaterGen.generate(worldObj, rand, blockPos.add(x, y, z));
      }

      if (rand.nextInt(30) == 0
          && TerrainGen.populate(this, worldObj, rand, chunkX, chunkZ, false, EventType.LAVA)) {
        x = rand.nextInt(16) + 8;
        y = rand.nextInt(worldHeight / 2);
        z = rand.nextInt(16) + 8;

        lakeLavaGen.generate(worldObj, rand, blockPos.add(x, y, z));
      }
    }

    MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, rand, blockPos));

    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(worldObj, rand, blockPos));

    for (CaveVein vein : CavelandConfig.veinManager.getCaveVeins()) {
      vein.generateVeins(worldObj, rand, blockPos);
    }

    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(worldObj, rand, blockPos));

    for (int i = 0; i < 10; ++i) {
      x = rand.nextInt(16) + 8;
      y = rand.nextInt(worldHeight - 10);
      z = rand.nextInt(16) + 8;

      acresiaGen.generate(worldObj, rand, blockPos.add(x, y, z));
    }

    for (int i = 0; i < 15; ++i) {
      x = rand.nextInt(16) + 8;
      y = rand.nextInt(worldHeight / 2 - 10) + worldHeight / 2;
      z = rand.nextInt(16) + 8;

      acresiaGen.generate(worldObj, rand, blockPos.add(x, y, z));
    }

    if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.SHROOM)) {
      for (int i = 0; i < 5; ++i) {
        x = rand.nextInt(16) + 8;
        y = rand.nextInt(worldHeight - 10);
        z = rand.nextInt(16) + 8;

        decorator.mushroomBrownGen.generate(worldObj, rand, blockPos.add(x, y, z));
      }

      for (int i = 0; i < 5; ++i) {
        x = rand.nextInt(16) + 8;
        y = rand.nextInt(worldHeight - 10);
        z = rand.nextInt(16) + 8;

        decorator.mushroomRedGen.generate(worldObj, rand, blockPos.add(x, y, z));
      }
    }

    if (BiomeDictionary.isBiomeOfType(biome, Type.SANDY)) {
      if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.CACTUS)) {
        for (int i = 0; i < 80; ++i) {
          x = rand.nextInt(16) + 8;
          y = rand.nextInt(worldHeight - 5);
          z = rand.nextInt(16) + 8;

          decorator.cactusGen.generate(worldObj, rand, blockPos.add(x, y, z));
        }
      }

      if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.DEAD_BUSH)) {
        for (int i = 0; i < 10; ++i) {
          x = rand.nextInt(16) + 8;
          y = rand.nextInt(worldHeight - 5);
          z = rand.nextInt(16) + 8;

          deadBushGen.generate(worldObj, rand, blockPos.add(x, y, z));
        }
      }
    } else {
      if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.FLOWERS)) {
        for (int i = 0; i < 8; ++i) {
          x = rand.nextInt(16) + 8;
          y = rand.nextInt(worldHeight - 5);
          z = rand.nextInt(16) + 8;

          decorator.yellowFlowerGen.generate(worldObj, rand, blockPos.add(x, y, z));
        }
      }

      for (int i = 0; i < 18; ++i) {
        x = rand.nextInt(16) + 8;
        y = rand.nextInt(worldHeight - 5);
        z = rand.nextInt(16) + 8;

        biome.getRandomWorldGenForGrass(rand).generate(worldObj, rand, blockPos.add(x, y, z));
      }

      if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.TREE)) {
        WorldGenAbstractTree treeGen = null;

        if (BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE)) {
          treeGen =
              new WorldGenTreesPerverted(
                  false, 4 + rand.nextInt(7), BlockPlanks.EnumType.JUNGLE, true);
        } else if (BiomeDictionary.isBiomeOfType(biome, Type.FOREST)
            || !BiomeDictionary.isBiomeOfType(biome, Type.PLAINS)
            || rand.nextInt(10) == 0) {
          if (BiomeDictionary.isBiomeOfType(biome, Type.COLD)) {
            treeGen = new WorldGenSpruceTreePerverted(false);
          } else if (rand.nextInt(3) == 0) {
            treeGen = new WorldGenBirchTreePerverted(false, false);
          } else {
            treeGen = new WorldGenTreesPerverted(false, 3, BlockPlanks.EnumType.OAK, true);
          }
        }

        if (treeGen != null) {
          for (int i = 0; i < 80; ++i) {
            x = rand.nextInt(16) + 8;
            y = rand.nextInt(worldHeight);
            z = rand.nextInt(16) + 8;

            BlockPos pos = blockPos.add(x, y, z);

            if (treeGen.generate(worldObj, rand, pos)) {
              treeGen.generateSaplings(worldObj, rand, pos);
            }
          }

          for (int i = 0; i < 60; ++i) {
            x = rand.nextInt(16) + 8;
            y = 8 + rand.nextInt(5);
            z = rand.nextInt(16) + 8;

            BlockPos pos = blockPos.add(x, y, z);

            if (treeGen.generate(worldObj, rand, pos)) {
              treeGen.generateSaplings(worldObj, rand, pos);
            }
          }
        }
      }

      if (decorator.generateLakes) {
        if (BiomeDictionary.isBiomeOfType(biome, Type.WATER)) {
          if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_WATER)) {
            for (int i = 0; i < 150; ++i) {
              x = rand.nextInt(16) + 8;
              y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10);
              z = rand.nextInt(16) + 8;

              liquidWaterGen.generate(worldObj, rand, blockPos.add(x, y, z));
            }
          }
        } else {
          if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_WATER)) {
            for (int i = 0; i < 100; ++i) {
              x = rand.nextInt(16) + 8;
              y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10);
              z = rand.nextInt(16) + 8;

              liquidWaterGen.generate(worldObj, rand, blockPos.add(x, y, z));
            }
          }

          if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_LAVA)) {
            for (int i = 0; i < 20; ++i) {
              x = rand.nextInt(16) + 8;
              y = rand.nextInt(worldHeight / 2);
              z = rand.nextInt(16) + 8;

              liquidLavaGen.generate(worldObj, rand, blockPos.add(x, y, z));
            }
          }
        }
      }
    }

    MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, rand, blockPos));

    ForgeEventFactory.onChunkPopulate(false, this, worldObj, rand, chunkX, chunkZ, false);

    BlockFalling.fallInstantly = false;
  }