public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
   net.minecraft.block.BlockSand.fallInstantly = true;
   int var4 = par2 * 16;
   int var5 = par3 * 16;
   BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);
   this.rand.setSeed(this.worldObj.getSeed());
   long var7 = this.rand.nextLong() / 2L * 2L + 1L;
   long var9 = this.rand.nextLong() / 2L * 2L + 1L;
   this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed());
   boolean var11 = false;
   if (this.mapFeaturesEnabled) {
     this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
     var11 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
     this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
     this.scatteredFeatureGenerator.generateStructuresInChunk(
         this.worldObj, this.rand, par2, par3);
   }
   if ((!var11) && (this.rand.nextInt(4) == 0)) {
     int var12 = var4 + this.rand.nextInt(16) + 8;
     int var13 = this.rand.nextInt(128);
     int var14 = var5 + this.rand.nextInt(16) + 8;
     new WorldGenLakes(Block.waterStill.blockID)
         .generate(this.worldObj, this.rand, var12, var13, var14);
   }
   var6.decorate(this.worldObj, this.rand, var4, var5);
   SpawnerAnimals.performWorldGenSpawning(
       this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand);
   var4 += 8;
   var5 += 8;
   for (int var12 = 0; var12 < 16; var12++) {
     for (int var13 = 0; var13 < 16; var13++) {
       int var14 = this.worldObj.getPrecipitationHeight(var4 + var12, var5 + var13);
       if (this.worldObj.isBlockFreezable(var12 + var4, var14 - 1, var13 + var5)) {
         this.worldObj.setBlock(var12 + var4, var14 - 1, var13 + var5, Block.ice.blockID);
       }
       if (this.worldObj.canSnowAt(var12 + var4, var14, var13 + var5)) {
         this.worldObj.setBlock(var12 + var4, var14, var13 + var5, Block.snow.blockID);
       }
     }
   }
   net.minecraft.block.BlockSand.fallInstantly = false;
 }
  @Override
  public void populate(IChunkProvider ichunkprovider, int chunkX, int chunkZ) {
    BlockSand.fallInstantly = true;
    int i = chunkX * 16;
    int j = chunkZ * 16;

    if (dimension == Dimension.nether) {
      // this.genNetherBridge.generateStructuresInChunk(worldObj, rand, chunkX, chunkZ);
    }

    BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(i + 16, j + 16);
    rand.setSeed(worldObj.getSeed());
    long l = (rand.nextLong() / 2L) * 2L + 1L;
    long l1 = (rand.nextLong() / 2L) * 2L + 1L;
    rand.setSeed((long) chunkX * l + (long) chunkZ * l1 ^ worldObj.getSeed());
    boolean flag = false;

    if (!(biomegenbase instanceof BiomeGenMainDimension)) {
      System.out.println("Illegal biome generated at " + i + ", " + j);
      BlockSand.fallInstantly = false;
      return;
    }
    BiomeGenMainDimension biome = (BiomeGenMainDimension) biomegenbase;
    Iterator<Map.Entry<WorldGenerator, Integer>> iterator;
    WorldGenerator worldgenerator;
    int count;
    Map.Entry entry;
    int x;
    int y;
    int z;
    for (HashMap<WorldGenerator, Integer> map : biome.worldGen) {
      iterator = map.entrySet().iterator();
      while (iterator.hasNext()) {
        entry = iterator.next();
        worldgenerator = (WorldGenerator) entry.getKey();
        count = (Integer) entry.getValue();
        if (worldgenerator != null && count != 0) {
          if (count < 0) {
            if (rand.nextInt(-count) == 0) {
              x = i + rand.nextInt(16) + 8;
              y = rand.nextInt(dimension.heightLimit);
              z = j + rand.nextInt(16) + 8;
              worldgenerator.generate(worldObj, rand, x, y, z);
            }
          } else {
            for (int count1 = 0; count1 < count; count1++) {
              x = i + rand.nextInt(16) + 8;
              y = rand.nextInt(dimension.heightLimit);
              z = j + rand.nextInt(16) + 8;
              worldgenerator.generate(worldObj, rand, x, y, z);
            }
          }
        }
      }
    }

    SpawnerAnimals.performWorldGenSpawning(worldObj, biomegenbase, i + 8, j + 8, 16, 16, rand);
    i += 8;
    j += 8;

    BlockSand.fallInstantly = false;
  }
  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;
  }
Пример #4
0
  /** Populates chunk with ores etc etc */
  @Override
  public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
    long time = System.currentTimeMillis();
    BlockSand.fallInstantly = true;
    int k = par2 * 16;
    int l = par3 * 16;
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
    this.rand.setSeed(this.worldObj.getSeed());
    long i1 = this.rand.nextLong() / 2L * 2L + 1L;
    long j1 = this.rand.nextLong() / 2L * 2L + 1L;
    this.rand.setSeed((long) par2 * i1 + (long) par3 * j1 ^ this.worldObj.getSeed());
    boolean flag = false;

    MinecraftForge.EVENT_BUS.post(
        new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));

    /*
    if (this.mapFeaturesEnabled)
    {
        this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
        flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
        this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
        this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
    }*/

    int k1;
    int l1;
    int i2;

    if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA)
        && !flag
        && this.rand.nextInt(8) == 0) {
      k1 = k + this.rand.nextInt(16) + 8;
      l1 = this.rand.nextInt(this.rand.nextInt(120) + 8);
      i2 = l + this.rand.nextInt(16) + 8;

      if (l1 < 63 || this.rand.nextInt(10) == 0) {
        (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2);
      }
    }

    /*boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
    for (k1 = 0; doGen && k1 < 8; ++k1)
    {
        l1 = k + this.rand.nextInt(16) + 8;
        i2 = this.rand.nextInt(128);
        int j2 = l + this.rand.nextInt(16) + 8;

        if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2))
        {
            ;
        }
    }*/

    biomegenbase.decorate(this.worldObj, this.rand, k, l);
    SpawnerAnimals.performWorldGenSpawning(
        this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
    k += 8;
    l += 8;

    MinecraftForge.EVENT_BUS.post(
        new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));

    BlockSand.fallInstantly = false;

    // System.out.println("Populating chunk: " + (System.currentTimeMillis() - time) + "ms");
  }