Skip to content
MC Command Generator

Item Modifier Generator

Beta

Stack up functions such as Set name, Set lore, Set enchantments or Set durability, each with its own chance, and see the held item's tooltip change in the preview. You get the item modifier JSON for your Java version and the /item modify command to run it.

Describe it — AI writes the command

Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.

Checking the AI…

Functions run top to bottom on the item. Each one can have a chance to apply.

Function 1
Chance
Function 2
Chance
Function 3
Chance
Function 4
Chance
Add a function
Diamond Sword
Storm BladeSharpness VUnbreaking IIIForged in a thunderstorm
  1. 1Set name
  2. 2Set lore
  3. 3Set enchantments
  4. 4Set durability
The held item before and after /item modify. Random parts show one possible roll (marked ?).

Your command · Java 26.3

116 characters
/item modify entity @s weapon.mainhand my_pack:upgrade_sword
/item modify entity @a armor.head my_pack:upgrade_sword
data/my_pack/item_modifier/upgrade_sword.json
{
  "type": "minecraft:sequence",
  "functions": [
    {
      "type": "minecraft:set_name",
      "name": {
        "text": "Storm Blade",
        "color": "aqua",
        "italic": false
      },
      "target": "custom_name"
    },
    {
      "type": "minecraft:set_lore",
      "lore": [
        {
          "text": "Forged in a thunderstorm",
          "color": "gray",
          "italic": true
        }
      ],
      "mode": "replace_all"
    },
    {
      "type": "minecraft:set_enchantments",
      "enchantments": {
        "minecraft:sharpness": 5,
        "minecraft:unbreaking": 3
      }
    },
    {
      "type": "minecraft:set_damage",
      "damage": 1
    }
  ]
}
  • Test it: hold an item and run the first line. The second changes every player's helmet, if they wear one.
  • Put the file in your data pack (or press Download data pack), drop the pack in your world's datapacks folder, then run /reload.

Raw editor

Read only — this generator writes files, edit them with the form.

How it works

An item modifier is a list of loot functions applied to an item that already exists, for example the one a player is holding: /item modify entity @s weapon.mainhand my_pack:upgrade. The functions are the same ones loot tables use, and they run top to bottom.

Java 1.17 to 1.20.4

Item modifiers arrived with /item in 1.17. The file goes in data/<namespace>/item_modifiers/ and can be one function or a list:

[{"function": "minecraft:set_name",
  "name": {"text": "Storm Blade", "color": "aqua", "italic": false}},
 {"function": "minecraft:set_lore", "lore": [{"text": "Old"}], "replace": true}]

Java 1.20.5 to 26.2

set_lore takes "mode": "replace_all" or "append" instead of replace, and set_components can make an item unbreakable, change its rarity colour, force the glint or change its stack size. From 1.21 the folder is item_modifier, enchant_randomly uses options, and treasure enchantments come from #minecraft:on_random_loot.

Java 26.3

Each function names its kind with type, its chance is one condition, and the file must be a single function, so the generator wraps several in minecraft:sequence:

{"type": "minecraft:sequence", "functions": [
  {"type": "minecraft:set_name", "name": {"text": "Storm Blade"}},
  {"type": "minecraft:set_damage", "damage": 1}]}

Bedrock has no item modifiers or /item command, so this generator is Java only.

FAQ

How do I use an item modifier?

Load the pack with /reload, hold an item and run /item modify entity @s weapon.mainhand my_pack:upgrade_sword. Other slots work too: armor.head, hotbar.0, container.5, and block containers with /item modify block <pos> container.0.

How do I repair an item with a command?

Add Set durability with 100% durability left. Turn on “Add” to repair by a share instead, for example add 25% to mend a quarter of the bar.

Why did nothing happen to my item?

Check the folder for your version (item_modifiers before 1.21, item_modifier from 1.21) and run /reload. Durability changes only affect items that can break, and a function with a chance below 100% may simply have skipped.

Can I add lore without deleting the old lore?

Yes: in Set lore choose “Add these lines under it”. That writes mode append (1.20.5+) or replace: false in older versions.

What is the difference between Set enchantments and Enchant like a table?

Set enchantments gives exact enchantments and levels. Enchant like a table rolls random enchantments the way an enchanting table does at the level you choose, so the result changes every time.