coroutine-based kotlin minecraft game engine
Coroutine Integration#
Axi provides great coroutine integration to Minecraft using MCCoroutine ↗.
Extensions#
Axi adds the following extensions:
AxiPlugin.coroutineScope: The coroutine scope of the pluginAxiPlugin.syncContext: The synchronously executed coroutine context of the plugin, with an exception handler that prints stack traces for coroutine exceptionsAxiPlugin.asyncContext: The asynchronously executed coroutine context of the plugin, with an exception handler that prints stack traces for coroutine exceptionsAxiPlugin.sync: Launches a synchronously executed jobAxiPlugin.async: Launches an asynchronously executed jobAxiPlugin.syncContext(): Switches to theAxiPlugin.syncContextAxiPlugin.asyncContext(): Switches to theAxiPlugin.asyncContext
All of these exist for the main plugin as well with the
AxiCoroutines object.
Suspending Events#
You can register event handlers with suspending handler
functions using
AxiPlugin.registerEventListeners.
There is also another utility provided by Axi:
SuspendingListener, an interface that implements Listener
and is a synchronous CoroutineScope. This is useful if you
want to launch jobs in your events.