EnchantmentLevelSetEvent
Link to enchantmentlevelsetevent
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.
Diese Klasse importieren
Link to diese-klasse-importieren
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.EnchantmentLevelSetEvent;
Extending Event
Link to extending-event
EnchantmentLevelSetEvent extends Event. That means all methods available in Event are also available in EnchantmentLevelSetEvent
Methoden
Link to methoden
Name: getEnchantLevel
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// EnchantmentLevelSetEvent.getEnchantLevel() as int
myEnchantmentLevelSetEvent.getEnchantLevel();
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// EnchantmentLevelSetEvent.getEnchantRow() as int
myEnchantmentLevelSetEvent.getEnchantRow();
Name: getItem
Gets the ItemStack that is being enchanted.
Returns: The ItemStack that is being enchanted.
Return Type: IItemStack
ZenScript Copy// EnchantmentLevelSetEvent.getItem() as IItemStack
myEnchantmentLevelSetEvent.getItem();
Name: getLevel
Gets the Level where the Enchanting Table is.
Returns: The Level where the event is fired in.
Return Type: Level
ZenScript Copy// EnchantmentLevelSetEvent.getLevel() as Level
myEnchantmentLevelSetEvent.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// EnchantmentLevelSetEvent.getOriginalLevel() as int
myEnchantmentLevelSetEvent.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// EnchantmentLevelSetEvent.getPos() as BlockPos
myEnchantmentLevelSetEvent.getPos();
Name: getPower
Gets the Enchanting Power of the Enchanting Table.
Returns: The Enchanting Power of the Enchanting Table.
Return Type: int
ZenScript Copy// EnchantmentLevelSetEvent.getPower() as int
myEnchantmentLevelSetEvent.getPower();
Name: setLevel
Sets the level of the enchantment for this row.
Setting this to 0
will make this row not have an enchantment.
ZenScript Copy// EnchantmentLevelSetEvent.setLevel(level as int)
myEnchantmentLevelSetEvent.setLevel(5);
Parameter | Type | Beschreibung |
---|---|---|
Parameter level | Type int | Beschreibung The new enchantment level. |
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Beschreibung |
---|---|---|---|---|
Name enchantLevel | Type int | Has Getter true | Has Setter true | Beschreibung Gets the current level of the enchantment for this row. This value can be changed by other mods. |
Name enchantRow | Type int | Has Getter true | Has Setter false | Beschreibung Gets the row in the Enchanting Table that this event is fired for. |
Name item | Type IItemStack | Has Getter true | Has Setter false | Beschreibung Gets the ItemStack that is being enchanted. |
Name level | Type Level | Has Getter true | Has Setter false | Beschreibung Gets the Level where the Enchanting Table is. |
Name originalLevel | Type int | Has Getter true | Has Setter false | Beschreibung Gets the original level of the enchantment for this row. |
Name pos | Type BlockPos | Has Getter true | Has Setter false | Beschreibung Gets the position of the Enchanting Table firing this event. |
Name power | Type int | Has Getter true | Has Setter false | Beschreibung Gets the Enchanting Power of the Enchanting Table. |