Attacking with a spear in the same tick that the crosshair becomes aimed at a target causes the attack to not connect. If at least one tick has passed since the crosshair became aimed at a target, the attack can connect if executed on the second tick. Similarly, if you attack with a spear while aimed at an entity, and then move the crosshair OFF of the entity you attacked within the span of a tick, the attack will also not register.
Steps To Reproduce:
Spawn a mob with no AI
Give yourself a sword and a spear
Set the tick rate to a low amount
Hover over the mob while holding the spear, and then move off of the mob. Then do the same while holding the sword.
Observe the on-hover attack indicator. The spear takes a long time to realize you’re no longer aiming at the mob, while the sword realizes immediately. And this is not only a visual bug with the attack indicator, it affects its hit registration.
Attachments
Comments 15
I cannot reproduce this. All melee attacks seem to work the same way for me, so even if they do not register the exact next frame after I hit the target, the delay is minimal and predictable, and certainly has nothing to do with the server tick rate. Shown below is my testing with a spear.
I can reproduce it extremely easily. The visual indicator for non stab-type weapons disappears immediately when moving off a mob, and reappears immediately when moving onto a mob. The spear’s indicator lags behind severely in both cases, and the lag on the visual indicator is the same as the lag on attack registration.
I also tested this with a custom spear that has a hitbox margin of 0 instead of the default 0.125, and this issue still happens, so it is not related to that value.
I can confirm that the indicator is tied to the hitbox_margin property of the attack_range component. Download and step through the following videos frame-by-frame. The top one shows an unmodified wooden sword:
The next one shows an unmodified golden pickaxe and netherite spear:
The next one shows a stone pickaxe with a hitbox margin of 0.0125 (same as spear)
and this last one shows a copper pickaxe with a hitbox margin of 0.001:
For the items with the extra hitbox margin, the indicator is delayed by a couple of frames, so something is definitely going on- but I think it’s client-side rather than server-side. Perhaps the client only performs a collision raycast a fixed amount of times per second for such items? Regardless, this may be better tracked in MC-312216.
Regarding this report, I must delete your modded videos since they are not valid or useful. If you upload further videos, please make sure they are vanilla and have the debug overlay (F3) enabled and showing the game version (and possibly also the TPS chart, F3+2, if you truly believe this is tied to server ticks.)
This issue has been reviewed by our team.
Please add new, relevant information if it helps us understand or reproduce the issue. To show that you’re affected, use the vote feature rather than commenting.
If a fix is implemented, it will be listed in our official changelogs.
For major outages or urgent assistance, visit the Minecraft Help Center.
Because this has been triaged, here is a link to a document that collects the other related spear bugs similar to this one, as well as other still unfixed combat bugs: https://docs.google.com/spreadsheets/d/1D1gAJB_PjQJHlar3ljo2qrNHllCcHglTpTolnkB1RZo/edit?gid=0#gid=0
Thank you for helping us improve Minecraft! We saved your files: