Add a way of getting the Item entities dropped when a player dies #10603
Replies: 4 comments
-
Why only for Another idea is to add method like |
Beta Was this translation helpful? Give feedback.
-
Yeah, fair. I'll amend the issue description.
EDIT: I misread. This actually seems like a sensible idea, maybe? You'd still need a way of knowing how the entity spawned the item (I only want the items spawned by a player dropping them). Perhaps a Cause enum? |
Beta Was this translation helpful? Give feedback.
-
Just noticed this was implemented in #7332, but was closed due to being stale :( |
Beta Was this translation helpful? Give feedback.
-
I found a workaround for that |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem?
I'd like to be able to access and edit the item entities a player drops when they die (not just the ItemStacks) - for example, to mark them as "owned" by another user, changing their despawn time, moving them in the game world, etc - things not possible with the itemstack list exposed by the death event.
This was possible for a time with #7650. However, this change was reverted due to plugin incompatibilities (#10046).
Describe the solution you'd like.
Consider introducing a (Player/Entity)DropItemOnDeath, or similar, to avoid breaking plugin compatibility while providing API to access item drops entities when they spawn in.
EDIT: A suggestion by molor was to add a method returning a nullable/optional
Entity
intoItemSpawnEvent
, indicating the entity that caused the item to spawn, and a method indicating how the item spawned (aCause
enum?)Describe alternatives you've considered.
The workaround for doing stuff with item death entities at the minute involves:
Which is quite clunky and expensive, and not guaranteed to be instantaneous when the items spawn.
Other
No response
Beta Was this translation helpful? Give feedback.
All reactions