-
Notifications
You must be signed in to change notification settings - Fork 0
26.1.2 Damage Reduction and Probability Math
| Mathematical Property | Value |
|---|---|
| Base Integer Division | |
| Remainder | |
| Random Evaluation | level.getRandom().nextInt(multiplier) < remainder |
| Integer Overflow Cap |
Integer.MAX_VALUE ( |
| Zero-Damage Floor | Guaranteed |
In Minecraft, most tool uses deal 1 point of damage to the item (e.g. mining a stone block with a pickaxe, hitting a mob with a sword).
Under standard integer division:
If integer truncation were applied directly, any multiplier
To achieve mathematically exact durability extension, Durability Multiplier implements Probabilistic Rounding in DurabilityHelper.reduceDamage(int, ServerLevel, ItemStack):
int base = originalAmount / multiplier;
int remainder = originalAmount % multiplier;
if (remainder > 0 && level.getRandom().nextInt(multiplier) < remainder) {
base++;
}
return base;| Multiplier | Base (1 / M) |
Remainder (1 % M) |
Probability of Taking 1 Damage | Probability of Taking 0 Damage | Expected Uses per Point |
|---|---|---|---|---|---|
| 1x | 1 |
0 |
|||
| 2x | 0 |
1 |
|||
| 3x | 0 |
1 |
|||
| 4x | 0 |
1 |
|||
| 5x | 0 |
1 |
|||
| 10x | 0 |
1 |
|||
| 100x | 0 |
1 |
$\text{Base} = 5 / 3 = 1$ $\text{Remainder} = 5 % 3 = 2$ $\text{Chance of taking 2 damage} = \frac{2}{3} \approx 66.67%$ $\text{Chance of taking 1 damage} = \frac{1}{3} \approx 33.33%$ -
Expected damage:
$1 \times \frac{1}{3} + 2 \times \frac{2}{3} = \frac{5}{3} = 1.667$ damage (exactly$\frac{1}{3}$ of 5).
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