[Bug] Fix for MC-46766 introduces more bugs
pau101 opened this issue ยท 0 comments
Bug Description
The included fix for MC-46766 does not actually cancel an ongoing block destroy if game mode is suddenly updated to spectator. When leaving spectator the destruction will continue where it left off. This is due to the patch simply canceling the method outright with no attempt to MultiPlayerGameMode#stopDestroyBlock
.
In addition, while in spectator and having opened any screen such as the inventory the player is no longer able to punch a mob to begin spectating it. This is due to
Minecraft#missTime
being nonzero preventing an attack from occurring which is set to 10000 when a screen is open. The miss time value is decremented in Minecraft#tick
and is only reset to zero in Minecraft#continueAttack
when the attack key is not being held/otherwise disabled.
How to Reproduce?
Block destruction:
- Set up two command blocks, first one setting player to spectator, and second to survival with a delay in between triggered by a pressure plate
- Start mining a block
- Walk on pressure plate
- Wait
- Notice breaking continues without needing to start mining again
Mob spectate:
- Spawn a pig
- Enter spectator
- Open and close inventory
- Punch pig
- Notice nothing
Expected Behavior
The fix for MC-46766 should stop block destruction in spectator mode while not breaking attack functionality.
Proposed solution:
Rewrite the mixin to use @ModifyArg
inside Minecraft#handleKeybinds
to pass false into Minecraft#continueAttack
when spectator.
Version
1.19.4+1.0
Fabric/Quilt Loader Version
0.11.2 for 1.19.4
Logs or additional context
No response
Has not been reported.
- I made sure this bug hasn't already been reported.
Is on most update to date version.
- I made sure I am using the most up to date fabric/quilt loader and mod version.