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

Method updateTick

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

Source from the content-addressed store, hash-verified

54 }
55
56 public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
57 {
58 if (!worldIn.isRemote)
59 {
60 if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
61 {
62 worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
63 }
64 else
65 {
66 if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
67 {
68 for (int i = 0; i < 4; ++i)
69 {
70 BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
71 Block block = worldIn.getBlockState(blockpos.up()).getBlock();
72 IBlockState iblockstate = worldIn.getBlockState(blockpos);
73
74 if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
75 {
76 worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState());
77 }
78 }
79 }
80 }
81 }
82 }
83
84 /**
85 * Get the Item that this Block should drop when harvested.

Callers

nothing calls this directly

Calls 10

upMethod · 0.95
getLightOpacityMethod · 0.95
getBlockMethod · 0.95
getValueMethod · 0.95
getLightFromNeighborsMethod · 0.80
getDefaultStateMethod · 0.80
nextIntMethod · 0.80
getBlockStateMethod · 0.65
setBlockStateMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected