Download Durability Multiplier Library — Minecraft Mods — MetaMods
Durability Multiplier Library

Durability Multiplier Library

Active

Downloads

0

Last update

2 years ago

Versions

1.18 — 1.19.3
Server
Libraries

📖 Durability Multiplier

A versatile library for Minecraft datapacks that allows configuring durability for absolutely any items - both standard, custom, and from mods.

How the system works

The library mimics the effect of the "Unbreaking" enchantment for arbitrary items, giving them extra longevity. For example, if an item has a base durability of 100 units and the multiplier is 2.0, the actual durability loss will only occur in 50% of cases - effectively doubling the item's lifespan.

Key features:

  • Fully customizable durability coefficients for each item type
  • Item ID and NBT tag recognition
  • Compatibility with "Unbreaking" and "Mending" enchantments
  • Works with all items capable of durability loss

This library needs to be embedded directly into your datapack rather than installed separately. Requires LanternLoad to function.

Differences from Smithed Custom Durability

This is not a replacement for the existing Smithed system, but a supplement that can be used alongside:

  • Allows repairing items in anvils
  • Doesn't require adding special NBT tags
  • Compatible with items from any modifications
  • Doesn't use custom descriptions to display durability
  • When losing multiple durability units at once, the value is divided by the multiplier

Using the function tag

The library calls functions from the tag to notify about events and allows making changes:

Add the required function to the tag list: data/durability_multiplier/tags/functions/v1/durability_changed.json

Example function template:

##Should be called by function tag #durability_multiplier:v1/durability_changed
##Set the durability multiplier compared to vanilla durability
##Keep in mind that your multiplier should be >= 1000, or else there is no effect.
##E.g. if you want to multiply durability by a x4.5 factor
##You'll need to put #multiplier score to 4500 (4500 divided by 1000 = 4.5)

Real-world usage examples

Configuring Simplunium armor and tools durability (x7 for leather armor, x1.2 for diamond tools)

scoreboard players set #multiplier durability_multiplier.data 7000
execute if score #head_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main head{tag:{simplenergy:{simplunium:1b}}} run function #durability_multiplier:event/head
execute if score #chest_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main chest{tag:{simplenergy:{simplunium:1b}}} run function #durability_multiplier:event/chest
execute if score #legs_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main legs{tag:{simplenergy:{simplunium:1b}}} run function #durability_multiplier:event/legs
execute if score #feet_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main feet{tag:{simplenergy:{simplunium:1b}}} run function #durability_multiplier:event/feet
scoreboard players set #multiplier durability_multiplier.data 1200
execute if score #mainhand_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main mainhand{tag:{simplenergy:{simplunium:1b}}} run function #durability_multiplier:event/mainhand

Doubling durability of all elytras on the server

scoreboard players set #multiplier durability_multiplier.data 2000
execute if score #chest_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main chest{id:"minecraft:elytra"} run function #durability_multiplier:event/chest

Specialty fishing rod and shield configuration (x3.14 multiplier)

scoreboard players set #multiplier durability_multiplier.data 3140
execute if score #mainhand_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main mainhand{tag:{ctc:{id:"diamond_fishing_rod",from:"a_certain_pack"}}} run function #durability_multiplier:event/mainhand
execute if score #offhand_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main offhand.tag.ctc{id:"diamond_fishing_rod",from:"a_certain_pack"} run function #durability_multiplier:event/offhand

Items with "Almost Unbreakable" description

scoreboard players set #multiplier durability_multiplier.data 2147483647
execute if score #head_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main head.tag.display{Lore:['[{"text":"Almost Unbreakable","italic":false,"color":"red"}]']} run function #durability_multiplier:event/head
execute if score #chest_valid durability_multiplier.data matches 1 if data storage durability_multiplier:main chest.tag{display:{Lore:['[{"text":"Almost Unbreakable","italic":false,"color":"red"}]']}} run function #durability_multiplier:event/chest

Installation and configuration

Method 1: Use datapack merging via Mitochrondria Online

Method 2:

  1. Install LanternLoad into your datapack
  2. Copy the data/durability_multiplier folder into your datapack
  3. Merge the contents of DurabilityMultiplier/data/load/tags/functions/load.json with your own
  4. Implement the API as described above
Project members
Stoupy51

Stoupy51

Developer

Created: 29 Dec 2022

ID: 19044