#How to load custom data for mod
7 messages · Page 1 of 1 (latest)
create a singleton IdentifiableResourceReloadListener and mixin into ResourceManagerHelperImpl
will try, thanks 🤝
please dont mixin to ResourceManagerHelperImpl classes. use the api
what api? i would want to migrate away from a mixin
easiest option is to extend JsonDataLoader with your class, provide your location (data/<namespace>/<datatype>/<path> = <namespace>:<path>)
once you have that class, you call ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new YourClassHere()) in your mod initializer
in your jsondataloader class, the apply method can be used to handle the json that gets loaded in either via codec or otherwise.
if you have a codec (you should) then you can go further and use a DynamicRegistry and let everything be automatic