PaperMC / PaperMC/Paper

Missing specific API around interacting with the world while holding items

Open
#12,322 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

Is your feature request related to a problem?

I'm currently trying to detect when a player interacts with an item, here I mean just right/left click with it. We currently can only use the PlayerInteractEvent, which is called in a number of other cases, because hand swinging also triggers it with an action of LEFT_CLICK_AIR.

Describe the solution you'd like.

I'd like a way to distinctively detect when a player right/left clicks with an item, including the information about the click, like in the PlayerInteractEvent aka. with left click block, left click air etc. and knowledge about the item.

I partly want this for GUIs that are opened when a player left clicks with an item: Using the PlayerInteractEvent would also open the GUI when holding the item being detected and dropping any "other" item in the inventory which is not wanted.

I'd specifically prefer a new event over additional information in the PlayerInteractEvent, in order to reduce the usage of said event because of its high usage.

Describe alternatives you've considered.

see broad description above

Other

No response

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

Start by reviewing the existing PlayerInteractEvent and the issue's distinction between hand swinging and item clicks. Define the new event's click information and item context, then verify that it avoids triggering for unrelated interactions and supports the described GUI use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.