diff --git a/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java b/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java index 368982fe..40f99d3d 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java +++ b/common/src/main/java/me/shedaniel/architectury/event/CompoundEventResult.java @@ -58,6 +58,39 @@ public class CompoundEventResult { return new CompoundEventResult<>(EventResult.interrupt(value), object); } + /** + * Interrupts the event and stops it from being passed on to other listeners, + * denotes the {@code true} outcome and may or may not set an extra data of the event. + * + * @param object the extra data of the result, this usually is the returning value of the event + * @return an event that interrupts the event + */ + public static CompoundEventResult interruptTrue(T object) { + return new CompoundEventResult<>(EventResult.interruptTrue(), object); + } + + /** + * Interrupts the event and stops it from being passed on to other listeners, + * does not set an outcome and may or may not set an extra data of the event. + * + * @param object the extra data of the result, this usually is the returning value of the event + * @return an event that interrupts the event + */ + public static CompoundEventResult interruptDefault(T object) { + return new CompoundEventResult<>(EventResult.interruptDefault(), object); + } + + /** + * Interrupts the event and stops it from being passed on to other listeners, + * denotes the {@code false} outcome and may or may not set an extra data of the event. + * + * @param object the extra data of the result, this usually is the returning value of the event + * @return an event that interrupts the event + */ + public static CompoundEventResult interruptFalse(T object) { + return new CompoundEventResult<>(EventResult.interruptFalse(), object); + } + private CompoundEventResult(EventResult result, T object) { this.result = result; this.object = object; diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventResult.java b/common/src/main/java/me/shedaniel/architectury/event/EventResult.java index 39ca7bc3..c1802020 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventResult.java +++ b/common/src/main/java/me/shedaniel/architectury/event/EventResult.java @@ -56,6 +56,36 @@ public final class EventResult { return FALSE; } + /** + * Interrupts the event and stops it from being passed on to other listeners, + * and denotes the {@code true} outcome. + * + * @return an event that interrupts the event + */ + public static EventResult interruptTrue() { + return TRUE; + } + + /** + * Interrupts the event and stops it from being passed on to other listeners, + * and does not set an outcome. + * + * @return an event that interrupts the event + */ + public static EventResult interruptDefault() { + return STOP; + } + + /** + * Interrupts the event and stops it from being passed on to other listeners, + * and denotes the {@code false} outcome. + * + * @return an event that interrupts the event + */ + public static EventResult interruptFalse() { + return FALSE; + } + private final boolean interruptsFurtherEvaluation; private final Boolean value; diff --git a/gradle.properties b/gradle.properties index 40c30747..b438a099 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ supported_version=1.16.4/5 archives_base_name=architectury archives_base_name_snapshot=architectury-snapshot -base_version=1.11 +base_version=1.12 maven_group=me.shedaniel fabric_loader_version=0.11.1