FFInjury

FFInjury

A lightweight configurable injury system. Damage can cause injuries and gives adrenaline. Injuries give debuffs and can be treated with new bandage items or sleeping. Has datapack / modding support.

8 downloads
1 followers

FFInjury

NOTE: An overall balance pass is needed, current injuries are a bit punishing. You can configure this in the mod options if you don't want to wait for a patch.

Minecraft 1.21.1 / NeoForge. Injuries that stack, give adrenaline, worsen, and can be treated.

Injury in inventory.

Overview

Taking damage can apply an injury. Each type has tiers. A new hit of the same type raises the tier instead of adding a duplicate. You can have several injuries at once; if you are at the cap, another injury gets worse instead.

Adrenaline kicks in when you are injured. It hides injury debuffs for a short time that scales with the hit. When it wears off, untreated effects come back.

Bandages treat one untreated injury at a time (hold use). Treatment suppresses that injury's debuffs and can start a heal timer. Hold Shift on an injury icon in the inventory for remaining treat and heal times.

Bandage Craft What it does
Improvised Paper + Stick + Paper. Farmer's Delight Straw can replace Paper. Treats for half of the Tier 1 heal time
Bandage Improvised + Bone Meal + String Treats for the full Tier 1 heal time
Sterilized Bandage + Honey Bottle + Redstone Treats for half of the Tier 2 heal time
Cauterizing Sterilized + Blaze Powder + Clay Ball Treats for the full Tier 2 heal time
Ethereal Cauterizing + Chorus Fruit + Ender Pearl Instantly reduces one injury by one tier

Other healing:

  • Sleeping reduces a configurable number of tiers (higher tiers first).
  • An enchanted golden apple reduces every active injury by one tier.
  • Milk does not permanently clear injuries.
  • Injuries persist until treated or healed. Death clears them.

HUD shows active injuries as item icons. Open your inventory for tooltips. Almost every layout, color, and alert option is in the client config.

Creative: injuries are off unless you enable them. That also hides icons and skips healing and effects.

Default injuries: Twisted Ankle, Ankle Fracture, Broken Leg, Bruised Ribs, Broken Ribs, Concussion, Bleeding, Burn.

Ops (/ffinjury, permission 2+): list, details, add, worsen, lessen, remove, clear.

For datapack makers

Injuries load from datapacks (and other mods' data/ folders).

data/<namespace>/ffinjury/injuries/<id>.json

Built-ins live under data/ffinjury/ffinjury/injuries/. File bleeding.json in namespace ffinjury is id bleeding. File data/mymod/ffinjury/injuries/fracture.json is id mymod:fracture. /reload picks up changes.

{
  "display_name": "Twisted Ankle",
  "description": "A rolled or strained ankle that makes quick movement painful.",
  "icon": "minecraft:leather_boots",
  "enabled": true,
  "treatable": true,
  "heal_time_multiplier": 1.0,
  "adrenaline_multiplier": 1.0,
  "damage_weights": [
    { "damage_type": "minecraft:fall", "weight": 12 }
  ],
  "effects": [
    { "min_tier": 1, "max_tier": 1, "effect": "minecraft:slowness", "amplifier": 0 },
    { "min_tier": 3, "effect": "minecraft:slowness", "amplifier": 2 }
  ],
  "attributes": [
    {
      "min_tier": 1,
      "attribute": "minecraft:generic.movement_speed",
      "amount": -0.08,
      "operation": "add_multiplied_total"
    }
  ]
}
Field Default Meaning
display_name prettified id Title on HUD, commands, tooltips
description empty Extra inventory tooltip line
icon minecraft:paper Item drawn on the HUD
enabled true If false, not rolled from damage
treatable true If false, bandages skip it
heal_time_multiplier 1.0 Scales global heal time for this injury
adrenaline_multiplier 1.0 Scales adrenaline when this injury is applied
damage_weights empty { damage_type, weight } for the damage roll
effects empty Potion effects while untreated
attributes empty Attribute modifiers while untreated

Max tier is shared: server config general.defaultMaxTier. It is not a per-injury JSON field.

Effects: min_tier / max_tier (omit max or use 0 for no cap). scale_amplifier raises the amplifier by 1 per tier above min (cap 4).

Attributes use add_value, add_multiplied_base, or add_multiplied_total. scale_amount grows the amount above min_tier.

Effects and attributes are suppressed during adrenaline or while that injury is treated.

Override a built-in by shipping the same path in a higher-priority datapack, for example <world>/datapacks/my_injuries/data/ffinjury/ffinjury/injuries/bleeding.json.

Damage chance stays in server config damage_sources.chances as damageTypeId;chance (example minecraft:fall;0.40). Missing rows use defaultChance. An injury only rolls from a hit if it lists that damage type in damage_weights.

Hurt level (highest active tier) is a separate datapack:

data/<namespace>/ffinjury/hurt_levels/<id>.json

Enable with hurt_level.enabled (off by default). Fields: min_hurt_level, stop_regen, regen_multiplier, effects, attributes. Matching rules combine.

For other mods

Mod id ffinjury. Package com.fyxe.ffinjury.api.

[[dependencies.yourmod]]
    modId="ffinjury"
    type="optional"
    versionRange="[0.6.0,)"
    ordering="NONE"
    side="BOTH"

Prefer InjuryAPI over writing the player attachment directly.

Queries (client and server): hasAnyInjury, getInjuryCount, getHurtLevel, getInjuryType, hasInjury, getTier, isTreated, isHealing, isAdrenalineActive, getInjuries, getActiveInjury, isGameplaySuppressed, isHurtLevelEnabled, getHurtLevelRegenMultiplier.

Mutations (server only): setInjuryTier, addOrIncreaseInjury, reduceInjury, healTiers, treatInjury, clearAllInjuries, grantAdrenaline. These refresh effects, sync the HUD, and fire events. Raising a tier clears that injury's treated and heal timers.

Events on NeoForge.EVENT_BUS:

Event Cancellable When
InjurySelectEvent Yes After the damage table picks a type, before apply
InjuryAppliedEvent No After add or tier increase
InjuryHealedEvent No When tiers drop
InjuryTreatedEvent No When treatment starts
AdrenalineGrantedEvent Yes Before adrenaline is applied; duration can change

Register extra types with a datapack JSON (preferred) or InjuryAPI.registerInjury("mymod:fracture", "Bone Fracture", "minecraft:bone"). Datapack JSON with the same id wins.

Ship injury JSON on both sides so clients get names and icons.

What's with the FF prefix?

It stands for Fyxe's Features! Its a clean way to easily find all of my mods when changing configs or creating packs. Mods that are a part of the "FF" system are usually smaller and unintrusive.

Feedback

If you have any ideas for improvements, questions, or concerns, I am open to communicating through email: [email protected]