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 into ItemSpawnEvent, indicating the entity that caused the item to spawn, and a method indicating how the item spawned (a Cause enum?)
Describe alternatives you've considered.
The workaround for doing stuff with item death entities at the minute involves:
- Listening to the PlayerDeathEvent with a high priority (to handle other plugins modifying the drops)
- Marking or saving the dropped ItemStacks in a list
- Iterate through all item entities within a radius of where the player died and checking against the saved list / marked item meta (in a delay task to account for the ticks it takes the items to spawn)
Which is quite clunky and expensive, and not guaranteed to be instantaneous when the items spawn.
Other
No response
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
EntityintoItemSpawnEvent, indicating the entity that caused the item to spawn, and a method indicating how the item spawned (aCauseenum?)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