Posted February 12, 20196 yr 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?
March 8, 20196 yr 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)
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.