Skip to content

Fix stabbing with a spear not triggering the left-click event#13780

Open
bluelhf wants to merge 3 commits intoPaperMC:mainfrom
bluelhf:spear-interact-fix
Open

Fix stabbing with a spear not triggering the left-click event#13780
bluelhf wants to merge 3 commits intoPaperMC:mainfrom
bluelhf:spear-interact-fix

Conversation

@bluelhf
Copy link
Copy Markdown
Contributor

@bluelhf bluelhf commented Apr 12, 2026

Fixes #13779

Spears do not send block break player actions in the same way as swords, but instead their own Stab action. Because of this, the usual handling for block interaction events does not work. An additional condition is added to allow the swing packet sent for piercing weapon attacks to trigger the interaction event.

@bluelhf bluelhf requested a review from a team as a code owner April 12, 2026 20:56
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Apr 12, 2026
Copy link
Copy Markdown
Member

@Owen1212055 Owen1212055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! This isn't exactly the most ideal solution.

Rather, you should call the interaction event in the STAB action that is sent from the client. The swing detection is largely a hack.

@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Apr 25, 2026
@bluelhf
Copy link
Copy Markdown
Contributor Author

bluelhf commented Apr 26, 2026

Hey! This isn't exactly the most ideal solution.

Rather, you should call the interaction event in the STAB action that is sent from the client. The swing detection is largely a hack.

I considered that, but I was unsure how we'd go about detecting the target block. I'd rather not duplicate the ray tracing logic, and for STAB, the face and location sent in the packet are always -Y and (0, 0, 0).

bluelhf added 2 commits April 26, 2026 19:02
the only remaining bug is because of the problematic maxRange calculation (which was that way before)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

Stabbing a block with a spear does not trigger left click event

2 participants