Package dev.architectury.event
Class EventResult
java.lang.Object
dev.architectury.event.EventResult
A result from an event, determines if the event should continue to other listeners,
and determines the outcome of the event.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.InteractionResultReturns the Minecraft-facing result, however ignoresinterruptsFurtherEvaluation().static EventResultInterrupts the event and stops it from being passed on to other listeners, may or may not set an outcome of the event.static EventResultInterrupts the event and stops it from being passed on to other listeners, and does not set an outcome.static EventResultInterrupts the event and stops it from being passed on to other listeners, and denotes thefalseoutcome.booleanReturns whether this result interrupts the evaluation of other listeners.static EventResultInterrupts the event and stops it from being passed on to other listeners, and denotes thetrueoutcome.booleanisEmpty()Returns whether the result does not contain an outcome, may befalseonly if the event is deterministic.booleanisFalse()Returns whether the result contains afalseoutcomebooleanReturns whether the result contains an outcome, may betrueonly if the event is deterministic.booleanisTrue()Returns whether the result contains atrueoutcomestatic EventResultpass()Passes the event to other listeners, and does not set an outcome of the event.value()Returns the outcome of the result, an passing result will never have an outcome.
-
Method Details
-
pass
Passes the event to other listeners, and does not set an outcome of the event.- Returns:
- an event that passes the event to other listeners
-
interrupt
Interrupts the event and stops it from being passed on to other listeners, may or may not set an outcome of the event.- Parameters:
value- the outcome of the event, passingnullhere means the default outcome, which often means falling back to vanilla logic- Returns:
- an event that interrupts the event
-
interruptTrue
Interrupts the event and stops it from being passed on to other listeners, and denotes thetrueoutcome.- Returns:
- an event that interrupts the event
-
interruptDefault
Interrupts the event and stops it from being passed on to other listeners, and does not set an outcome.- Returns:
- an event that interrupts the event
-
interruptFalse
Interrupts the event and stops it from being passed on to other listeners, and denotes thefalseoutcome.- Returns:
- an event that interrupts the event
-
interruptsFurtherEvaluation
public boolean interruptsFurtherEvaluation()Returns whether this result interrupts the evaluation of other listeners.- Returns:
- whether this result interrupts the evaluation of other listeners
-
value
Returns the outcome of the result, an passing result will never have an outcome.- Returns:
- the outcome of the result, returns
nullif fallback
-
isEmpty
public boolean isEmpty()Returns whether the result does not contain an outcome, may befalseonly if the event is deterministic.- Returns:
- whether the result does not contain an outcome
-
isPresent
public boolean isPresent()Returns whether the result contains an outcome, may betrueonly if the event is deterministic.- Returns:
- whether the result contains an outcome
-
isTrue
public boolean isTrue()Returns whether the result contains atrueoutcome- Returns:
- whether the result contains a
trueoutcome
-
isFalse
public boolean isFalse()Returns whether the result contains afalseoutcome- Returns:
- whether the result contains a
falseoutcome
-
asMinecraft
public net.minecraft.world.InteractionResult asMinecraft()Returns the Minecraft-facing result, however ignoresinterruptsFurtherEvaluation().- Returns:
- the Minecraft-facing result
-