类 ItemExpireEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.item.ItemEvent
net.neoforged.neoforge.event.entity.item.ItemExpireEvent
Event that is fired when an
ItemEntity
's age has reached its maximum
lifespan. Adding extra life time will prevent the ItemEntity
from being
flagged as dead, thus staying its removal from the world.
Note that using this event, you can ony extend the lifespan up to Short.MAX_VALUE
- 1 ticks (27.5 minutes).
To extend an item's lifespan above that, use either ItemEntity.setExtendedLifetime()
or ItemEntity.setUnlimitedLifetime()
.
This event will only be fired server-side.
-
嵌套类概要
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addExtraLife
(int extraLife) Adds to the amount of extra life time (in ticks) to give thisItemEntity
.int
Query the amount of extra time that will be added.void
setExtraLife
(int extraLife) Sets the amount of extra life time (in ticks) to give thisItemEntity
.
-
字段详细资料
-
extraLife
private int extraLife
-
-
构造器详细资料
-
ItemExpireEvent
Creates a new event for an expiringItemEntity
.- 参数:
itemEntity
- TheItemEntity
being deleted.
-
-
方法详细资料
-
getExtraLife
public int getExtraLife()Query the amount of extra time that will be added.Note that this is the event result. If you need data from the entity, query it directly.
ItemEntity.lifespan
is the entities maximum lifespan and also its current age.- 返回:
- Extra time to be added in ticks.
-
setExtraLife
public void setExtraLife(int extraLife) Sets the amount of extra life time (in ticks) to give thisItemEntity
.Consider using
addExtraLife(int)
in case another mod also adds extra time.- 参数:
extraLife
- The amount of time to be added to this entities lifespan.
-
addExtraLife
public void addExtraLife(int extraLife) Adds to the amount of extra life time (in ticks) to give thisItemEntity
.- 参数:
extraLife
- The amount of time to be added to this entities lifespan.
-