public void dropBlockAsItemWithChance(
      World world, int i, int j, int k, int met, float par6, int par7) {
    super.dropBlockAsItemWithChance(world, i, j, k, met, par6, par7);
    met &= 15;
    if (met == 3) {
      this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 7));
    } else if (met == 7) {
      this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 15));
    } else if (met == 11) {
      this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 9));
    } else if (met == 15) {
      this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 10));
    }

    for (int n = 0; n < 5; ++n) {
      if (met == 3 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 10));
      } else if (met == 7 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 9));
      } else if (met == 11 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 9));
      } else if (met == 15 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 3));
      }
    }
  }
  public void dropBlockAsItemWithChance(
      World world, int i, int j, int k, int met, float par6, int par7) {
    super.dropBlockAsItemWithChance(world, i, j, k, met, par6, par7);
    met &= 15;
    if (met == 3) {
      this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.foodID], 1, 3));
    } else if (met == 7) {
      this.dropBlockAsItem_do(
          world, i, j, k, new ItemStack(Item.itemsList[forgottennature.newCropGoodsID], 1, 0));
    } else if (met == 11) {
      this.dropBlockAsItem_do(
          world,
          i,
          j,
          k,
          new ItemStack(Item.itemsList[forgottennature.hempCottonBambooCornID], 1, 11));
    } else if (met == 15) {
      this.dropBlockAsItem_do(
          world, i, j, k, new ItemStack(Item.itemsList[forgottennature.newCropGoodsID], 1, 1));
    }

    for (int n = 0; n < 5; ++n) {
      if (met == 3 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 1));
      } else if (met == 7 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 2));
      } else if (met == 15 && world.rand.nextInt(3) == 0) {
        this.dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.itemsList[this.seedID], 1, 8));
      }
    }
  }
 @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);
   }
 }
예제 #4
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);
      }
    }
  }
예제 #5
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");
     }
   }
 }
  public void func_71847_b(
      World p_71847_1_, int p_71847_2_, int p_71847_3_, int p_71847_4_, Random p_71847_5_) {
    int var6 = p_71847_1_.func_72805_g(p_71847_2_, p_71847_3_, p_71847_4_);
    if (var6 < 3 && p_71847_5_.nextInt(10) == 0) {
      ++var6;
      p_71847_1_.func_72921_c(p_71847_2_, p_71847_3_, p_71847_4_, var6, 2);
    }

    super.func_71847_b(p_71847_1_, p_71847_2_, p_71847_3_, p_71847_4_, p_71847_5_);
  }
  // @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);
      }
    }
  }
 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);
       }
     }
   }
 }
  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);
        }
      }
    }
  }
  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);
        }
      }
    }
  }
예제 #11
0
 public void dropBlockAsItemWithChance(
     World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {
   super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
 }