Skip to content

[1.21.1] Item Components

Alberto Del Villano edited this page May 23, 2026 · 4 revisions

Item Components

InsaneLib adds a data pack feature allowing you to change default item data components. You can change all the item components available here (This is an old revision of the page around 1.21.1 so should be up to date with this version).

Use the /insanelib get_data_components <item> command to get the current data component of the item (included the default ones that aren't on the current item and the ones changed by this feature).

Json go in the data/<namespace>/item_components/ folder and contain:

Key Type Info
item Identifier The item id, or item tag (prefixed with #)
components Object of component The components to override
merge_components Object of component Arrays are concatenated, objects are recursively merged, and primitives are overridden.
remove_components String list The components to remove
priority Integer When multiple json target the same item, components are merged — higher priority will override same component types

For example this file data/yournamespace/item_components/strong_diamond_sword.json will make diamond swords have 50 Attack Damage and 2000 durability.

{
    "item": "minecraft:diamond_sword",
    "components": {
        "minecraft:max_damage": 2000,
        "minecraft:attribute_modifiers": {
            "modifiers": [
                {
                    "type": "minecraft:generic.attack_damage",
                    "id": "minecraft:attack_damage",
                    "amount": 50.0,
                    "operation": "add_value",
                    "slot": "mainhand"
                }
            ]
        }
    }
}

This file data/yournamespace/item_components/no_eating_apples.json will make apples no longer edible.

{
  "item": "minecraft:apple",
  "remove_components": [
    "minecraft:food"
  ]
}

Use merge_components to deep-merge component values with the item's existing ones instead of replacing them. Arrays are concatenated, objects are recursively merged, and primitives are overridden. This is useful for adding entries to a list component (e.g. appending attribute modifiers) without discarding the item's existing values. This example will add a new attribute modifier to the item without replacing existing ones.

{
  "item": "minecraft:iron_pickaxe",
  "merge_components": {
    "minecraft:attribute_modifiers": {
      "modifiers": [
        {
          "type": "insanesurvivaloverhaul:piercing_damage",
          "id": "insanesurvivaloverhaul:piercing_damage",
          "amount": 1.0,
          "operation": "add_value",
          "slot": "mainhand"
        }
      ]
    }
  }
}

Clone this wiki locally