💔 Durability & Penalties
To strike the balance between vanilla consequence and equipment safety, Vanilla Outsider: Keep Gear introduces a deterministic durability wear calculation system.
🧮 Durability Degradation Formula
When a player dies, each preserved item undergoes durability evaluation:
$$\text{Total Wear %} = \text{Base Penalty %} + (\sum \text{Enchantment Levels} \times \text{Weight Factor %})$$
Where:
- Base Penalty: Default
10.0%(Configurable viapenaltyPercent). - Weight Factor: Default
0.1%(Configurable viaenchantmentPenaltyValue). - Sum of Enchantment Levels: Combined level of all enchantments present on the item stack.
📐 Applied Damage Calculation
$$\text{Damage Added} = \max\left(1, \text{round}\left(\frac{\text{Total Wear %}}{100} \times \text{Max Durability}\right)\right)$$
$$\text{New Damage Value} = \text{Current Damage} + \text{Damage Added}$$
WARNING
Lethal Wear Breakage: If $\text{New Damage Value} \ge \text{Max Durability}$, the item breaks completely during death and is permanently destroyed (ItemStack.EMPTY), preventing ghost item exploits.
📊 Concrete Calculation Examples
| Equipment Item | Enchantments | Total Levels | Base % | Enchant Weight % | Total Wear % | Max Durability | Damage Added |
|---|---|---|---|---|---|---|---|
| Netherite Pickaxe | Efficiency V, Unbreaking III, Fortune III, Mending I | $5+3+3+1 = 12$ | $10.0%$ | $12 \times 0.1% = 1.2%$ | 11.2% | $2031$ | $+227$ Damage |
| Diamond Sword | Sharpness V, Looting III, Unbreaking III | $5+3+3 = 11$ | $10.0%$ | $11 \times 0.1% = 1.1%$ | 11.1% | $1561$ | $+173$ Damage |
| Iron Chestplate | None | $0$ | $10.0%$ | $0.0%$ | 10.0% | $240$ | $+24$ Damage |
| Netherite Helmet | Protection IV, Respiration III, Aqua Affinity I, Unbreaking III, Mending I | $4+3+1+3+1 = 12$ | $10.0%$ | $1.2%$ | 11.2% | $407$ | $+46$ Damage |
🔮 Echo Shard Resonance Insurance
Carrying an Echo Shard (minecraft:echo_shard) functions as insurance against gear degradation:
- Upon death,
ItemPreservationEngine.checkAndConsumeEchoShard()scans the player's 36 main inventory slots. - If an Echo Shard is found, exactly 1 shard is consumed from the stack.
- The
echoResonanceflag is set totrue. - All durability degradation is completely bypassed (0 damage applied to any kept item).
- Upon respawn, the player receives:
- Green preservation confirmation.
- Aqua chat alert:
Echo Shard resonance protected your gear from durability wear! - Custom sound effect:
SoundEvents.RESPAWN_ANCHOR_DEPLETE(0.8Fvolume,1.2Fpitch).
☠️ Curse Interactions
- Curse of Vanishing (
EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP): Fully respected. Any item bearing Curse of Vanishing is completely destroyed upon death, bypassing preservation. - Curse of Binding (
EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE): Controlled bykeepBindingCurse. Whentrue(default), binding items remain equipped across death. Whenfalse, binding cursed gear is dropped to the ground at the death location.
