mojira.dev
MC-150654

Grass block turns into dirt if there's at least two snow layers on top of it

The bug

Grass blocks turn into dirt when there's at least two snow layers on top of it.

To reproduce

  1. Place a grass block

  2. Place two snow layers on top of it

  3. Wait (or use /gamerule randomTickSpeed if you're impatient)

  4. ❌ The grass block turns into dirt

Original description

Light used to go through snow layers, but doesn't anymore. Also, when placing more than 1 layer on a grass block the game removes the grass from the dirt.

Linked issues

Attachments

Comments 13

Snow layers not letting light through is MC-139459 and intended. However, I can confirm that grass turns into dirt when there's snow layers on top of it with at least level 2. I have edited this ticket so that it no longer contains the issue about the lighting but only about the grass turning into dirt.

Can confirm that this issue also affects 1.15.1!

can confirm in 1.15.2 and 20w13b

Can confirm in 21w03a.

Can confirm in 21w06a.

3 more comments

Can confirm in 1.18.2.

Can confirm in 1.19 and 1.19.1 Pre-release 1.

Can confirm in 1.19.2.

Well, this just became a bit more serious of an issue with the new game rule that got added.

Code analysis (Mojang mappings, 1.19.2): SpreadingSnowyDirtBlock#canBeGrass(...) (which is called in randomTick(...) to turn the snowy block back into a dirt block) only early returns true if the block above is a snow (layer) block with one layer:

...
     private static boolean canBeGrass(BlockState $$0, LevelReader $$1, BlockPos $$2) {
        BlockPos $$3 = $$2.above();
        BlockState $$4 = $$1.getBlockState($$3);
        if ($$4.is(Blocks.SNOW) && $$4.getValue(SnowLayerBlock.LAYERS) == 1) {
            return true;
        }
        ...
    }
...

Changing $$4.getValue(SnowLayerBlock.LAYERS) == 1 to $$4.getValue(SnowLayerBlock.LAYERS) < 8 (or removing this additional check altogether, if it is desirable) should fix this issue.

John Smith

(Unassigned)

Confirmed

Gameplay

Low

Block states

grass_block

Minecraft 1.14, 1.15.1, 1.15.2, 20w06a, 20w13b, ..., 23w05a, 1.20.1, 1.21, 1.21.4, 25w02a

Retrieved