CustomEnchant
Index
Interfaces
AttackDamageBonusProvider
Parameters
damage: number
entity: number
Returns number
DamageCallback
Parameters
item: ItemInstance
damage: number
entity1: number
entity2: number
Returns void
EnchantSetupInterface
Object returned by CustomEnchant.newEnchant method. Used to configure different custom enchantment behaviors.
readonlyid
The numeric ID of the following enchantment to be used in different operations. This ID will not change after the first generation, same as it works with blocks' and items' IDs.
setAttackDamageBonusProvider
Defines the function that will be called, when item with following enchantment is used for attack. The function must return bonus damage dealt to the victim.
Parameters
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setFrequency
Sets the following enchantment frequency, possibly used in treasures.
Parameters
freq: number
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setIsDiscoverable
Sets whether the following enchantment will be able to be received on the enchanting table or not.
Parameters
discoverable: boolean
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setIsLootable
Sets whether the following enchantment will be able to be found in dungeon chests or not.
Parameters
lootable: boolean
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setIsTreasure
Sets whether the following enchantment will be able to be caught during fishing as a treasure, or not.
Parameters
treasure: boolean
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setMask
Sets the mask of items, that the following enchantment can be applied to, paired parameter for item is enchant slot.
Parameters
mask: number
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setMinMaxCost
Sets linear dependency of enchant cost by level, the formula is
level * b + c
.Parameters
bMin: number
cMin: number
bMax: number
cMax: number
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setMinMaxLevel
Sets minimum and maximum level, that the following enchantment will be able to have in legal conditions.
Parameters
min: number
max: number
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setPostAttackCallback
Defines the function that will be called after the item with following enchantment is used for attack.
Parameters
func: DamageCallback
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setPostHurtCallback
Defines the function that will be called, when the entity wearing item with following enchantment, is hit.
Parameters
func: DamageCallback
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
setProtectionBonusProvider
Defines the function that will be called, when the entity wearing item with following enchantment, is hit. The function must return bonus protection value.
Parameters
func: ProtectionBonusProvider
Returns EnchantSetupInterface
Reference to itself to be used in sequential calls.
ProtectionBonusProvider
Parameters
damage: number
damageType: number
entity: number
Returns number
Functions
newEnchant
Registers new custom enchantment from given name ID and displayed name.
Parameters
nameID: string
internal string ID of the enchantment
displayedName: string
enchantment name that will be displayed in the tooltips of the items having this enchant. Use Translation module to make localization of the displayed name
Returns EnchantSetupInterface
Object to work with different enchantment behaviors.
Module to create custom enchantments.
2.2.1b105