Перейти к содержимому
Mineforgian

Rabbit Pathfinding Fixed

Fixes rabbit pathfinding efficiently

Загрузки
73K
Подписчики
69
Обновлён
17 июня 2026 г.
Лицензия
Apache-2.0

Опубликован 5 октября 2024 г.

Fixes rabbit pathfinding efficiently.

As of 1.21.1 there are multiple problems with rabbit pathfinding:

Basic pathfinding

  1. The calculation of the jump height/velocity is incorrect and poorly implemented.
    This results in too small jumps for climbing over a block.
  2. Rabbits "stall" (no horizontal movement) during jumps - due to this they just jump upwards in the same place when trying to climb a block.
    This behavior is caused by RabbitMoveControl which only sets the (horizontal) speed correctly during movement but not while jumping.
  3. Rabbits are stuck / try to wander around forever.
    • The root cause is that EntityNavigation 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: WanderAround(Far). Most other entities also use LookAroundGoal.
      Thus the above mentioned infinite navigation is never stopped in favor of executing another goal like in most other mobs.
    • RabbitMoveControl#tick constantly updates the rabbits speed (RabbitEntity#setSpeed).
      While doing this it also indirectly executes moveControl#moveTo thus the rabbit always tries to reach it's last target even when it shouldn't do that.

As of 1.21.4/24w46a MC-150224 was fixed, correcting the jump height (1) and fixing the stall (2).
However all other parts - including optimizations and sanity checks in above mentioned fixes - are still missing.

Eating carrot crops

  1. Rabbits can't reach the crops and always stop one block short of them.
    This is due to selecting the incorrect distance from the crop block (it's 1 but should be 0).
  2. Rabbits eat the crop instantly even while still jumping and being in the air.
  3. The goal/behavior is immediately aborted (after a few ticks - when a target crop block was selected) due to incorrect implementation of shouldContinue and isTargetPos methods.

Other fixes

  • The client-side rotation of Adults rabbit's head is most of the time slightly upwards - MC-306682 affects 26.1 or later

Detailed video comparisons are also available.

Ченджлог

1.4.0Релиз26.2 · 17 июня 2026 г.
  • Updated to 26.2

Full changelog

1.3.0Релиз26.1.2 · 16 мая 2026 г.
1.2.0Релиз26.1, 26.1.1, 26.1.2 · 24 марта 2026 г.
1.1.0Релиз1.21.11 · 9 декабря 2025 г.
1.0.8Релиз1.21.10 · 5 ноября 2025 г.
1.0.6.1-legacy+1.20Релиз1.20.4, 1.20.5, 1.20.6 · 30 сентября 2025 г.

This is a "one-shot" legacy version

It should work for 1.20.

  • Fix failing mixin injection in RabbitEntityEatCarrotCropGoalMixin in previous version #114

Thanks to @murphy-slaw for noticing and providing code.

1.0.7Релиз1.21.9, 1.21.10 · 30 сентября 2025 г.
1.0.6-legacy+1.18Релиз1.19.2, 1.19.3, 1.19.4 · 15 августа 2025 г.

This is a "one-shot" legacy version

It should work for 1.18 and 1.19.

⚠️ WARNING: 1.18 has a critical bug in the pathfinding code: Small entities track the invalid pathnode (next one/one ahead) that they try to reach. This was fixed in 1.19.

Why 1.18? 1.18 and above support Java 17 which is (currently) the minimum version for the tools that are used to build the mod.

Комментарии

Загружаем…