How to save a player's inventory on death?
I am trying to save the items in a player's inventory at the time of their death, to give them back some, but not all of the items.
I already have a function that saves the player's inventory in storage (works correctly when run manually). I also have an advancement that is obtained on death and triggers this function. However, no items get saved. I assume this is because Minecraft is saving the items the player has on the death screen - none, because they're already dropped on the ground.
Is there any way to do this without setting
Continue to help postkeepInventory
to true? I don't need the player to keep all of the items, so changing the gamerule would require me to make additional functions that manually drop the items the player isn't supposed to keep and my lazy ass doesn't want to make more functions than necessary.