The Bug:
Sheep can eat grass through non-full blocks.
Steps to Reproduce:
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
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
Spawn some sheep on top of the slabs and wait around thirty seconds.
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
is duplicated by 2
Attachments
Comments 15
I think this is working as intended, I think that sheep will eat grass one block away from the source.
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.
Confirmed.