The Bug:
Rabbits can occasionally get stuck on the edges of blocks.
Steps to Reproduce:
Build the setup as shown in the attachment below.
Summon multiple rabbits on any of the diamond blocks.
Switch into survival mode and approach the rabbits so that they will run away from you.
Pay close attention to the behavior of the rabbits as they try to jump over blocks.
Take note as to whether or not rabbits can occasionally get stuck on the edges of blocks.
Observed Behavior:
Rabbits can occasionally get stuck on the edges of blocks.
Expected Behavior:
Rabbits would not occasionally get stuck on the edges of blocks.
Linked issues
is duplicated by 38
Attachments
Comments 43
can confirm. for me they are getting stuck either to the top of the fence post, or the side of the glass. i'm not sure. either way, they're getting crushed/suffocated, and cannot escape. same effect happens horizontally, on the side of the fence post, instead of above it.
There are multiple problems inside rabbit pathfinding and related code causing this issue:
1. The calculation of the jump height/velocity is incorrect and poorly implemented. This results in too small jumps for climbing over a block (hops aren't high enough).
2. Rabbits sometimes "stall" (no horizontal movement) during jumps - due to this they just jump upwards in the same place when trying to climb a block.
3. Rabbits are stuck / try to wander around forever:
The root cause is that
PathNavigation#doStuckDetection
sets its timeouts based on movement speed. If the movement speed is 0 (this is the case when a rabbit/mob is "stuck"), the timeout is also 0... and if the timeout is 0 it's ignored and therefore it's executed forever (or until interrupted by something external like another goal).Rabbits only have a single goal when idle:
WaterAvoidingRandomStrollGoal/RandomStrollGoal
. Most other entities also useRandomLookAroundGoal
. Thus the above mentioned infinite navigation is likely never stopped in favor of executing another goal like in most other mobs.RabbitMoveControl#tick
constantly updates the rabbits speed (Rabbit#setSpeedModifier
). While doing this it also indirectly executesmoveControl#setWantedPosition
thus the rabbit always tries to reach it's last target even when it shouldn't do that.
Further helpful links:
See also: MC-277500
Although this ticket is as old as 1.14, this issue got significantly worse in 1.20, specifically in 1.20-pre1, where rabbits seem to have completely lost their ability to do medium jumps during normal pathfinding. I think this is a genuinely new issue. However, new tickets describing the new issue continue to be resolved as duplicates of this ticket.
While this ticket describes rare or temporary issues where rabbits could get stuck in novel block arrangements, rabbits currently are incapable of jumping up a block unless panicking, so wild rabbits are found hopping uselessly into the side of a block nearly 100% of the time now within seconds.
I think that since this issue was triaged before 1.20-pre1 where the issue became significantly worse, either it should be re-triaged or a new ticket should be created.
Can confirm, though for me it also affects doors, trapdoors in the open (vertical) position, and rabbits under closed trapdoors placed on the top half of a block.