-
Notifications
You must be signed in to change notification settings - Fork 2
Creating an Event
NanoEvents is a statically registered event framework, so all events need to be declared early on.
Ini is NanoEvents' configuration format of choice
[mymod:myevent]
// this is the default event manager, it has 2 parameters
applier = net/devtech/nanoevents/api/event/EventApplyManager$Default
// mixinPath, the path to a mixin directory, this matches any classes inside that directory recursively
// and so all of those mixins will only be enabled if there are listeners for that event
// this is optional
mixinPath = net.devtech.mymod.mixin.*
// the class in which the invoker lies
invoker = net.devtech.mymod.EventInvokers
...
"depends": { // example
"fabricloader": ">=0.8.2+build.194",
"minecraft": "1.15.2"
}, // example
"custom": {
...
"nano:evt": "events.ini", // this can be an array of strings as well
"nano:lst": "listener.ini" // so can this
...
}
...
}
This file needs to be specified in your mod JSON, you can declare multiple files at once, or just one
With nano events, you can specify which package you've put your event mixins in, so if there are no listeners for a given event, NanoEvents won't apply the mixin, further reducing any potential overhead and performance costs. To use this feature, you must specify (net.devtech.nanoevents.plugin.NanoEventMixinPlugin) as your mixin plugin by setting the "plugin" field in your mixin config (your mixin json) to "net.devtech.nanoevents.plugin.NanoEventMixinPlugin" This isn't always desirable, so it's optional.
This is the class where the invoker for your event exists.
continue: Invokers