Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to load files from the installed datapacks


Recommended Posts

Hey I was wondering how if say you had a particular nbt file you wanted to be compiled with your mod in the data folder, how I could then read that file from the mod's resources in code, and if it's automatically checked whether it's overridden by datapacks that match that paticular file structure, and if not how you can do that?

Link to comment
Share on other sites

You need a class that implements IFutureReloadListener. Most likely you want to subclass ReloadListener instead (or JsonReloadListener for one that handles a JSON structure like recipes or tags). You need to implement two methods, prepare and apply. prepare is run asynchronously and is responsible for reading and parsing the data from the IResourceManager, apply is then called on the main thread to populate whatever internal data structures you have from the parsed data.

Then you have to register your listener using AddReloadListenerEvent.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.