Vanilla Custom Enchanting API icon

Vanilla Custom Enchanting API -----

API for creating vanilla-like Enchantments like Datapacks could do in 1.21.3




Update to 1.21.5
----------, Apr 27, 2025

- Added the Method #
addEnchantmentTagToAdd(NamespacedKey) to the EnchantmentBuilder
which allows the enchantment to be in other EnchantmentTags
Example:

Code (Java):
EnchantmentHolder test = createNewEnchantment (
        new EnchantmentBuilder ( new NamespacedKey ( "test", "reach" ), "§6Reach" )
                . supportedItem (Material. STONE, Material. DIAMOND_PICKAXE, Material. BOW, Material. CROSSBOW, Material. BUNDLE )
                . primaryItems (Material. DIAMOND_PICKAXE, Material. STONE, Material. BOW, Material. CROSSBOW, Material. BUNDLE )
                . weight ( 100 )
                . anvilCost ( 1 )
                . addEnchantmentTagToAdd ( new NamespacedKey ( "minecraft", "treasure" ) )
                . addEnchantmentTagToAdd ( new NamespacedKey ( "minecraft", "tradeable" ) )
                . addExclusiveEnchantments (org. bukkit. enchantments. Enchantment. EFFICIENCY )
                . equipmentSlotGroup (org. bukkit. inventory. EquipmentSlotGroup. HAND )
) ;
----------, Dec 28, 2024

With the EnchantmentModifier-Class you can now use the Methods:
- setEnchantmentDefinition(Enchantment, EnchantmentBuilder)
(Replaces only valid Fields from the EnchantmentBuilder to the existing Enchantment)
and
- setMaximumLevel(Enchantment, int)
(Replaces the maximum level of the existing Enchantment
----------, Nov 10, 2024

Restructured paths and created a list in the Documentation Tab to show which Effects are available.
More information and exampled comming soon.
----------, Oct 31, 2024

Added a lot Enchantment Effects
For example:

Code (Java):
. effect ( new CrossbowChargingSoundsEffect (Sound. ENTITY_ITEM_PICKUP, Sound. BLOCK_DISPENSER_DISPENSE, Sound. ENTITY_GENERIC_EXPLODE ) )
. effect ( new ItemDamageEffect ( new SetValueEnchantEffect (LevelBasedValue. linear (1f ) ) ) )
. effect ( new DamageProtectionEffect ( new SetValueEnchantEffect (LevelBasedValue. linear (3f ) ) ) )
. effect ( new ProjectileSpreadEffect ( new AddValueEnchantEffect (LevelBasedValue. linear (1f ) ) ) )
. effect ( new ProjectileCountEffect ( new AddValueEnchantEffect (LevelBasedValue. linear (10f ) ) ) )
. effect ( new CrossbowChargeTimeEffect ( new AddValueEnchantEffect (LevelBasedValue. linear (10f ) ) ) )
----------, Oct 27, 2024

Updatet to 1.21.3
(some internal vanilla changes could cause some errors, pls report them)
----------, Oct 24, 2024

Your now able to add some Enchantment-Effects that modify Attributes from the Player. Attributes apply depending on which slot-groups are present.

To apply a new Attribute-Enchanting Effect you can add following to the EnchantmentBuilder:

ENCHANTMENT_BUILDER.effect(new AttributeEnchantEffect(Attribute.GENERIC_MAX_HEALTH, new LevelBasedValue.Linear(1f,1f), AttributeEnchantEffect.Operation.ADD_VALUE))

The LevelBasedValue allows to modify the impact of the Enchanting-level and has some variations:
Clamped,
Fraction,
LevelsSquared,
Linear,
Lookup,
Constant
----------, Oct 23, 2024

Added exclusive Enchantments to the EnchantmentBuilder
----------, Oct 22, 2024

Resource Information
Author:
----------
Total Downloads: 268
First Release: Oct 22, 2024
Last Update: Apr 27, 2025
Category: ---------------
All-Time Rating:
1 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings