Class 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
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Event that is fired when an EntityItem's age has reached its maximum
lifespan. Canceling this event will prevent the EntityItem from being
flagged as dead, thus staying it's removal from the world. If canceled
it will add more time to the entities life equal to extraLife.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
Nested classes/interfaces inherited from class net.neoforged.bus.api.Event
net.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
-
Field Summary
-
Constructor Summary
ConstructorDescriptionItemExpireEvent
(ItemEntity entityItem, int extraLife) Creates a new event for an expiring EntityItem. -
Method Summary
Methods inherited from class net.neoforged.bus.api.Event
getResult, hasResult, setResult
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
extraLife
private int extraLife
-
-
Constructor Details
-
ItemExpireEvent
Creates a new event for an expiring EntityItem.- Parameters:
entityItem
- The EntityItem being deleted.extraLife
- The amount of time to be added to this entities lifespan if the event is canceled.
-
-
Method Details
-
getExtraLife
public int getExtraLife() -
setExtraLife
public void setExtraLife(int extraLife)
-