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

Method grow

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

Source from the content-addressed store, hash-verified

105 }
106
107 public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state)
108 {
109 BlockPos blockpos = pos.up();
110
111 for (int i = 0; i < 128; ++i)
112 {
113 BlockPos blockpos1 = blockpos;
114 int j = 0;
115
116 while (true)
117 {
118 if (j >= i / 16)
119 {
120 if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air)
121 {
122 if (rand.nextInt(8) == 0)
123 {
124 BlockFlower.EnumFlowerType blockflower$enumflowertype = worldIn.getBiomeGenForCoords(blockpos1).pickRandomFlower(rand, blockpos1);
125 BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock();
126 IBlockState iblockstate = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype);
127
128 if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate))
129 {
130 worldIn.setBlockState(blockpos1, iblockstate, 3);
131 }
132 }
133 else
134 {
135 IBlockState iblockstate1 = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS);
136
137 if (Blocks.tallgrass.canBlockStay(worldIn, blockpos1, iblockstate1))
138 {
139 worldIn.setBlockState(blockpos1, iblockstate1, 3);
140 }
141 }
142 }
143
144 break;
145 }
146
147 blockpos1 = blockpos1.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1);
148
149 if (worldIn.getBlockState(blockpos1.down()).getBlock() != Blocks.grass || worldIn.getBlockState(blockpos1).getBlock().isNormalCube())
150 {
151 break;
152 }
153
154 ++j;
155 }
156 }
157 }
158
159 public EnumWorldBlockLayer getBlockLayer()
160 {

Callers

nothing calls this directly

Calls 15

getTypePropertyMethod · 0.95
addMethod · 0.95
downMethod · 0.95
upMethod · 0.80
nextIntMethod · 0.80
getDefaultStateMethod · 0.80
isNormalCubeMethod · 0.80
getBlockMethod · 0.65
getBlockStateMethod · 0.65
getBiomeGenForCoordsMethod · 0.65
withPropertyMethod · 0.65
pickRandomFlowerMethod · 0.45

Tested by

no test coverage detected