MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / updateTick

Method updateTick

src/main/java/net/minecraft/block/BlockStem.java:72–109  ·  view source on GitHub ↗
(World worldIn, BlockPos pos, IBlockState state, Random rand)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 13

getGrowthChanceMethod · 0.95
getLightFromNeighborsMethod · 0.80
upMethod · 0.80
nextIntMethod · 0.80
downMethod · 0.80
getDefaultStateMethod · 0.80
getValueMethod · 0.65
withPropertyMethod · 0.65
getBlockMethod · 0.65
getBlockStateMethod · 0.65
setBlockStateMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected