The Best Resource for Minecraft
The Best Resource for Minecraft

Aangepaste betoveringen zonder mods: het data-gestuurde betoveringsformaat

Aangepaste betoveringen zonder mods: het data-gestuurde betoveringsformaat

Betoveringen zijn datapack-JSON geworden, dus voor een aangepaste is geen mod nodig. Hier is de bestandsopbouw, de effectcomponenten die daadwerkelijk iets doen en hoe je deze verkrijgbaar maakt.

Betoveringen waren vroeger hardcoded. Nu zijn ze datapack-data, wat betekent dat een écht aangepaste betovering — nieuwe naam, nieuw effect, nieuwe kostencurve — een JSON-bestand is.

Waar het staat

data/<namespace>/enchantment/lightning_strike.json

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

Het minimale bestand

{
  "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"]
}

Dit levert al een echte betovering op die bij de betoveringstafel verschijnt en op het voorwerp te zien is. Het doet nog niets — gedrag staat hier los van.

  • weight is de zeldzaamheid bij de betoveringstafel. Vanilla gebruikt 10 voor gewoon, 1 voor zeer

zeldzaam. Het is relatief, geen percentage.

  • slots bepaalt waar de betovering actief is: mainhand, offhand, armor,

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

  • supported_items vereist een item-tag of een lijst. #minecraft:enchantable/* tags

bestaan al voor de logische groepen.

Het iets laten doen

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.

Een naam geven

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

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

maar een 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.

Verkrijgbaar maken

Drie manieren, en meestal wil je er meer dan één:

  • Betoveringstafel — automatisch zodra weight and the cost curve are set.
  • Loottabellenenchant_randomly with your enchantment listed, or

enchant_with_levels if it should compete on cost.

  • Dorpsbewonershandel — een betoverd boek met jouw betovering in het voorwerp van de ruil.

Toevoegen aan #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.

Bouw de betoverings-JSON en de bijbehorende harnasversiering-tegenhanger, met de ingestelde tags en slots, in de Maker van aangepaste betoveringen & versieringen.

Probeer de tool: Custom Enchantment & Trim Builder →