[Feature Request] Some way for KubeJSPlugin to fire custom registry events
erisdev opened this issue ยท 2 comments
I'm trying to write a plugin that lets modpack authors (me) define custom markdown manuals with KubeJS. I'm looking to be able to do something like this:
events.listen("manual.registry", (event: ManualRegistryEvent) => {
event.create("test")
.tab("grass", Item.of("minecraft:grass"))
.documentProvider((path: string, lang: string) => { /* ... */ });
});
Tragically, it seems like firing my registry event from init()
is too early, and afterInit()
is too late since registries are already frozen. It would be nice if KubeJSPlugin
offered a method that gets called during the init phase but after the scripts have been loaded.
If you're doing this on Forge, you should just be able to use the @SubscribeEvent annotation inside the plugin class and register the plugin to the mod bus during init()
, since startup scripts should have definitely already been loaded by that point. We might introduce another way down the line, but right now it doesn't seem like it's needed ^^
This is now a thing on 1.18! See RegistryObjectBuilderTypes for more information (keep in mind that this only works for things using Minecraft(-like) registries, since we're using Architectury DeferredRegisters under the hood ^^