@Override
  public void func_149878_d(World world, int x, int y, int z, Random rand) {
    if (world.isRemote || !TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;

    int meta = damageDropped(world.getBlockMetadata(x, y, z));
    world.setBlockToAir(x, y, z);

    switch (meta) {
      case 1:
        if (MineFactoryReloadedWorldGen.generateSacredSpringRubberTree(world, rand, x, y, z))
          return;
        break;
      case 2:
        if (MineFactoryReloadedWorldGen.generateMegaRubberTree(world, rand, x, y, z, false)) return;
        break;
      case 3:
        if (new WorldGenMassiveTree().setSloped(true).generate(world, rand, x, y, z)) return;
        break;
      default:
      case 0:
        BiomeGenBase b = world.getBiomeGenForCoords(x, z);
        if (b != null && b.biomeName.toLowerCase().contains("mega"))
          if (rand.nextInt(50) == 0)
            if (MineFactoryReloadedWorldGen.generateMegaRubberTree(world, rand, x, y, z, true))
              return;
        if (treeGen.growTree(world, rand, x, y, z)) return;
        break;
    }
    world.setBlock(x, y, z, this, meta, 4);
  }
示例#2
0
  /** Attempts to grow a sapling into a tree */
  public void growTree(World par1World, int par2, int par3, int par4, Random par5Random) {
    if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;

    int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
    Object object = null;
    int i1 = 0;
    int j1 = 0;
    boolean flag = false;

    if (l == 1) {
      object = new WorldGenTaiga2(true);
    } else if (l == 2) {
      object = new WorldGenForest(true);
    } else if (l == 3) {
      for (i1 = 0; i1 >= -1; --i1) {
        for (j1 = 0; j1 >= -1; --j1) {
          if (this.isSameSapling(par1World, par2 + i1, par3, par4 + j1, 3)
              && this.isSameSapling(par1World, par2 + i1 + 1, par3, par4 + j1, 3)
              && this.isSameSapling(par1World, par2 + i1, par3, par4 + j1 + 1, 3)
              && this.isSameSapling(par1World, par2 + i1 + 1, par3, par4 + j1 + 1, 3)) {
            object = new WorldGenHugeTrees(true, 10 + par5Random.nextInt(20), 3, 3);
            flag = true;
            break;
          }
        }

        if (object != null) {
          break;
        }
      }

      if (object == null) {
        j1 = 0;
        i1 = 0;
        object = new WorldGenNileTrees(true, 4 + par5Random.nextInt(7), 3, 3, false);
      }
    } else {
      object = new WorldGenNileTrees(true);

      if (par5Random.nextInt(10) == 0) {
        object = new WorldGenBigTree(true);
      }
    }

    if (flag) {
      par1World.setBlock(par2 + i1, par3, par4 + j1, 0, 0, 4);
      par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, 0, 0, 4);
      par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, 0, 0, 4);
      par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, 0, 0, 4);
    } else {
      par1World.setBlock(par2, par3, par4, 0, 0, 4);
    }

    if (!((WorldGenerator) object).generate(par1World, par5Random, par2 + i1, par3, par4 + j1)) {
      if (flag) {
        par1World.setBlock(par2 + i1, par3, par4 + j1, this.blockID, l, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1, this.blockID, l, 4);
        par1World.setBlock(par2 + i1, par3, par4 + j1 + 1, this.blockID, l, 4);
        par1World.setBlock(par2 + i1 + 1, par3, par4 + j1 + 1, this.blockID, l, 4);
      } else {
        par1World.setBlock(par2, par3, par4, this.blockID, l, 4);
      }
    }
  }