Private
constructorReadonly
slotsThis property can throw when used.
Readonly
typeIdentifier of the component.
Static
Readonly
componentThe enchantment interface to be added.
Adds an enchantment to the item stack.
This function can't be called in read-only mode.
ScriptItemEnchantmentUnknownIdError: Exception thrown if the enchantment type does not exist.
ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown if the enchantment level is outside the allowable range for the given enchantment type.
ScriptItemEnchantmentTypeNotCompatibleError: Exception thrown if the enchantment is not compatible with the item stack.
EnchantmentLevelOutOfBoundsError
EnchantmentTypeNotCompatibleError
Error
The list of enchantments to be added.
Adds a list of enchantments to the item stack.
This function can't be called in read-only mode.
ScriptItemEnchantmentUnknownIdError: Exception thrown if any enchantment type does not exist.
ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown if any enchantment level is outside the allowable range for the given enchantment type.
ScriptItemEnchantmentTypeNotCompatibleError: Exception thrown if any enchantment is not compatible with the item stack.
EnchantmentLevelOutOfBoundsError
EnchantmentTypeNotCompatibleError
Error
The enchantment interface to be added.
Returns true if the enchantment can be added to the item stack.
Checks whether an enchantment can be added to the item stack.
ScriptItemEnchantmentUnknownIdError: Exception thrown if the enchantment type does not exist.
ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown if the enchantment level is outside the allowable range for the given enchantment type.
The enchantment type to get.
Returns the enchantment if it exists on the item stack.
Gets the enchantment of a given type from the item stack.
ScriptItemEnchantmentUnknownIdError: Exception thrown if the enchantment type does not exist.
Returns a list of enchantments on the item stack.
Gets all enchantments on the item stack.
This function can throw errors.
The enchantment type to check for.
Returns true if the item stack has the enchantment type.
Checks whether an item stack has a given enchantment type.
ScriptItemEnchantmentUnknownIdError: Exception thrown if the enchantment type does not exist.
The enchantment type to remove.
Removes an enchantment of the given type.
This function can't be called in read-only mode.
ScriptItemEnchantmentUnknownIdError: Exception thrown if the enchantment type does not exist.
Error
When present on an item, this item can have enchantments applied to it.
Example
givePlayerIronFireSword.ts