Fire PlayerPickEntityEvent for Mannequins
Nobody has claimed this yet.
- 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?
Yes. Pretty much every entity fires PlayerPickEntityEvent when middle clicked. That not being the case for entities without spawn items associated was not a problem, but mannequins do not have the item associated and have a use case for it for plugins that want to add items allowing for spawning an npc from the egg picked from another npc (cloning entity), or even just reacting to the interaction client already sends packet for.
This is caused by this check that returns before firing the event if no default item is found for the entity clicked.
Describe the solution you'd like.
My proposed solution would be moving the event firing before the check if there's a spawning item associated with the entity and firing the event in cancelled state if there is no item instead of not firing the event at all. This would allow keeping current behavior and let future plugins just account for the pick entity input player can do on any targetable entity.
Describe alternatives you've considered.
- fork paper and fire the event earlier in the chain (only enables the behavior in the fork)
- listening to and parsing the packet manually (other plugins might also do this and incompatibilities will arise. API is much preferred)
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch at the check around line 557 that returns when no default item is found. Trace the existing PlayerPickEntityEvent flow and preserve current behavior for entities with spawning items. Done means mannequins fire the event in a cancelled state while existing entity picking continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100