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

[1.13] Datapack interaction


Corey
 Share

Recommended Posts

I'm having trouble figuring out how to access data from datapacks.  Reading this leads me to believe that IResourceManager.getAllResourceLocations handles all relevant datapack cascading, etc., but it only seems to be giving me the contents of my assets dir.

 

Here's the code I was using to test it:

  private void setupClient(final FMLClientSetupEvent event) {
    this.registerResourceLoader((IReloadableResourceManager)event.getMinecraftSupplier().get().getResourceManager());
  }

  private void setupServer(final FMLDedicatedServerSetupEvent event) {
    this.registerResourceLoader(event.getServerSupplier().get().getResourceManager());
  }

  private void registerResourceLoader(final IReloadableResourceManager resourceManager) {
    resourceManager.addReloadListener(manager -> {
      LOGGER.info("METALS:");
      manager.getAllResourceLocations("metals", s -> true).forEach(LOGGER::info);
    });
  }

It lists files in assets/gradient-core/metals, but doesn't list files in data/gradient-core/metals.

 

Side question, is Minecraft.getResourceManager always an instance of IReloadableResourceManager?

Link to comment
Share on other sites

  • 4 weeks later...

The reason it's not returning anything from data is because the Client "doesn't know" the data folder.
For that you need the integrated server, which is just registered when a player joins singleplayer. (and maybe lan)
I haven't figured out how to hook up into it's creation yet. But I'll let you know when I find a way.

(On the deticated server it will only return things in the data folder)

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.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

 Share



×
×
  • Create New...

Important Information

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