Leashed wolves no longer attack when unleashed
Steps to reproduce in creative:
- Place fence post
- Spawn wolf with spawn egg
- Tame wolf with bone
- Use lead to attach wolf to post
- Right-click fence post (or move fence post using a piston) to release wolf
- Spawn cow
- Attack cow with empty hand
Expected behavior:
Wolf attacks cow, and follows the cow if/when it runs away.
Observed behavior:
Wolf will not attack the cow unless it is within the region the wolf could reach while leashed.
Also, the wolf will not wander from that area, but can follow the player via teleportation.
Linked Issues
Created Issue:
Leashed wolves no longer attack when unleashed
Steps to reproduce in creative:
- Place fence post
- Spawn wolf with spawn egg
- Tame wolf with bone
- Use lead to attach wolf to post
- Right-click fence post (or move fence post using a piston) to release wolf
- Spawn cow
- Attack cow with empty hand
Expected behavior:
Wolf attacks cow, and follows the cow if/when it runs away.
Observed behavior:
Wolf will not attack the cow unless it is within the region the wolf could reach while leashed.
Also, the wolf will not wander from that area, but can follow the player via teleportation.
Environment
Java Edition 1.16.5, Windows 10
relates to
Java Edition 1.16.5, Windows 10
is duplicated by
When any mob is attached with a lead, a field called restrictCenter is set to the leash holder's position and another field called restrictRadius stores the restriction distance which is set to 5 blocks when a mob is leashed. This field is tested for in various mob AI classes to check if a mob is allowed to navigate outside of the restrictRadius from the restrictCenter position and whether a mob should try to or continue to attack another mob if the target or the attacker is outside of this restriction. The issue is that when a mob has its lead removed, restrictRadius is not reset to the sentinel value of -1 (which means the mob has no restriction) until the game is reloaded.
This is also the cause for MC-221754.
The Bug
When unleashing a wolf from a fence the speed of the wolf decreases significantly
Reproduce
- Get a wolf
- Leash it to a fence
- Attack a mob or have a skeleton near
- Unleash the wolf from the fence
Notice the speed greatly decreases
Expected Result
The wolf's speed wouldn't decrease
Note
Discovered while testing MC-221754
Thank you for your report!
We're tracking this issue in MC-221754, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
MC-153329 and MC-221754 have been fixed in 24w11a. Is this still an issue in that version or later?
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Can confirm, and works for 1.17 pre-release 3
Another observation that I have made is that when you attack a mob outside of the reach of the wolf, then bring it closer, the wolf will not attack it even though the wolf can clearly reach it.
I was able to reproduce in 1.171 though on very rare occasions
Not fixed yet. Can reproduce in 1.19.3.
Can reproduce in 1.20.4 and it's because Mob.clearRestriction() is never called when the wolf is unleashed, resulting in its AI treating the entity as if it were still restricted to its last leashed position.