Vanilla Custom Enchanting API icon

Vanilla Custom Enchanting API -----

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



Example creation for a Enchantment with a golden(§6) Display Name:
Code (Java):

EnchantmentHolder enchantmentHolder =
EnchantmentsAPI. createNewEnchantment ( new EnchantmentBuilder ( new NamespacedKey ( "test", "reach" ), "§6Reach" )
                . supportedItem (Material. STONE, Material. DIAMOND_PICKAXE )
                . primaryItems (Material. DIAMOND_PICKAXE )
                . weight ( 100 )
                . anvilCost ( 1 )
                . addExclusiveEnchantments (org. bukkit. enchantments. Enchantment. EFFICIENCY )
                . equipmentSlotGroup (org. bukkit. inventory. EquipmentSlotGroup. HAND )
                . effect ( new AttributeEnchantEffect ( Attribute. GENERIC_MAX_HEALTH, new LevelBasedValue. Linear (1f,1f ), AttributeEnchantEffect. Operation. ADD_VALUE ) )
                . effect ( new AttributeEnchantEffect ( Attribute. GENERIC_SCALE, new LevelBasedValue. Linear (1f,1f ), AttributeEnchantEffect. Operation. ADD_VALUE ) )
                . effect ( new AttributeEnchantEffect ( Attribute. PLAYER_BLOCK_INTERACTION_RANGE, new LevelBasedValue. Linear (2f,2f ), AttributeEnchantEffect. Operation. ADD_VALUE ) )
                )
// There are more Functions here, take a look into the Minecraft Wiki for more information
 
Currently there are some missing features like more EnchantmentEffects
The LevelBasedValue allows to modify the impact of the Enchanting-level and has some variations(and also helper-methods to create them in the LevelBasedValue-class):
+ Clamped
+ Fraction
+ LevelsSquared
+ Linear
+ Lookup
+ Constant


The EnchantmentHolder provides helpful Methods and also the normal Bukkit-API-Like new Enchantment.
Code (Java):

NamespacedKey getKey ( ) // -> Gets the Namespaced Key of the Enchantment
Enchantment getEnchantment ( ) // -> Gets the Bukkit-API-Like new Enchantment
ItemStack enchantItem (ItemStack itemStack, int level ) // -> Enchants the given Item with the given Level and returns a copy of the given Item with the Enchantment applied
boolean hasEnchantment (ItemStack itemStack ) // -> checks if this Enchantment is applied to the Item
Optional <Integer > getEnchantingLevel (ItemStack itemStack ) // -> Returns the enchanted Level as Optional or Optional.Empty if not enchanted
 
Valid Enchantment Effects:

new DamageImmunityEffect(EnchantmentValueBasedEffect)
new DamageEffect(EnchantmentValueBasedEffect)
new SmashDamagePerFallenBlockEffect(EnchantmentValueBasedEffect)
new KnockbackEffect(EnchantmentValueBasedEffect)
new ArmorEffectivenessEffect(EnchantmentValueBasedEffect)
new PostAttackEffect(EnchantmentAffected enchanted, EnchantmentAffected affected, EnchantmentEntityEffect enchantmentEntityEffect)
new HitBlockEffect(EnchantmentEntityEffect)
new ItemDamageEffect(EnchantmentValueBasedEffect)
new AttributeEnchantEffect(Attribute attribute, LevelBasedValue levelBasedValue, Operation operation)
new EquipmentDropsEffect(EnchantmentAffected enchanted, EnchantmentAffected affected, EnchantmentValueBasedEffect enchantmentValueBasedEffect)
new LocationChangedEffect(EnchantmentLocationBasedEffect)
new TickEffect(EnchantmentEntityEffect)
new AmmoUseEffect(EnchantmentValueBasedEffect)
new ProjectilePiercingEffect(EnchantmentValueBasedEffect)
new ProjectileSpawnedEffect(EnchantmentEntityBasedEffect)
new ProjectileSpreadEffect(EnchantmentValueBasedEffect)
new ProjectileCountEffect(EnchantmentValueBasedEffect)
newTridentReturnAccelerationEffect(EnchantmentValueBasedEffect)
new FishingTimeReductionEffect(EnchantmentValueBasedEffect)
new FishingLuckBonusEffect(EnchantmentValueBasedEffect)
new BlockExperienceEffect(EnchantmentValueBasedEffect)
new MobExperienceEffect(EnchantmentValueBasedEffect)
new RepairWithXpEffect(EnchantmentValueBasedEffect)
new CrossbowChargeTimeEffect(EnchantmentValueBasedEffect)
new CrossbowChargingSoundsEffect(@Nullable Sound start, @Nullable Sound middle, @Nullable Sound end)
new TridentSoundEffect(Sound sound)
new PreventEquipmentDropEffect()
new PreventArmorChangeEffect()
new TridentSpinAttackStrengthEffect(EnchantmentValueBasedEffect)


Valid Effect Types:

Coming soon
Coming soon
Coming soon
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