-
Notifications
You must be signed in to change notification settings - Fork 0
26.1.2 Damage Reduction and Probability Math
| Mathematical Property | Value |
|---|---|
| Total Damage Units | |
| Base Integer Division | |
| Remainder | |
| Random Evaluation | random.nextInt(percent) < remainder |
| Integer Bounds |
|
| Zero-Damage Floor | Guaranteed |
Durability Multiplier is engineered to never mutate item NBT or DataComponents stored in world save files.
- Zero World Contamination: Mutating item max durability permanently bakes modified values into player inventories, chests, and world save files. If the player uninstalls the mod or changes GameRules, items would remain permanently altered or broken.
-
Instant Hot-Reloading: Changing
/gamerule ig:dm_percent_globalimmediately takes effect on every item in the world without requiring inventory scanning or item recreation. - Mending & Anvil Repair Balance: Vanilla anvil repair costs and XP Mending absorption calculate based on standard item durability without integer overflow or repair penalties.
Instead, the mod dynamically intercepts damage events at runtime via ItemStackDurabilityMixin and applies Probabilistic Damage Scaling (the exact same architecture used by Minecraft's native Unbreaking enchantment).
When an item is used (dealing originalAmount damage, typically 1 for standard block breaks and tool swings):
public static int calculateScaledDamage(int originalAmount, int percent, RandomSource random) {
if (originalAmount <= 0)
return 0;
if (percent <= 0 || percent == 100)
return originalAmount;
int totalDamageUnits = originalAmount * 100;
int baseDamage = totalDamageUnits / percent;
int remainder = totalDamageUnits % percent;
if (remainder > 0 && random.nextInt(percent) < remainder) {
baseDamage++;
}
return baseDamage;
}| Percentage | Effective Multiplier | Base (100 / P) |
Remainder (100 % P) |
Chance of Damage per Hit | Expected Damage per Hit | Relative Durability |
|---|---|---|---|---|---|---|
| 25% | 4 |
0 |
|
|
||
| 50% | 2 |
0 |
|
|
||
| 75% | 1 |
25 |
|
|
||
| 100% |
|
1 |
0 |
|
|
|
| 150% | 0 |
100 |
|
|||
| 200% | 0 |
100 |
|
|||
| 300% | 0 |
100 |
|
|||
| 500% | 0 |
100 |
|
|||
| 1000% | 0 |
100 |
|
Because damage absorption is evaluated independently on every hit (just like Vanilla Unbreaking):
- At 500% (5x), every hit rolls an independent
$20%$ chance of taking 1 damage and$80%$ chance of taking 0. - In short trials, a tool might take 1 damage after 2 hits or after 8 hits.
- Over the entire lifespan of the tool (e.g. 1,561 uses on a Diamond Axe), the total block breaks converge mathematically to
$\approx 7,805$ uses (exactly$5\times$ ).
Let
Over thousands of uses, the law of large numbers guarantees that total durability converges to exactly
Durability Multiplier is engineered with ❤️ by Dasik (Rifaditya) | Licensed under GNU General Public License v3.0 (GPL-3.0-or-later).
📌 Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
- 26.2 Hub
- 26.2 Multipliers
- 26.2 God Mode
- 26.2 Damage & Math
- 26.2 Item Classification
- 26.2 Dynamic Registry
- 26.2 Tooltips & HUD
- 26.2 Network Protocol
- 26.2 GameRules Table
- 26.2 Commands & Admin
- 26.2 Advancements
- 26.2 Configuration
- 26.2 ModVersionGuard
- 26.2 Architecture & Mixins
- 26.2 Developer Setup
- 26.2 API & Addons
- 26.2 FAQ & Diagnostics
- 26.1.2 Hub
- 26.1.2 Multipliers
- 26.1.2 God Mode
- 26.1.2 Damage & Math
- 26.1.2 Item Classification
- 26.1.2 Dynamic Registry
- 26.1.2 Tooltips & HUD
- 26.1.2 Network Protocol
- 26.1.2 GameRules Table
- 26.1.2 Commands & Admin
- 26.1.2 Advancements
- 26.1.2 Configuration
- 26.1.2 Architecture & Mixins
- 26.1.2 Developer Setup
- 26.1.2 API & Addons
- 26.1.2 FAQ & Diagnostics