(World worldIn, BlockPos pos, IBlockState state, Random rand)
| 70 | } |
| 71 | |
| 72 | public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) |
| 73 | { |
| 74 | super.updateTick(worldIn, pos, state, rand); |
| 75 | |
| 76 | if (worldIn.getLightFromNeighbors(pos.up()) >= 9) |
| 77 | { |
| 78 | float f = BlockCrops.getGrowthChance(this, worldIn, pos); |
| 79 | |
| 80 | if (rand.nextInt((int)(25.0F / f) + 1) == 0) |
| 81 | { |
| 82 | int i = state.getValue(AGE); |
| 83 | |
| 84 | if (i < 7) |
| 85 | { |
| 86 | state = state.withProperty(AGE, i + 1); |
| 87 | worldIn.setBlockState(pos, state, 2); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) |
| 92 | { |
| 93 | if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() == this.crop) |
| 94 | { |
| 95 | return; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); |
| 100 | Block block = worldIn.getBlockState(pos.down()).getBlock(); |
| 101 | |
| 102 | if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) |
| 103 | { |
| 104 | worldIn.setBlockState(pos, this.crop.getDefaultState()); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | public void growStem(World worldIn, BlockPos pos, IBlockState state) |
| 112 | { |
nothing calls this directly
no test coverage detected