Skip to main content

CustomEnchant.EnchantSetupInterface

Object returned by CustomEnchant.newEnchant method. Used to configure different custom enchantment behaviors.

Index

Properties

readonlyid

id: number

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.

Methods

setAttackDamageBonusProvider

  • since: 2.3.1b115 (implemented in 2.2.1b105)

    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

  • since: 2.3.1b115 (implemented in 2.2.1b105)

    Defines the function that will be called after the item with following enchantment is used for attack.


    Parameters

    Returns EnchantSetupInterface

    Reference to itself to be used in sequential calls.

setPostHurtCallback

  • since: 2.3.1b115 (implemented in 2.2.1b105)

    Defines the function that will be called, when the entity wearing item with following enchantment, is hit.


    Parameters

    Returns EnchantSetupInterface

    Reference to itself to be used in sequential calls.

setProtectionBonusProvider

  • since: 2.3.1b115 (implemented in 2.2.1b105)

    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

    Returns EnchantSetupInterface

    Reference to itself to be used in sequential calls.