Enchantments
Enchantments are data-driven definitions that modify item behavior, apply effects, change damage calculations, and alter various game mechanics. In Minecraft Java Edition 1.21+, enchantments are fully customizable through data packs, allowing you to create entirely new enchantments with unique effects.
Overview
Custom enchantments have several key characteristics:
- Data-driven: Defined as JSON files in data packs, not hardcoded
- Effect components: Modular system of 30+ effect types
- Level-based scaling: Values can scale with enchantment level
- Slot-aware: Effects apply based on equipment slot configuration
- Conditional: Effects can have predicate requirements
Enchantment Properties
Every enchantment defines these core properties:
| Property | Description |
|---|---|
description |
Text component displayed on items |
supported_items |
Items that can receive the enchantment |
primary_items |
Items where enchantment appears in enchanting table |
exclusive_set |
Incompatible enchantments |
weight |
Probability weight (1-1024) |
max_level |
Maximum level (1-255) |
min_cost / max_cost |
Enchanting table level requirements |
anvil_cost |
Base cost for anvil application |
slots |
Equipment slots where effects apply |
effects |
Effect components that define behavior |
File Structure
Enchantments are stored as JSON files in data packs at:
For complete JSON specification, see the Minecraft Wiki - Enchantment definition.
Creating Enchantments
Use the enchantment builder function to create enchantments in Kore:
This generates data/my_datapack/enchantment/fire_aspect_plus.json.
Basic Properties
Description
The text shown on enchanted items:
Supported and Primary Items
Exclusive Set
Enchantments that cannot coexist:
Cost and Weight
Equipment Slots
Where the enchantment's effects apply:
Available slots: ANY, HAND, MAINHAND, OFFHAND, ARMOR, FEET, LEGS, CHEST, HEAD, BODY, SADDLE.
Effect Components
Effects define what the enchantment actually does. Kore supports all vanilla effect components.
Value Effect Components
These components modify numeric values with level-based scaling:
| Component | Description |
|---|---|
ammoUse |
Ammunition consumption |
armorEffectiveness |
Armor effectiveness multiplier |
blockExperience |
XP from breaking blocks |
crossbowChargeTime |
Crossbow charge time |
damage |
Bonus attack damage |
damageProtection |
Damage reduction (max 80% total) |
equipmentDrops |
Equipment drop chance |
fishingLuckBonus |
Fishing luck bonus |
fishingTimeReduction |
Fishing speed bonus |
itemDamage |
Durability loss multiplier |
knockback |
Knockback strength |
mobExperience |
XP from killing mobs |
projectileCount |
Projectiles fired |
projectilePiercing |
Targets pierced |
projectileSpread |
Accuracy spread in degrees |
repairWithXp |
Durability repaired per XP |
smashDamagePerFallenBlock |
Mace bonus damage per block fallen |
tridentReturnAcceleration |
Trident return speed |
tridentSpinAttackStrength |
Riptide attack strength |
Entity Effect Components
These components trigger actions on entities:
| Component | Description |
|---|---|
hitBlock |
After hitting a block with the enchanted item |
postAttack |
After damaging an entity |
postPiercingAttack |
After a piercing attack with an item |
projectileSpawned |
When a projectile is created |
tick |
Every game tick while equipped |
Special Effect Components
| Component | Description |
|---|---|
attributes |
Applies attribute modifiers |
crossbowChargingSounds |
Custom crossbow sounds |
damageImmunity |
Grants immunity to damage types |
preventArmorChange |
Prevents removing from armor slot |
preventEquipmentDrop |
Prevents item from dropping on death |
tridentSound |
Custom trident sounds |
Entity Effects
Entity effects are actions that can be triggered by effect components:
Apply Exhaustion
Apply Impulse
Apply Mob Effect
Damage Entity
Explode
Ignite
Play Sound
Replace Block/Disk
Spawn Particles
Run Function
Summon Entity
Change Item Damage
Level-Based Values
Level-based values allow effects to scale with enchantment level:
| Type | Description | Example |
|---|---|---|
clampedLevelBased(value, min, max) |
Clamped range | clampedLevelBased(linear, 1.0, 10.0) |
constantLevelBased(value) |
Fixed value | constantLevelBased(5) |
exponentLevelBased(base, power) |
Exponential | exponentLevelBased(1, 5) → 1, 5, 25... |
fractionLevelBased(num, denom) |
Fractional | fractionLevelBased(1, 2) → 0.5, 1, 1.5... |
levelsSquaredLevelBased(base) |
Quadratic scaling | levelsSquaredLevelBased(1) → 1, 4, 9... |
linearLevelBased(base, perLevel) |
Linear scaling | linearLevelBased(2, 0.5) → 2, 2.5, 3... |
lookupLevelBased(list, fallback) |
Lookup table | lookupLevelBased(listOf(1, 3, 7), 10) |
Requirements (Conditions)
Effect components can have requirements that must be met:
Full Example
Generated JSON
Enchantment Providers
Enchantment providers are used by enchanting tables and loot functions to select enchantments, so they often appear next to Loot Tables and runtime Item Modifiers:
Best Practices
- Balance carefully - Test enchantment power at all levels; use appropriate weights
- Use exclusive sets - Prevent overpowered combinations with incompatible enchantments
- Scale appropriately - Use level-based values that provide meaningful progression
- Add requirements - Use conditions to create situational bonuses
- Consider slots - Ensure effects only apply in appropriate equipment slots
- Test thoroughly - Verify effects work correctly in all contexts (PvP, PvE, etc.)
See Also
- Predicates - Conditions for enchantment effect requirements
- Components - Item components and matchers
- Tags - Use enchantment and item tags
External Resources
- Minecraft Wiki: Enchantment definition - Official JSON format reference
- Minecraft Wiki: Enchanting - Enchanting mechanics overview
