Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Enchantment definition

From SAS Gaming Wiki
(Redirected from Minecraft:Level-based value)

Template:Exclusive

Minecraft:Enchantments are stored as Minecraft:JSON files within a Minecraft:data pack in the path Template:Cd. Template:TOC

JSON format

Effect components

Components with value effects

These components use a value effect to change a value and an optional condition to check beforehand. The general format for them is:

Component ID Value changed Minecraft:Loot context for predicate
Template:Cd Effectiveness of the armor on the target of the attack. Template:Cd completely ineffective; Template:Cd completely effective

Template:Cd:

  • Template:Cd entity: The attacked entity
  • Template:Cd entity: the attacking entity
  • Template:Cd entity: the projectile entity
  • Enchantment level
  • Origin: The position of the attacked entity
  • Damage source
Template:Cd Amount of damage dealt by an attack
Template:Cd Amount of protection from incoming damage (specifically, from the portion of the damage that remains after accounting for armor). Each point of Template:Cd reduces this damage by 4%, up to a maximum of 80% per damaged entity.
Template:Cd Amount of damage added to the smash attack of a Minecraft:mace, per block fallen
Template:Cd Knockback caused by the attack
Template:Cd Chance of equipment dropping from the killed entity. Value between Template:Cd and Template:Cd
Template:Cd Amount of ammunition used when firing a Minecraft:bow or Minecraft:crossbow

Template:Cd:

  • Tool: The ammo item
  • Enchantment level
Template:Cd Count of pierced entities by fired projectiles
Template:Cd Amount of experience awarded for breaking a block

Template:Cd:

  • Tool: The enchanted item
  • Enchantment level
Template:Cd Damage to repair per Minecraft:XP collected
Template:Cd Amount of durability to lose when damaged
Template:Cd Amount of projectiles spawned when firing

Template:Cd:

  • Template:Cd entity: The projectile
  • Enchantment level
  • Origin The position of the projectile
Template:Cd Used for Minecraft:tridents returning to their owner Template:More info
Template:Cd Maximum spread of projectiles in degrees from firing direction

Template:Cd:

  • Template:Cd entity: The player / attacking entity
  • Enchantment level
  • Origin The position of the attacking entity
Template:Cd Time saved during Minecraft:fishing in seconds. A higher number means shorter total fishing time.
Template:Cd Added Minecraft:luck used in the fishing Minecraft:loot table
Template:Cd Amount of experience awarded for killing a mob

Template:Cd:

  • Template:Cd entity: The killed mob
  • Enchantment level
  • Origin The position of the killed mob

Some components don't check a predicate and always modify a value when applied. Their format is:

Component ID Value changed
Template:Cd Time of crossbow charging in seconds
Template:Cd Strength of the spin attack of a Minecraft:trident.Template:More info Any value larger than Template:Cd causes the trident to not be thrown.

Components with entity effects

These components use an entity effect to change a value and an optional condition to check beforehand. The general format for them is:

Component ID Effect applied Minecraft:Loot context for predicate
Template:Cd After an entity hits a block using the enchanted item

Template:Cd:

  • Enchantment level
  • Template:Cd entity: the entity hitting the block (the projectile if applicable)
  • Origin: if hit with a Minecraft:melee attack, the center of the hit block; if hit with a Minecraft:projectile, the position the projectile hit the block at.<ref group="note">Unlike the projectile, the origin will always be within the bounds of the hit block. In other words, its block position always matches that of the hit block.</ref>
  • Block state: the block state of the hit block
Template:Cd Every tick

Template:Cd:

  • Enchantment level
  • Template:Cd entity: the owner of the enchanted item
  • Origin: the position of the owner
Template:Cd After a projectile entity has been spawned from a Minecraft:bow, Minecraft:crossbow, Minecraft:snowball, Minecraft:trident, Minecraft:splash potion, Minecraft:lingering potion, Minecraft:ender pearl, Minecraft:firework rocket, Minecraft:wind charge, or Minecraft:egg.

Template:Cd:

  • Enchantment level
  • Template:Cd entity: the projectile that spawned
  • Origin: the position of the projectile
Template:Cd After an attack damages an entity

Template:Cd:

  • Template:Cd entity: the attacked entity
  • Template:Cd entity: the attacking entity
  • Template:Cd entity: the projectile entity
  • Enchantment level
  • Origin: the position of the attacked entity
  • Damage source
Template:Cd After a piercing attack is made, regardless of whether it hits anything

Template:Cd:

  • Enchantment level
  • Template:Cd entity: the owner of the enchanted item
  • Origin: the position of the owner

The predicate gets validated as if it gets the Template:Cd context.

location_changed

Enables or disables a location-based effect when the owners block position changed, i.e. when the integer portion of the coordinate changes. Also triggers when the equipment is equipped, and when an entity with the enchantment is loaded.

The Minecraft:loot context for the predicate is Template:Cd:

  • Template:Cd entity: The entity that moved
  • Enchantment level
  • Origin: The position of the entity that moved
  • Enchantment active status: Flag whether the enchantment was active before, i.e. the predicate succeeded at the old position.

damage_immunity

Applies damage immunity if the requirements are fulfilled.

The Minecraft:loot context for the predicate is Template:Cd:

prevent_equipment_drop

Prevents the item from being dropped on death of the owner when the component is present.

prevent_armor_change

Prevents the item from being unequipped from an armor slot.

attributes

Always applies all listed attribute effects.

crossbow_charging_sounds

Changes the sounds used when charging a Minecraft:crossbow.

trident_sound

Changes the sounds of a Minecraft:trident.

Value effects

Value effects are used to modify a value, see Template:Slink.

set

Sets the value to the specified value.

add

Adds the specified value to the old value.

multiply

Multiplies the old value with the specified factor.

remove_binomial

Runs a single<ref group="note">Although not clarified by Mojang, the Template:Code used in Template:Code indicates this. The Template:Cd is <math>\frac{level}{level+1}</math> for tools and <math>\frac{2\times level}{(5\times level)+5}</math> for armors, which is exactly the chance of not losing the durability upon each use (see Minecraft:unbreaking).</ref>Template:More info test with the Template:Cd of removing Template:Cd from the value.

all_of

Runs multiple value effects in series.

Attribute effects

Attribute effects are used to apply an Minecraft:attribute modifier to the entity that has an enchanted item equipped.

Entity effects

These effects are used to affect an entity by an enchantment component, see Template:Slink. The affected entity is determined by the component

all_of

Runs multiple entity effects in sequence.

apply_impulse

apply_exhaustion

Applies an exhaustion effect to the affected player.

Template:Nbt

apply_mob_effect

Applies a Minecraft:status effect to the affected mob.

damage_entity

Deals (extra) damage to the affected entity.

change_item_damage

Reduces the durability of the enchanted item

explode

Causes an explosion

ignite

Ignites the affected entity

play_sound

Plays a sound

replace_block

Places a block

replace_disk

Places a half-sphereTemplate:Verify.

run_function

Run a function.

set_block_properties

Sets the block properties of a block.

spawn_particles

Spawns particles.

summon_entity

Spawns an entity.

Location-based effects

All entity effects are also location-based effects. In this case the Template:Cd effect also accepts location-based effects as sub-effects. Additionally the following location-based effect exists:

attribute

Applies Minecraft:attribute modifiers to the affected entity.

Level-based value

A level-based value is used in enchantment effects to use different numbers depending on the level of the enchantment.

Constant

A constant float can be used instead of a compound to set a value that doesn't depend on the level of the enchantment

exponent

Raises the base to the specified power level.

linear

The value is linearly increased (or decreased) per level. The final value is Template:Cd.

levels_squared

The value is based on the square of the level. The final value is Template:Cd

clamped

Uses another level-based value and clamps the resulting value to the range Template:Cd.

fraction

Calculates a fraction of 2 level-based values: Template:Cd

lookup

Directly defines the value for each level, with a fallback for levels that aren't directly defined

History

Template:HistoryTable

See also

Notes

Template:Notelist

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Verzauberungsdefinition Minecraft:fr:Définition d'enchantement Minecraft:ja:エンチャントのカスタマイズ Minecraft:pt:Definição de encantamento Minecraft:zh:魔咒定义格式