Script API - v1.26.10
    Preparing search index...

    Class EnchantWithLevelsFunction

    Loot item function that applies a random enchant to the dropped item.

    export class EnchantWithLevelsFunction extends LootItemFunction {
    private constructor();
    readonly levels: minecraftcommon.NumberRange;
    readonly treasure: boolean;
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Constructors

    Properties

    conditions: LootItemCondition[]
    levels: NumberRange

    The value range from which the function randomly chooses the level of enchantment to apply. Contains minimum and maximum values.

    This property can't be read in early-execution mode.

    treasure: boolean

    Value that determines whether or not treasure enchants should be included in the random enchant selection.

    This property can't be read in early-execution mode.