diff options
author | nea <romangraef@gmail.com> | 2022-08-03 02:31:05 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-03 02:31:05 +0200 |
commit | 2625eeb7dedb05b524b08721e1267acdcd93e5c1 (patch) | |
tree | 476117af52a76f22c445b8b8dac4778f24ce5c51 /src/main/kotlin/moe/nea/notenoughupdates/events | |
parent | b9455467863f194accf30a89b2c2998822f2c105 (diff) | |
download | firmament-2625eeb7dedb05b524b08721e1267acdcd93e5c1.tar.gz firmament-2625eeb7dedb05b524b08721e1267acdcd93e5c1.tar.bz2 firmament-2625eeb7dedb05b524b08721e1267acdcd93e5c1.zip |
scuffed config screen
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/events')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/events/NEUScreenEvents.kt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/events/NEUScreenEvents.kt b/src/main/kotlin/moe/nea/notenoughupdates/events/NEUScreenEvents.kt new file mode 100644 index 0000000..f118be5 --- /dev/null +++ b/src/main/kotlin/moe/nea/notenoughupdates/events/NEUScreenEvents.kt @@ -0,0 +1,23 @@ +package moe.nea.notenoughupdates.events + +import moe.nea.notenoughupdates.events.NEUScreenEvents.OnScreenOpen +import net.fabricmc.fabric.api.event.EventFactory +import net.minecraft.client.gui.screens.Screen +import net.minecraft.client.Minecraft + +object NEUScreenEvents { + fun interface OnScreenOpen { + /** + * Called when a new Screen is opened via [Minecraft.setScreen]. If [new] is null, this corresponds to closing a [Screen]. + * @return true to prevent this event from happening. + */ + fun onScreenOpen(old: Screen?, new: Screen?): Boolean + } + + val SCREEN_OPEN = EventFactory.createArrayBacked(OnScreenOpen::class.java) { arr -> + OnScreenOpen { old, new -> + return@OnScreenOpen arr.asSequence().any { it.onScreenOpen(old, new) } + } + } + +}
\ No newline at end of file |