/** Ticks the block if it's been scheduled */ public void updateTick(World world, int x, int y, int z, Random random) { super.updateTick(world, x, y, z, random); if (world.getBlockLightValue(x, y + 1, z) >= 9) { float f = this.func_149875_n(world, x, y, z); if (random.nextInt((int) (25.0F / f) + 1) == 0) { int l = world.getBlockMetadata(x, y, z); if (l < 7) { ++l; world.setBlockMetadataWithNotify(x, y, z, l, 2); } else { if (world.getBlock(x - 1, y, z) == this.block) { return; } if (world.getBlock(x + 1, y, z) == this.block) { return; } if (world.getBlock(x, y, z - 1) == this.block) { return; } if (world.getBlock(x, y, z + 1) == this.block) { return; } int i1 = random.nextInt(4); int j1 = x; int k1 = z; if (i1 == 0) { j1 = x - 1; } if (i1 == 1) { ++j1; } if (i1 == 2) { k1 = z - 1; } if (i1 == 3) { ++k1; } Block block = world.getBlock(j1, y - 1, k1); if (world.isAirBlock(j1, y, k1) && (block.canSustainPlant(world, j1, y - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass)) { world.setBlock(j1, y, k1, this.block); } } } } }
@Override 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); if (i < 2) { if (rand.nextInt(5) == 0) { worldIn.setBlockState(pos, state.withProperty(AGE, i + 1), 2); } } } }