[SPIGOT-7806] Drops in PlayerDeathEvent and EntityDeathEvent ignore the origin of the drop for Location Created: 30/Jun/24  Updated: 25/Dec/24  Resolved: 06/Jul/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Doc Assignee: Doc
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Duplicate
is duplicated by SPIGOT-7816 Regression: Dying players drop their ... Resolved
Relates
relates to SPIGOT-7800 Dying players drop items at wrong pos... Resolved
relates to SPIGOT-7816 Regression: Dying players drop their ... Resolved
Version: 1.21
Guidelines Read: Yes

 Description   

Based in

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/aac911d2634a2e51023fa39c3b015b590b46914c#nms-patches%2Fnet%2Fminecraft%2Fserver%2Flevel%2FEntityPlayer.patch

https://hub.spigotmc.org/jira/browse/SPIGOT-7800

https://hub.spigotmc.org/jira/browse/SPIGOT-7801

Currently all the drops are managed in the same list passed to events, this ignore the "origin" and can cause a diff behaviour from vanilla where:

  • LootTable
    • This spawn in the feet of players with not alterations in location
  • Inventory
    • This spawn -0.3 from eyes

For handle this the options can be:

  • In the events move the drops from loottable to another method like getLootTableDrops() and remove from getDrops(), currently a breaking thing
  • Internally track what items are from what origin and track changes in that item but this is just an horror in maintenance...


 Comments   
Comment by Grant Gryczan [ 05/Jul/24 ]

Thank you. The PR fixes both issues!

Comment by md_5 [ 05/Jul/24 ]

(--rev 1.21 --pr craftbukkit:1445 should be the correct arguments for that I think)

Comment by Doc [ 05/Jul/24 ]

Ok i make https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1445/overview with a suggestion for just mark the item added for inventory internally and check that in the event this allow detect (in case other plugins not mess with the items added) the behaviour for the items.

I test the PR with Graves for https://vanillatweaks.net/picker/datapacks/ and generate correctly the grave with the items of the inventory

 

GrantGryczan if you use BuildTools can try the PR for any additional test or comments.

Comment by Grant Gryczan [ 05/Jul/24 ]

It's worth noting data packs (such as Graves from Vanilla Tweaks) sometimes use a player loot table to save data from before the player died (without requiring /gamerule keepInventory true). It's otherwise impossible to do so (at least without saving the player's NBT data every tick, which would be just about the laggiest thing a data pack can do). The loot table would contain an item that copies data from the player onto it via an item modifier, so that the data is persisted and can be read after the player dies. And with this bug, any data packs that rely on this method of saving player data on death (such as items from their inventory or how much XP they had) won't find the loot table item.

Comment by Grant Gryczan [ 04/Jul/24 ]

Correction: the inventory should spawn -0.3 from eyes.

Generated at Tue Apr 15 09:41:38 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.