MCEnchantmentLevelSetEvent
Link to mcenchantmentlevelsetevent
Fired when the enchantment level is set for each of the three potential enchantments in the enchanting table. The level is set to the vanilla value and can be modified by this event handler.
The enchantRow is used to determine which enchantment level is being set, 1, 2, or 3. The power is a number from 0-15 and indicates how many bookshelves surround the enchanting table. The itemStack representing the item being enchanted is also available.
The event is not cancelable.
The event does not have a result.
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.event.enchanting.MCEnchantmentLevelSetEvent;
Extending MCEvent
Link to extending-mcevent
MCEnchantmentLevelSetEvent extends MCEvent. That means all methods available in MCEvent are also available in MCEnchantmentLevelSetEvent
使用方式
Link to 使用方式
Name: getEnchantRow
Gets the row in the Enchanting Table that this event is fired for.
Returns: The row that this event is fired for.
Return Type: int
ZenScript Copy// MCEnchantmentLevelSetEvent.getEnchantRow() as int
myMCEnchantmentLevelSetEvent.getEnchantRow();
Name: getItem
Gets the ItemStack that is being enchanted.
Returns: The ItemStack that is being enchanted.
Return Type: IItemStack
ZenScript Copy// MCEnchantmentLevelSetEvent.getItem() as IItemStack
myMCEnchantmentLevelSetEvent.getItem();
Name: getLevel
Gets the current level of the enchantment for this row.
This value can be changed by other mods.
Returns: The current level of the enchantment for this row.
Return Type: int
ZenScript Copy// MCEnchantmentLevelSetEvent.getLevel() as int
myMCEnchantmentLevelSetEvent.getLevel();
Name: getOriginalLevel
Gets the original level of the enchantment for this row.
Returns: The original level of the enchantment for this row.
Return Type: int
ZenScript Copy// MCEnchantmentLevelSetEvent.getOriginalLevel() as int
myMCEnchantmentLevelSetEvent.getOriginalLevel();
Name: getPos
Gets the position of the Enchanting Table firing this event.
Returns: The positiong of the Enchanting Table.
Return Type: BlockPos
ZenScript Copy// MCEnchantmentLevelSetEvent.getPos() as BlockPos
myMCEnchantmentLevelSetEvent.getPos();
Name: getPower
Gets the Enchanting Power of the Enchanting Table.
Returns: The Enchanting Power of the Enchanting Table.
Return Type: int
ZenScript Copy// MCEnchantmentLevelSetEvent.getPower() as int
myMCEnchantmentLevelSetEvent.getPower();
Name: getWorld
Gets the World where the Enchanting Table is.
Returns: The World where the event is fired in.
Return Type: MCWorld
ZenScript Copy// MCEnchantmentLevelSetEvent.getWorld() as MCWorld
myMCEnchantmentLevelSetEvent.getWorld();
Name: setLevel
Sets the level of the enchantment for this row.
Setting this to 0
will make this row not have an enchantment.
Return Type: void
ZenScript Copy// MCEnchantmentLevelSetEvent.setLevel(level as int) as void
myMCEnchantmentLevelSetEvent.setLevel(5);
参数 | 类型 | 描述 |
---|---|---|
参数 level | 类型 int | 描述 The new enchantment level. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 enchantRow | 类型 int | 可获得 true | 可设置 false | 描述 Gets the row in the Enchanting Table that this event is fired for. |
名称 item | 类型 IItemstack | 可获得 true | 可设置 false | 描述 Gets the ItemStack that is being enchanted. |
名称 level | 类型 int | 可获得 true | 可设置 true | 描述 Gets the current level of the enchantment for this row. This value can be changed by other mods. |
名称 originalLevel | 类型 int | 可获得 true | 可设置 false | 描述 Gets the original level of the enchantment for this row. |
名称 点 | 类型 BlockPos | 可获得 true | 可设置 false | 描述 Gets the position of the Enchanting Table firing this event. |
名称 power | 类型 int | 可获得 true | 可设置 false | 描述 Gets the Enchanting Power of the Enchanting Table. |
名称 world | 类型 MCWorld | 可获得 true | 可设置 false | 描述 Gets the World where the Enchanting Table is. |