You are a senior Minecraft Fabric mod engineer. Build a complete, COMPILING, client-side mod from the spec below. It will be built by an AI coding tool, so keep it simple, small, and robust.
# SPEC (PART 1: DEATH MESSAGES ONLY)
Platform: Fabric (Loader + Fabric API), CLIENT-SIDE ONLY (fabric.mod.json environment "client"). Works on any server, vanilla ones included, and in singleplayer.
Minecraft version: 1.21.11
Language: Java 21
Build tool: Gradle (Fabric Loom), official Mojang mappings
Mod name: DeadSoulLaughs. Mod ID: deadsoullaughs.
IDEA:
When the player dies, the vanilla death screen gets a hilarious roast chosen from the exact cause of death, the killer, and the moment. Every death feels personal. No animations or pixel art in this part.
HARD CONSTRAINTS
- No image, sound, or model files. Text is drawn with GuiGraphics only.
- Max 12 source files. Use Fabric API ScreenEvents (AFTER_INIT and afterRender for DeathScreen). Use at most ONE small accessor mixin, only to read DeathScreen's cause-of-death Component (verify the field name in 1.21.11 mojmap; if it fails, use the generic pool).
- Never hide or alter vanilla title, text, or buttons. Never intercept clicks. Respawn and Title Screen must always work. Draw in the bottom third of the screen.
- GuiGraphics changed in recent versions. Verify signatures, never invent methods.
1. CAUSE DETECTION
- Read the Component as TranslatableContents. Use the key (death.attack.*, death.fell.*) and its args. Arg 0 is the victim, arg 1 is usually the killer, arg 2 the weapon on ".item" variants.
- Killer: if arg 1 is translatable with key entity.minecraft., that id picks a mob pool. If it is a plain name and the key is death.attack.player*, use the pvp pool with {killer} and {weapon}. Anything else uses the generic mob lines.
- Put the key-to-pool mapping in assets/deadsoullaughs/death_causes.json so it can be extended without code. Verify all keys starting with "death." in assets/minecraft/lang/en_us.json of 1.21.11 and map every one. Log each unmapped key once to latest.log (debugLogUnknownCause).
- Mapping:
death.attack.fall, death.fell.accident.generic -> fall
death.fell.accident.ladder -> fall_ladder
death.fell.accident.vines, weeping_vines, twisting_vines -> fall_vines
death.fell.accident.scaffolding -> fall_scaffolding
death.fell.assist, death.fell.killer, death.fell.finish -> fall_pushed
inFire, onFire -> fire | lava -> lava | hotFloor -> magma | drown -> drown | starve -> starve
inWall -> suffocation | cramming -> cramming | cactus -> cactus | sweetBerryBush -> berry
stalagmite, fallingStalactite -> dripstone | anvil, fallingBlock -> anvil | outOfWorld -> void
lightningBolt -> lightning | magic, indirectMagic -> magic | wither -> wither_effect | freeze -> freeze
fireworks -> fireworks | explosion, explosion.player -> explosion | badRespawnPoint -> bed_explosion
flyIntoWall -> elytra_wall | thorns -> thorns | sting -> bee_sting | dragonBreath -> dragon_breath
arrow -> arrow | trident -> trident | fireball, witherSkull -> fireball | spit -> spit
mace_smash -> mace | sonic_boom -> sonic_boom | wind charge keys -> wind_charge
genericKill -> kill_command | player, *.player -> pvp | generic and everything else -> generic
- Mob pools by killer entity id: zombie, husk, drowned, skeleton, stray, bogged, creeper, spider, cave_spider, enderman, blaze, ghast, wither_skeleton, piglin (also piglin_brute), zombified_piglin, hoglin (also zoglin), vindicator, evoker, vex, pillager, ravager, witch, slime (also magma_cube), guardian (also elder_guardian), warden, silverfish, endermite, shulker, phantom, iron_golem, wolf, polar_bear, goat, ender_dragon, wither, creaking, breeze, rabbit, pufferfish.
2. MOMENT SNAPSHOT (updated every client tick while alive, so it is reliable at death)
- Track: totem in inventory but not in either hand, water bucket in inventory, netherite or diamond armor worn, XP level, riding entity type, dimension, biome (deep dark, ocean), night, thunderstorm, daylight, distance from world spawn (verify the 1.21.11 API for spawn position, skip near/far contexts if unsure), held item class (pickaxe, sword, bow, fishing rod, food, empty), no armor, 3+ stacks of cobblestone/dirt/deepslate, edible food in inventory, seconds alive since last respawn.
3. LINE SELECTION (no line repeats within the last 10 shown, remembered in stats.json)
- Main line: mob pool 60% (if a killer pool exists, else cause pool). Otherwise cause pool. Fallback generic.
- 2% chance: a "legendary" line replaces the main line, shown in animated gold with a "LEGENDARY ROAST" tag.
- Bonus line: with bonusChance (0.55), pick one matching [ctx:*] line by the priority order listed in section 4 of the library.
- Footer line (gray): death count milestone, quick repeat, same cause twice or three times, hardcore, long or short life.
4. DISPLAY
- Main line: rainbow wave text (per-character HSV color animation), shadow, gentle bobbing, word-wrapped to 80% of screen width, on a semi-transparent dark panel with an animated rainbow border.
- Bonus line: gold italic. Footer: small gray. Placeholders: {player} {killer} {weapon} {count} {xp} {minutes} {seconds} {distance}.
5. STATS: death count per world (singleplayer level name or server address), last shown lines, last cause, last death time, all in config/deadsoullaughs/stats.json (versioned, atomic writes, async).
6. CLIENT COMMANDS
- /deadsoullaughs preview [cause] [mob]: opens a safe PreviewScreen (own Screen subclass, Esc closes) using the same overlay, for example "preview lava" or "preview explosion creeper".
- /deadsoullaughs list: prints all cause and mob pool names. /deadsoullaughs reload.
7. CONFIG config/deadsoullaughs/config.json: enabled, bonusChance (0.55), legendaryChance (0.02), rainbow (true), showFooter (true), showDeathCount (true), noRepeatMemory (10), debugLogUnknownCause (true). Safe defaults on missing keys.
Default messages:
- cmd.preview: "&aShowing death screen preview. Press Esc to close."
- cmd.reload: "&aDeadSoulLaughs reloaded."
- cmd.unknown_cause: "&cUnknown cause. Use /deadsoullaughs list."
- hud.death_count: "Death #{count} in this world"
- hud.legendary: "LEGENDARY ROAST"
ROAST LIBRARY
Convert this into assets/deadsoullaughs/roasts.json EXACTLY, dropping or rewording nothing. A user override file config/deadsoullaughs/roasts.json is merged on top. Then add 3 more original lines per section in the same tone (clean, no slurs, no swearing, no self-harm or real-world harm jokes).
== 1. CAUSES ==
[cause:fall]
- Gravity: 1. {player}: 0.
- You tried to fly. The ground said no.
- Falling is just flying with a very short deadline.
- Bold of you to assume the floor would move.
- Newton called. He says "told you so".
- That landing was a 2/10. The splat was a 10/10.
- The ground was right there. It always is.
[cause:fall_ladder]
- You fell off a ladder. A LADDER.
- Ladders are not a suggestion, they are a lifestyle.
- You had one job: climb.
[cause:fall_vines]
- Vines: 1. Your confidence: 0.
- You trusted a plant. That was your first mistake.
[cause:fall_scaffolding]
- Scaffolding is for building, not for bungee jumping.
- You fell off scaffolding. The scaffolding did not even fall.
[cause:fall_pushed]
- You didn't fall. You were assisted.
- {killer} gave you wings. Temporary ones.
- Someone helped you reach the ground faster.
[cause:lava]
- You looked at lava and thought "probably fine". It was not fine.
- Lava is not a hot tub, {player}.
- Your items said goodbye. They had a good run.
- Swimming in lava: a bold lifestyle choice, a short one.
- You swam in lava. Briefly. Very briefly.
- That wasn't water. It never is. Check twice.
[cause:fire]
- You are now a crispy {player}.
- Fire: hot. You: briefly hotter.
- Stop, drop and roll. You did none of those.
- Well done. Medium rare.
- Fire doesn't care about your plans.
[cause:magma]
- That block was hot. The name was a clue. MAGMA block.
- Hot floor is not a new dance. Stop dancing.
- Pro tip: sneak. Sneaking is free.
[cause:drown]
- Fun fact: you are not a fish.
- Bubbles were your friends. You ignored them.
- The ocean says: nice try.
- You forgot to breathe. Your body does it automatically.
- Water: 1. Lungs: 0.
[cause:starve]
- The food was RIGHT THERE.
- Hunger bar: empty. Brain: also empty.
- Bread is not a suggestion.
- You starved in a game with infinite cows.
- The cow just watched. Respectfully.
[cause:suffocation]
- You got stuck in a wall. The wall won.
- Blocks are not a hug. Stop trying to hug them.
- Physics said "no". Physics said it loudly.
[cause:cramming]
- Too many mobs, not enough personal space.
- You were squished. Respectfully.
[cause:cactus]
- You hugged a cactus. Voluntarily.
- Plants fight back, apparently.
- Cacti: green, spiky, and not interested in hugs.
[cause:berry]
- Sweet berries, sour ending.
- You were killed by a berry bush. Let that sink in.
[cause:dripstone]
- A pointy rock won. It didn't even have a weapon.
- Geology: 1. {player}: 0.
- You were stalactited. That's a verb now.
[cause:anvil]
- Anvil: 1. Skull: 0.
- Something heavy and iron-y happened to you.
- You got dropped on. By an anvil. Respect.
[cause:void]
- You found the secret exit.
- The void called. You answered.
- Next time, build a floor.
- You have discovered the end of the world. The bad end.
[cause:lightning]
- Zeus has entered the chat.
- Thunder-struck and unamused.
- The sky had beef with you.
[cause:magic]
- Potion: poisoned. You: confused.
- Splash damage, big pain.
- That wasn't a health potion. Read the label.
[cause:wither_effect]
- Wither: the only thing you can't out-heal.
- Slowly... then all at once.
[cause:freeze]
- Powder snow: cold. You: colder.
- You are now a Steve-sicle.
- You forgot leather boots. Cold lesson.
[cause:fireworks]
- You celebrated a little too hard.
- Congratulations. You are the finale.
[cause:explosion]
- That explosion had your name on it. In big letters.
- Dynamite is great! Until it's your own.
- TNT: a thing that goes boom. You were warned.
- The explosion gave you instant air travel. Landing not included.
[cause:bed_explosion]
- You tried to sleep in the Nether. In the NETHER.
- That bed exploded. It was not a bed.
- Sweet dreams were not included.
[cause:elytra_wall]
- You found out the wall is harder than the sky.
- Elytra: "Look, a wall!" You: "Where?"
- Kinetic energy: 1. Your face: 0.
- You flew into a wall at the speed of regret.
[cause:thorns]
- Your own attack hurt you. Thorns are rude.
- Don't punch prickly stuff.
[cause:bee_sting]
- A bee. A BEE. It only had one shot and used it.
- Bees: tiny, fuzzy, and apparently lethal.
[cause:dragon_breath]
- Dragon breath: the bad breath you can't mint away.
- The dragon had a bad day. You were in the way.
[cause:arrow]
- Pointy stick, sent at speed. You are now a pincushion.
- Arrow: 1. Dodging skills: 0.
[cause:trident]
- A fish stick for the win. Seriously.
- Poseidon's fork got you.
[cause:fireball]
- A flaming ball of anger got you.
- Reflecting it back was an option. You chose "ouch".
[cause:spit]
- You were spat on. Fatally.
- Llama: 1. Dignity: 0.
[cause:mace]
- Mace smash. Dignity not included.
- Heavy hits, heavier regrets.
[cause:sonic_boom]
- Warden said "sonic boom". You said "ow".
- If you can hear the heartbeat, run. You didn't.
[cause:wind_charge]
- You were blown away. Literally.
- A breeze got you. A breeze.
[cause:pvp]
- {killer} cooked you. Well done, {killer}.
- {killer} sends this death with love.
- {killer} is now insufferable. Congratulations.
- Killed by {killer} using {weapon}. A {weapon}. How rude.
- GG. {killer} says hi.
- Next time, bring a bigger sword. Or a friend.
[cause:kill_command]
- You were deleted by a command. Admin said bye.
- Death by "/kill". Efficient.
[cause:generic]
- Skill issue detected.
- Task failed successfully.
- {player} has left the chat. Forcefully.
- That went well.
- Respawn is free. Dignity isn't.
- That wasn't in the tutorial.
- A bold strategy that did not pay off.
- You were so close. Nope. Not even close.
- 10/10 effort, 0/10 results.
- Death is just a loading screen with extra steps.
- You've discovered a new way to die. Not a good one.
- Plot twist: you died.
- Another one bites the dust. It's you.
- Achievement unlocked: Poor Decisions.
- You tried. The world said no.
- Hold my potion... *crash*
- Minor setback. Fatal, but minor.
== 2. MOB KILLERS ==
[mob:zombie]
- Beaten by a zombie. A zombie. They walk in straight lines.
- The zombie only wanted a hug and your brains. It left hungry.
- Zombies are slow. You were slower.
[mob:husk]
- A husk got you. Desert tax collected.
- Even in the sun, it was too fast for you.
[mob:drowned]
- A drowned got you. Technically a zombie with a pool pass.
- You lost a fight to a soggy zombie.
[mob:skeleton]
- A pile of bones out-aimed you. Think about that.
- Dodging arrows is a skill. You are not skilled.
- Skeleton: 1. You: 0. They have no eyes.
[mob:stray]
- A frozen skeleton did that.
- Cold, fast, and accurate. Everything you're not.
[mob:bogged]
- Swamp skeleton. Poison arrows. Skill issue.
- You got bogged down. Literally.
[mob:creeper]
- That creeper only wanted a hug. A very loud hug.
- Ssss... BOOM. You heard it coming.
- Creeper hugs are not recommended.
- Creeper: 1. Your base: 0. Your face: gone.
- You looked directly at a creeper. Why.
- It hissed. You ignored the hiss. Classic.
[mob:spider]
- Spiders climb walls. You can't even climb a ladder.
- Eight legs, zero chill. One of you won.
- You were out-crawled.
[mob:cave_spider]
- Tiny, poisonous, and still better than you.
- Little spider. Big poison.
[mob:enderman]
- You looked at it. You KNEW not to look at it.
- Teleporting in your face is just rude. And effective.
- Enderman: tall, dark, and murderous.
[mob:blaze]
- The Blaze brought the fire. You brought the wrong armor.
- Fire resistance: you forgot it. Blaze noticed.
[mob:ghast]
- A crying ghost-squid did this to you.
- Ghast fireballs are very reflectable. You didn't.
- It cried. You cried louder.
[mob:wither_skeleton]
- A tall black skeleton. Skulls are a gamble.
- Wither Skeleton: 1. Your health: gone.
[mob:piglin]
- You ignored the gold. You paid the price.
- Piglin brute: no negotiation. Only hits.
- Gold boots would have saved you. Probably.
[mob:zombified_piglin]
- You hit one. Their whole crew hit back.
- Rule 1: don't poke the pigmen. You poked.
[mob:hoglin]
- It had a boar's attitude and a tank's power.
- Hoglin: pork chop energy, lethal edition.
[mob:vindicator]
- An axe, rage, and a very bad day.
- Vindicator says: no tip for you.
[mob:evoker]
- You were out-spelled.
- Fangs from the ground. Surprise!
[mob:vex]
- Tiny flying sword menace.
- It was small. You were smaller, apparently.
[mob:pillager]
- Illager crossbow, your last mistake.
- A pillager did the pillaging. You were the pillage.
[mob:ravager]
- A rhino-cow-monster hit you. It was a lot.
- Ravager: 1. Your fence: gone.
[mob:witch]
- A witch brewed your end.
- Potion master vs. you. Not close.
[mob:slime]
- You lost to a bouncing jelly.
- A cube of goo won. Be humble.
[mob:guardian]
- A spiky fish with a laser. Not your best moment.
- The ocean has plenty of eyes. And lasers.
[mob:warden]
- You made noise. In a dark place. Your funeral.
- The Warden heard you. Everybody heard you.
- Sneaking is free. You didn't.
- You were not stealthy. You were a drumline.
[mob:silverfish]
- You were beaten by a bug. A BUG.
- Silverfish: 1. Your stone: infested.
[mob:endermite]
- A tiny purple bug did that. A bug.
[mob:shulker]
- A box floated at you and won.
- Levitation, then a long fall. Shulker's special.
[mob:phantom]
- You didn't sleep. They noticed.
- Phantoms are the sleep police. You got a ticket.
- Go to bed, {player}. Please.
[mob:iron_golem]
- A giant iron fella told you "no".
- You hit a village protector. Bad idea.
[mob:wolf]
- A good boy turned bad. You did that.
- You hit a wolf. The pack hit you.
[mob:polar_bear]
- A big white bear wasn't playing.
- Don't get between a mom and her cub. Seriously.
[mob:goat]
- A goat rammed you off a cliff. Peak behavior.
- Goat: 1. Mountain climber: 0.
[mob:ender_dragon]
- The dragon is the final boss. You are the first casualty.
- You didn't beat the End. The End beat you.
- Dragon: 1. Hero: 0.
[mob:wither]
- You summoned a boss. Boss said "no".
- Wither: 1. Your confidence: 0.
- Three heads. All of them better than yours.
[mob:creaking]
- You looked at it. It stopped. You blinked. Done.
- Creaking: 1. Your eyes: out.
[mob:breeze]
- Tiny tornado, big hit.
- You got blown out of the room. And the game.
[mob:rabbit]
- You were killed by a rabbit. A bunny. Ask yourself why.
- The Killer Bunny strikes again.
[mob:pufferfish]
- You got beaten by a fish. Poison included.
- Pufferfish: tiny, round, deadly.
[mob:generic]
- Beaten by a {killer}. Let that sink in.
- {killer} sends its regards.
- Even the {killer} is embarrassed for you.
== 3. CONTEXT BONUS LINES (priority order, top first) ==
[ctx:totem_in_inventory]
- You HAD a totem. In your inventory. Not in your hand.
- A totem in your bag is just a very expensive decoration.
[ctx:water_bucket_fall]
- You HAD a water bucket. It was in your inventory. Fully functional.
- Water bucket clutch? You prefer the "no clutch" version.
[ctx:food_starve]
- You had food. In your inventory. Right there.
- Inventory: full of food. Stomach: not.
[ctx:netherite_gear]
- All that netherite... and still dead. Wow.
- Full netherite doesn't protect you from poor decisions.
[ctx:diamond_gear]
- Diamond armor, zero brain cells.
- Shiny armor, shiny mistakes.
[ctx:high_xp]
- All those XP levels, gone. A real tragedy.
- You had {xp} levels. Had.
[ctx:riding]
- You died on your steed. The steed is fine, by the way.
- Riding in style, dying in style.
[ctx:nether]
- The Nether is not a vacation spot. The brochure lied.
- Hell is hot. Shocking.
[ctx:end]
- The End. Of you.
- You came, you saw, you got ended.
[ctx:deep_dark]
- You went to the Deep Dark. In the dark. Stop.
- You visited the quietest place and made noise.
[ctx:ocean]
- The ocean is deep and unforgiving. Like your death count.
[ctx:thunderstorm]
- It was thundering. You went outside. That's on you.
[ctx:night]
- It was night. Mobs spawn at night. This is not new.
[ctx:daylight]
- You died in broad daylight. Impressive.
- The sun is out. It didn't help.
[ctx:near_spawn]
- You died near spawn. You didn't even try.
- Spawn is a few blocks away. Respectfully, how.
[ctx:far_from_spawn]
- You died {distance} blocks from spawn. Long walk back. Good luck.
- Far from home, closer to the grave.
[ctx:holding_pickaxe]
- Pickaxe in hand, death in face.
- A pickaxe is not a weapon, {player}.
[ctx:holding_sword]
- A sword in hand and still lost. Interesting.
- Armed. Dangerous. Dead.
[ctx:holding_bow]
- A bow in hand. Fail in head.
[ctx:holding_fishing_rod]
- Fishing, were we? Fish: 1. You: 0.
[ctx:holding_food]
- You died while eating. It was a last snack.
[ctx:empty_hand]
- Empty hands. Optimistic.
- Bare-knuckle. A decision was made.
[ctx:no_armor]
- No armor? Brave, and also silly.
- Armor is free to craft, my friend.
[ctx:cobble_hoarder]
- Your inventory: 90% cobblestone. Nice.
- Dying with a stack of dirt. Respect.
== 4. FOOTERS (gray) ==
[count:1]
- First death in this world. Welcome to the club.
[count:2]
- Twice already? Bold strategy.
[count:3]
- Third time's... not the charm.
[count:5]
- Death #{count}. The respawn button knows your name.
[count:7]
- Death #{count}. Lucky number? Not for you.
[count:10]
- Death #{count}. Are you doing this on purpose?
[count:15]
- Death #{count}. Dying is now a hobby.
[count:20]
- Death #{count}. Your gravestone has a gravestone.
[count:25]
- Death #{count}. A legend. A very dead one.
[count:50]
- Death #{count}. You've died more than most NPCs have lived.
[count:100]
- Death #{count}. Triple digits. Certified menace. To yourself.
[special:quick_repeat]
- That was fast. New personal record?
- Respawn speedrun: any%.
[special:same_cause_twice]
- Same cause twice. Consistency!
- You've learned nothing. Impressive.
[special:same_cause_three]
- Third time with the same cause. It's your signature move now.
[special:hardcore]
- Hardcore: over. Dignity: also over.
- One life. You had one life. Wow.
[special:short_life]
- You lived for {seconds} seconds. A personal record? Probably not.
[special:long_life]
- You survived {minutes} minutes. And then... that.
== 5. LEGENDARY (2% chance, replaces main line) ==
[legendary]
- Historians will remember this death. Not fondly. But they will.
- That death belongs in a museum.
- Somewhere, a game developer just smiled. Not because of you.
- {player}: spectacular. Spectacularly wrong.
- A dramatic reading of your death has been added to the Hall of Shame.
- If this were a movie, the audience would be screaming.
- This goes straight on the highlight reel. Of mistakes.
# RULES
1. Target ONLY 1.21.11 APIs. If unsure an API exists, say so and use the safest alternative. Never invent classes or methods.
2. The build must succeed with ./gradlew build. Give exact commands and a short file tree.
3. Fail-safe: any exception while rendering or loading is caught once, logged once, and disables the overlay for that death screen. Never crash the game, never block respawn.
4. Small focused classes (for example CauseResolver, MomentSnapshot, RoastPicker, RoastLibrary, OverlayRenderer, StatsStore), Javadoc on public classes. No hardcoded roast text in Java code.
5. No network access, telemetry, or external assets.
# OUTPUT FORMAT
1. Short plan and file tree.
2. Full code for EVERY file (including build.gradle, gradle.properties, fabric.mod.json, mixin json, death_causes.json, roasts.json with the whole library). No "..." or placeholders.
3. Build and install steps.
4. Feature checklist and test plan (use /deadsoullaughs preview [mob] and /kill, and real deaths: fall, lava, drowning, creeper).
5. Known limitations (one short list).
# NON-GOALS
- No creeper, Steve, tombstone, particles, sounds, or animations (a later part).
- No server component, config GUI, or Mod Menu dependency.
- No replacing vanilla death screen buttons or logic.
- No online features. No humor targeting real people or groups.
- Don't ask questions unless something blocks the build. Make reasonable assumptions and list them.