PaperMC / PaperMC/Paper

PlayerInteractEvent is not triggered when entity_interaction_range is increased

Open
#13,895 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

A PlayerInteractEvent with action = LEFT_CLICK_AIR must be triggered

Observed/Actual behavior

PlayerInteractEvent is not being triggered

Steps/models to reproduce

/attribute @p minecraft:entity_interaction_range base set 10
https://youtu.be/NhFysJaVHiA

Plugin and Datapack List

none

Paper version

the second-to-last one; it doesn't make sense

Other

This can be fixed by adding the same check as in hitEntity, but replacing entity with block and entityInteractionRange with blockInteractionRange.

else if (gameType != GameType.CREATIVE && result.getHitBlock() != null && origin.toVector().distanceSquared(result.getHitPosition()) > this.player.blockInteractionRange() * this.player.blockInteractionRange()) {
                CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelectedItem(), InteractionHand.MAIN_HAND);
            }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied /attribute command, then trace the PlayerInteractEvent handling near the hitEntity check and the interaction-range fields. Compare the existing entity-range behavior with the reported block-range condition. Done means LEFT_CLICK_AIR is triggered when the increased entity interaction range reaches a block, without triggering it when the interaction is out of range.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.