Topic category: Help with Minecraft modding (Java Edition)
I've been working on this for a couple of days now and can't seem to get it working. In my mod, each player has a special item that gives special abilities. I have a couple of requirements for these when it comes to a player's death:
- If a player dies from PVP damage - the special item drops normally and the player does not respawn with the special item.
- This works just fine using the Entity Dies trigger and checking the event source to set a player persistent variable
- If a player dies from a mob - the special item does not drop and player respawns with item
- This also works fine using the same method as above
- If a player dies any other way, the item should not drop and player should respawn with the item
- This is what I cannot get working. I can respawn with the item but can't keep it from dropping.
I've confirmed that the entity dies trigger does not get called if there's not a source entity, so drowning, falls, fire, lava, etc type deaths. I've tried using the entity hurt trigger looking for if health equals zero and if true, removing the item, but this doesn't work either. I also tried an on player tick trigger with the same check on health but that didn't work.
My goal is just to keep from having a ton of duplicates of these special items from non PVP player deaths so I'm open to other ideas. I'm currently at my wits end trying to get this working. I'm using 2025.2 but started with 2025.1.