User Tools

Site Tools


trades:trade_modifiers:single_enchantment

minecraft:single_enchantment

Enchants the given item stack with a specified enchantment and randomly picked level for that enchantment that is then clamped between 1 and the enchantment's maximum level. It also increments the wanted item stack at the specified index with the picked level using the following calculation, where picked_level is the picked level and the other parameters are used from the fields in the trade modifier:

random_integer(base_random_cost + picked_level * per_level_random_cost) + picked_level * per_level_cost

If the picked enchantment is a treasure enchantment, the added count is multiplied by 2.

Fields

Name Description Type Default Value
index The index of the wanted item stacks to target. An integer ranging from 0 to 1 inclusive.
base_random_cost The amount to randomly pick from and increment the stack by. An integer
per_level_random_cost The amount per level to randomly pick from and increment the stack by. An integer
per_level_cost The amount to increment the stack by per level. An integer
enchantments The enchantments to pick from. An enchantment, list of enchantments or hash-prefixed enchantment tag
levels The level to give the picked enchantment. An integer range

Example

{
  "type": "minecraft:single_enchantment",
  "index": 0,
  "base_random_cost": 5,
  "per_level_random_cost": 10,
  "per_level_cost": 3,
  "enchantments": "#minecraft:tradeable",
  "levels": {
    "min": 1
  }
}
trades/trade_modifiers/single_enchantment.txt · Last modified: 2024/05/14 17:48 by errorcraft