Created
November 17, 2019 10:53
-
-
Save falseresync/77bf3c7a0e5b5ff8cb89862280955d88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExampleEventListener.EVENT.register(outerEvent -> { | |
if (event.parameter.isDoingIt) { | |
outerEvent.setPayload(innerEvent -> { | |
innerEvent.parameter.doTheThingWith(outerEvent.world); | |
}); | |
return EventResult.EXECUTE; | |
} | |
return EventResult.CANCEL; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ExampleEventListerner { | |
Event<ExampleEventListerner> EVENT = PayloadedEventFactory.createArrayBacked( | |
ExampleEventListerner.Determinator.class, | |
ExampleEventListener.Payload.class, | |
(determinators) -> (event) -> {}, | |
(payloads) -> (event) -> {} | |
); | |
interface Determinator { | |
EventResult onExampleEvent(Event event); | |
} | |
interface Payload { | |
void onExampleEvent(Event event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment