类 GetEnchantmentLevelEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.GetEnchantmentLevelEvent
public class GetEnchantmentLevelEvent
extends net.minecraftforge.eventbus.api.Event
This event is fired whenever the enchantment level of a particular item is requested for gameplay purposes.
It is called from
It is called from
IForgeItemStack.getEnchantmentLevel(Enchantment)
and IForgeItemStack.getAllEnchantments()
.
It is not fired for interactions with NBT, which means these changes will not reflect in the item tooltip.
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明protected final Map<Enchantment,
Integer> protected final ItemStack
protected final @Nullable Enchantment
-
构造器概要
构造器构造器说明GetEnchantmentLevelEvent
(ItemStack stack, Map<Enchantment, Integer> enchantments, @Nullable Enchantment targetEnchant) -
方法概要
修饰符和类型方法说明Returns the mutable enchantment->level map.getStack()
Returns the item stack that is being queried against.@Nullable Enchantment
This method returns the specific enchantment being queried fromIForgeItemStack.getEnchantmentLevel(Enchantment)
.boolean
isTargetting
(Enchantment ench) Helper method aroundgetTargetEnchant()
that checks if the target is the specified enchantment, or if the target is null.从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
stack
-
enchantments
-
targetEnchant
-
-
构造器详细资料
-
GetEnchantmentLevelEvent
public GetEnchantmentLevelEvent(ItemStack stack, Map<Enchantment, Integer> enchantments, @Nullable @Nullable Enchantment targetEnchant)
-
-
方法详细资料
-
getStack
Returns the item stack that is being queried against. -
getEnchantments
Returns the mutable enchantment->level map. -
getTargetEnchant
This method returns the specific enchantment being queried fromIForgeItemStack.getEnchantmentLevel(Enchantment)
.If this is value is present, you only need to adjust the level of that enchantment.
If this value is null, then the event was fired from
IForgeItemStack.getAllEnchantments()
and all enchantments should be populated.- 返回:
- The specific enchantment being queried, or null, if all enchantments are being requested.
-
isTargetting
Helper method aroundgetTargetEnchant()
that checks if the target is the specified enchantment, or if the target is null.- 参数:
ench
- The enchantment to check.- 返回:
- If modifications to the passed enchantment are relevant for this event.
-