Exemplo n.º 1
0
 public void b(World world, BlockPos blockpos, IBlockState iblockstate, Random random) {
   if (!world.D) {
     super.b(world, blockpos, iblockstate, random);
     if (world.l(blockpos.a()) >= 9 && random.nextInt(7) == 0) {
       this.d(world, blockpos, iblockstate, random);
     }
   }
 }
Exemplo n.º 2
0
  public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    super.updateTick(worldIn, pos, state, rand);

    if (worldIn.getLightFromNeighbors(pos.up()) >= 9) {
      int i = ((Integer) state.getValue(AGE)).intValue();

      if (i < 7) {
        float f = getGrowthChance(this, worldIn, pos);

        if (rand.nextInt((int) (25.0F / f) + 1) == 0) {
          worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2);
        }
      }
    }
  }
Exemplo n.º 3
0
 public void harvestBlock(
     World worldIn, EntityPlayer playerIn, BlockPos pos, IBlockState state, TileEntity te) {
   if (!worldIn.isRemote
       && playerIn.getCurrentEquippedItem() != null
       && playerIn.getCurrentEquippedItem().getItem() == Items.shears) {
     playerIn.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
     spawnAsEntity(
         worldIn,
         pos,
         new ItemStack(
             Blocks.tallgrass,
             1,
             ((BlockTallGrass.EnumType) state.getValue(field_176497_a)).func_177044_a()));
   } else {
     super.harvestBlock(worldIn, playerIn, pos, state, te);
   }
 }
Exemplo n.º 4
0
  /** Spawns this Block's drops into the World as EntityItems. */
  public void dropBlockAsItemWithChance(
      World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {
    super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);

    if (!worldIn.isRemote) {
      int i = ((Integer) state.getValue(AGE)).intValue();

      if (i >= 7) {
        int j = 3 + fortune;

        for (int k = 0; k < j; ++k) {
          if (worldIn.rand.nextInt(15) <= i) {
            spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0));
          }
        }
      }
    }
  }