Mojira Archive
MC-76490

Sheep can eat grass through non-full blocks

The Bug:

Sheep can eat grass through non-full blocks.

Steps to Reproduce:

  1. Set the "randomTickSpeed" gamerule to "0" to avoid grass blocks from converting into dirt as a result of blocks being present above them by using the command provided below.
    /gamerule randomTickSpeed 0
  2. Summon a large area of grass blocks with some slabs above them by using the commands provided below.
    /fill ~1 ~ ~1 ~15 ~ ~15 minecraft:grass_block
    /fill ~1 ~1 ~1 ~15 ~1 ~15 minecraft:oak_slab
  3. Spawn some sheep on top of the slabs and wait around thirty seconds.
  4. Take note as to whether or not sheep can eat grass through non-full blocks.

Observed Behavior:

Sheep can eat grass through non-full blocks.

Expected Behavior:

Sheep would not be able to eat grass through non-full blocks.

Code Analysis:

Code analysis by [Mod] Chandler can be found below.

The following is based on a decompiled version of Minecraft 1.16.5 using MCP mappings.

At net.minecraft.entity.ai.goal.EatGrassGoal in the tick method the block below the sheep is checked but the block the sheep is currently in is not checked. This could be fixed by adding a check to make sure the sheep is in either air or a walkable block.