mojira.dev
MC-312214

Spear attack registration does not register the same tick that the user attacks

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. This is demonstrated in the attachment “Demo 1” and its slow motion version.

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. This is demonstrated in the attachment “Demo 2” and its slow motion version.

Essentially, this issue makes it so you must be hovering over a mob for at least 2 ticks, and also cannot move off of that mob within 1 tick of your attack. This is a critical issue for spears, and affects all items that use the type “stab”.

Attachments

Comments 7

Thank you for helping us improve Minecraft! We saved your files:

[media][media][media][media]

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.)

Like I said I tested this issue and it still happens with spears that are modified to have a hitbox margin of 0. Your videos do not show the issue I had in the videos you deleted for irrelevant reasons.

Can you confirm that the issue does not happen for spears with the attack_range component removed? I do not get any indicator lag for such spears.

[media]

SeaOfPixels

(Unassigned)

Unconfirmed

26.3, 26.4 Snapshot 3

Retrieved