Skip to content

Item Attribute Modifiers

TheDeathlyCow edited this page Apr 23, 2024 · 7 revisions

Item Attribute Modifiers (Experimental)

Item attribute modifiers allow datapacks to modify the default attributes of items easily. This is particularly useful for mod pack developers who want to add attributes to non-Thermoo based modded armors. It allows for attributes to be applied to items based on both tags and item IDs.

⚠️ This feature is still experimental and could change or even be removed in future versions of Thermoo. A particular issue is that it could cause some lag issues when there are a lot of attribute modifiers defined by the datapack and a lot of item stacks are created at once. Furthermore, MC 1.20.5's changes to item stack NBT may make this almost entirely redundant or broken. Proceed with caution!

Example JSON file

JSON files should be placed in data/<namespace>/thermoo/item_attribute_modifier/<path>.json.

{
    "attribute": "thermoo:generic.heat_resistance",
    "modifier": {
        "uuid": "413a10a0-bf0b-47db-a9a9-2eb3dda3bbaf",
        "name": "Test",
        "value": -1.0,
        "operation": "addition"
    },
    "item": {
        "items": [
            "minecraft:diamond_helmet",
            "minecraft:iron_helmet",
            "minecraft:leather_helmet"
        ],
        // you can also use a tag here
        "tag": "example:all_helmets"
    },
    // replace with any equipment slot, like chest, legs, feet, mainhand, offhand
    "slot": "head",
    // boolean value, false by default. See below for an explanation.
    "require_preferred_slot": false
}

The require_preferred_slot field only applies the modifier if the given slot is the item's preferred slot. For example: if the item is a helmet, then it only applies to the head slot. If this is true and the item does not have a preferred slot, then the preferred slot will fall back to the main hand. This is useful when using tags that overlap different types of equipment across multiple item attribute modifiers, but you only want to apply the modifier to one slot.