The Best Resource for Minecraft
The Best Resource for Minecraft

Incantesimi personalizzati senza mod: il formato incantesimo data-driven

Incantesimi personalizzati senza mod: il formato incantesimo data-driven

Gli incantesimi sono diventati JSON per data pack, quindi per crearne uno personalizzato non servono mod. Ecco la struttura del file, i componenti dell'effetto che fanno davvero qualcosa e come renderlo ottenibile.

Gli incantesimi prima erano hardcoded. Ora sono dati dei data pack, il che significa che un incantesimo davvero personalizzato (nuovo nome, nuovo effetto, nuova curva di costo) è un file JSON.

Dove si trova

data/<namespace>/enchantment/lightning_strike.json

Singolare enchantment/, like every other datapack category since the rename.

Il file minimo

{
  "description": { "translate": "enchantment.my_pack.lightning_strike" },
  "supported_items": "#minecraft:enchantable/sword",
  "weight": 2,
  "max_level": 3,
  "min_cost": { "base": 10, "per_level_above_first": 10 },
  "max_cost": { "base": 50, "per_level_above_first": 10 },
  "anvil_cost": 4,
  "slots": ["mainhand"]
}

Questo basta per ottenere un vero incantesimo che compare al tavolo e viene mostrato sull'oggetto. Non fa ancora nulla: il comportamento è separato.

  • weight è la rarità al tavolo per incantesimi. Vanilla usa 10 per comune, 1 per molto

raro. È relativo, non una percentuale.

  • slots determina dove l'incantesimo è attivo: mainhand, offhand, armor,

head, and so on. Omit it and the enchantment never applies.

  • supported_items accetta un tag per oggetti o un elenco. #minecraft:enchantable/* tags

esistono già per i gruppi pertinenti.

Fargli fare qualcosa

effects attaches behaviour:

"effects": {
  "minecraft:post_attack": [{
    "effect": { "type": "minecraft:run_function", "function": "my_pack:strike" },
    "requirements": { "condition": "minecraft:random_chance", "chance": 0.25 }
  }]
}

run_function is the escape hatch — anything a function can do, the enchantment can do. The built-in effect types cover damage, knockback, durability, item drops and attributes without needing a function at all, and they are cheaper.

requirements takes any predicate, so gating on the target's type, the weather, or a random chance is one block of JSON.

Dare un nome

description is a text component, so a hardcoded name works:

"description": { "text": "Lightning Strike", "color": "gold" }

ma un translate key plus a language file in a resource pack is what makes it read correctly for players in other languages — the same reason this site takes game terms from Mojang's own translations.

Renderlo ottenibile

Tre metodi, e di solito ne vorrai più di uno:

  • Tavolo per incantesimi — automatico una volta weight and the cost curve are set.
  • Tabelle dei bottinienchant_randomly with your enchantment listed, or

enchant_with_levels if it should compete on cost.

  • Scambi dei villici — un libro incantato con il tuo incantesimo nell'oggetto dello scambio.

Aggiungerlo a #minecraft:in_enchanting_table is what makes the table offer it at all; the tag is easy to forget and produces an enchantment that exists but never appears.

Crea il JSON dell'incantesimo e la sua controparte per le finiture delle armature, con i tag e gli slot impostati, nel Generatore di incantesimi e finiture personalizzati.

Prova lo strumento: Custom Enchantment & Trim Builder →