PickupXpEvent
Link to pickupxpevent
This event is fired after the player collides with an experience orb, but before the player has been given the experience. It can be cancelled, and no further processing will be done.
The event is cancelable.
If the event is canceled, the xp will not change
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.entity.player.xp.PickupXpEvent;
Extending PlayerXpEvent
Link to extending-playerxpevent
PickupXpEvent extends PlayerXpEvent. That means all methods available in PlayerXpEvent are also available in PickupXpEvent
使用方式
Link to 使用方式
Name: getOrb
Return Type: ExperienceOrb
ZenScript Copy// PickupXpEvent.getOrb() as ExperienceOrb
event.getOrb();
名称 | 类型 | 可获得 | 可设置 |
---|---|---|---|
名称 orb | 类型 ExperienceOrb | 可获得 true | 可设置 false |