Dodge Cruel Death
by electroluxv2
Dodge Cruel Death is a Fabric mixin that changes how dropped items behave when an entity drops them, so the item stays alive for a very long time.
What it does
The mod injects code into the dropItem method of Minecraft's Entity class. The injected method, named onDropItem, runs after the original method has created and returned the dropped item entity, so the change applies only once the item exists. It receives the dropped stack, whether the item was thrown randomly, whether the entity keeps ownership of it, and a callback object that exposes the original method call and its return value.
When the injected code runs, it first checks whether the dropped item entity is still alive. If it is not, the method returns without doing anything. If it is, the mod sets the item's age to Short.MIN_VALUE + 1. Setting the age to exactly Short.MIN_VALUE would make the item live indefinitely, so the one-step offset leaves the age very low while still allowing the item's lifetime to be counted. The item therefore lasts almost indefinitely.
The mod is published for Fabric only, for the single game version 1.21, and is released under the MIT License as open source. Either side can run it, and neither needs it. Source code and an issue tracker are linked from the project page.
Key features
Dropped item lifetime
Items dropped by entities receive a very low age value, so they remain in the world for a long time.
Method injection
The change is made with a Java mixin into the original dropItem method, leaving the rest of the game code untouched.
Alive check
Only dropped item entities that are still alive are modified; others are left alone.
Post-creation hook
The code runs once the item is created and returned, so it acts only after a successful drop.
Compatibility
Latest build for each game version and loader.
Only full game releases are shown. This mod publishes no snapshot builds.
Questions
Does Dodge Cruel Death need Fabric API?
Does the mod have to be installed on the server?
Which game version does Dodge Cruel Death support?
More from electroluxv2
What the author says
If the entity that dropped the item is still alive, the method returns immediately and does nothing. This ensures that the rest of the code only executes if the entity is not alive. The code retrieves the returned ItemEntity object from the original dropItem method using cir.getReturnValue(). If the returned entity…
Official listing
- Modrinth page
- modrinth.com/mod/dodge-cruel-death
- Owner
- electroluxv2
- Published
- 2024-07-23
- Updated on Modrinth
- 2024-07-24
- Facts verified
- 2026-10-15
