mojira.dev
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 @unknown 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.

Linked issues

Attachments

Comments 15

I think this is working as intended, I think that sheep will eat grass one block away from the source.

That's the bug. Sheep will eat grass one block away from the source, no matter what is in between.

Confirmed for 1.13.1.

I think is a bug, too

5 more comments

Can confirm in 21w07a. Video attached.

Can confirm in 1.16.5 and 21w08b.

Can confirm in 1.17.1.

I'd like to request ownership of this ticket since the current reporter has been inactive for over a year. I'm willing to keep this ticket updated and will continue to provide all of the necessary details.

Can confirm in 1.18.2 and 22w11a.

Minecraft

Avoma

(Unassigned)

Confirmed

Gameplay

Low

Mob behaviour

grass_block, sheep

Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.2-pre1, Minecraft 1.8.2-pre4, Minecraft 1.8.2-pre6, ..., 1.21.4, 25w08a, 1.21.5, 1.21.6, 1.21.7

Retrieved