コード例 #1
0
 @Override
 public void updateTick(World world, int x, int y, int z, Random rand) {
   if (!world.isRemote) {
     super.updateTick(world, x, y, z, rand);
     attemptGrowTree(world, x, y, z, rand);
   }
 }
コード例 #2
0
  /** Ticks the block if it's been scheduled */
  public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
    if (!par1World.isRemote) {
      super.updateTick(par1World, par2, par3, par4, par5Random);

      if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9 && par5Random.nextInt(7) == 0) {
        this.markOrGrowMarked(par1World, par2, par3, par4, par5Random);
      }
    }
  }
コード例 #3
0
 public void updateTick(World world, int i, int j, int k, Random random) {
   if (world.isRemote) {
     return;
   }
   super.updateTick(world, i, j, k, random);
   int md = world.getBlockMetadata(i, j, k);
   if (md % 8 == 0) {
     if (world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(120) == 0) {
       if ((md & 8) == 0) {
         world.setBlockMetadataWithNotify(i, j, k, md | 8);
       } else {
         growTree(world, i, j, k, random);
       }
     }
   } else if (md % 8 == 1 && random.nextInt(7) == 0) {
     if ((md & 8) == 0) {
       world.setBlockMetadataWithNotify(i, j, k, md | 8);
       int i1 = world.getBlockMetadata(i, j, k);
       System.out.println(
           (new StringBuilder()).append("Sapling metadata: ").append(i1).toString());
     } else {
       growTree(world, i, j, k, random);
       System.out.println("Blood tree has grown");
     }
   } else if (md % 8 == 2 && random.nextInt(10) == 0) {
     if ((md & 8) == 0) {
       world.setBlockMetadataWithNotify(i, j, k, md | 8);
       int i1 = world.getBlockMetadata(i, j, k);
       System.out.println(
           (new StringBuilder()).append("Sapling metadata: ").append(i1).toString());
     } else {
       growTree(world, i, j, k, random);
       System.out.println("Eucalyptus tree has grown");
     }
   } else if (md % 8 == 3 && random.nextInt(7) == 0) {
     if ((md & 8) == 0) {
       world.setBlockMetadataWithNotify(i, j, k, md | 8);
       int i1 = world.getBlockMetadata(i, j, k);
       System.out.println(
           (new StringBuilder()).append("Sapling metadata: ").append(i1).toString());
     } else {
       growTree(world, i, j, k, random);
       System.out.println("Sakura tree has grown");
     }
   } else if (md % 8 == 4 && random.nextInt(7) == 0) {
     if ((md & 8) == 0) {
       world.setBlockMetadataWithNotify(i, j, k, md | 8);
       int i1 = world.getBlockMetadata(i, j, k);
       System.out.println(
           (new StringBuilder()).append("Sapling metadata: ").append(i1).toString());
     } else {
       growTree(world, i, j, k, random);
       System.out.println("White tree has grown");
     }
   }
 }
コード例 #4
0
  // @SideOnly(Side.SERVER)
  public void updateTick(World world, int i, int j, int k, Random random) {
    if (!world.isRemote) {
      super.updateTick(world, i, j, k, random);

      if (world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
        int l = world.getBlockMetadata(i, j, k);
        if ((l & 8) == 0) world.setBlockMetadataWithNotify(i, j, k, l | 8);
        else growTree(world, i, j, k, random);
      }
    }
  }
コード例 #5
0
 public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
   super.updateTick(par1World, par2, par3, par4, par5Random);
   if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) {
     int var6 = par1World.getBlockMetadata(par2, par3, par4);
     if (var6 < 3 || var6 > 3 && var6 < 7 || var6 > 7 && var6 < 11 || var6 > 11 && var6 < 15) {
       float var7 = this.getGrowthRate(par1World, par2, par3, par4);
       if (par5Random.nextInt((int) (25.0F / var7) + 1) == 0) {
         ++var6;
         par1World.setBlock(par2, par3, par4, super.blockID, var6, 2);
       }
     }
   }
 }
コード例 #6
0
  public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
    super.updateTick(par1World, par2, par3, par4, par5Random);

    if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) {
      int l = par1World.getBlockMetadata(par2, par3, par4);

      if (l < 7) {
        float f = this.getGrowthRate(par1World, par2, par3, par4);

        if (par5Random.nextInt((int) (25.0F / f) + 1) == 0) {
          ++l;
          par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
        }
      }
    }
  }
コード例 #7
0
  public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
    super.updateTick(par1World, par2, par3, par4, par5Random);
    if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) {
      int var6 = par1World.getBlockMetadata(par2, par3, par4);
      if ((var6 == 0 || var6 == 4 || var6 == 12)
          && par1World.getBlockId(par2, par3 - 1, par4) == super.blockID) {
        par1World.setBlock(par2, par3, par4, 0, 0, 2);
      }

      if (var6 > 8
          && var6 < 12
          && par1World.getBlockMetadata(par2, par3 - 1, par4) == var6 - 1
          && par1World.getBlockId(par2, par3 - 1, par4) == super.blockID) {
        par1World.setBlock(par2, par3, par4, 0, 0, 2);
      }

      int underblock;
      int undermet;
      if (par1World.getBlockId(par2, par3 - 9, par4) != super.blockID) {
        if (var6 == 11 && forgottennature.bambooSpread) {
          for (underblock = -1; underblock < 2; ++underblock) {
            for (undermet = -1; undermet < 2; ++undermet) {
              if (par5Random.nextInt(forgottennature.bamSpreadBuffer) == 0
                  && (par1World.getBlockId(par2 + underblock, par3 - 2, par4 + undermet)
                          == Block.dirt.blockID
                      || par1World.getBlockId(par2 + underblock, par3 - 2, par4 + undermet)
                          == Block.grass.blockID)
                  && par1World.getBlockId(par2 + underblock, par3 - 1, par4 + undermet) == 0) {
                par1World.setBlock(
                    par2 + underblock, par3 - 1, par4 + undermet, super.blockID, 8, 2);
              }
            }
          }
        }

        if (var6 > 8 && var6 < 12 && par1World.getBlockId(par2, par3 + 1, par4) == 0) {
          par1World.setBlock(par2, par3 + 1, par4, super.blockID, 8, 2);
        }
      }

      if (par5Random.nextInt(10) == 0
          && var6 == 1
          && par1World.getBlockId(par2, par3 + 1, par4) == 0) {
        par1World.setBlock(par2, par3 + 1, par4, super.blockID, 2, 2);
      }

      underblock = par1World.getBlockId(par2, par3 - 1, par4);
      undermet = par1World.getBlockMetadata(par2, par3 - 1, par4);
      if (forgottennature.bambooGeneration
          && var6 > 7
          && var6 < 11
          && par5Random.nextInt(2) == 0
          && (underblock == Block.dirt.blockID
              || underblock == Block.grass.blockID
              || underblock == super.blockID && (undermet == var6 + 2 || undermet == 11))) {
        par1World.setBlock(par2, par3, par4, super.blockID, var6 + 1, 2);
      }

      if (var6 == 0 || var6 == 2 || var6 > 3 && var6 < 7 || var6 > 11 && var6 < 15) {
        float var7 = this.getGrowthRate(par1World, par2, par3, par4);
        if (par5Random.nextInt((int) (25.0F / var7) + 1) == 0) {
          ++var6;
          par1World.setBlock(par2, par3, par4, super.blockID, var6, 2);
        }
      }
    }
  }