Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello,
I'm updating my mod to 1.16 and I can't find a way to add my reloadListener. Here is a code-snipped:


	@SubscribeEvent
	public void onServerAboutToStart(FMLServerAboutToStartEvent event)
	{
		// worked in 1.15.2
		//event.getServer().getResourcePacks().addReloadListener(DATAMANAGER);
		LOGGER.info("Elemental data registered.");	
	}

DATAMANGER is a class, that extends jsonReloadListener. I looked through the options of ResourcePacks, but I can't find a similar function to addReloadListener.

MinecraftServer now uses a different system called DataPackRegistries to combine the reload and initialization of the listeners in one place. To access it, use:

((IReloadableResourceManager) event.getServer().getDataPackRegistries().func_240970_h_()).addReloadListener(listener);

Note that the cast is necessary as the function returns an IResourceManager compared to its stored IReloadableResourceManager variable.

  • Author

Thank you for your answer!

I got the code to compile and I assume my ReloadListener was added. However none of the data got loaded. I tested a little bit and noticed, that my implemented apply() function of DataManager is never called. Previously this function was called whenever I start playing a world or when I use the /reload-command . That's not happining now. Any idea, what the problem might be?

 

My repo if you want to have a deeper look:

https://github.com/Tavi007/ElementalCombat

Edited by Tavi007

  • Author

I updated, but I still have the same issue. Maybe I will wait until a safe 1.16 version is realeased.

  • Author

I bump this thread up, since I still have the same issue. The DataManager never calls the apply() function and therefor never loads the json files. I also look through the forge issue tracker to see, if it is a known issue, but it's not listed.

  • 2 months later...

I don't know if you still having issues, but I do have a working re-loadable resource myself. I registered it slightly differently though:

public ModConst ()
{
  MinecraftForge.EVENT_BUS.addListener( this::addResourceReload );
}
	
private void addResourceReload ( final AddReloadListenerEvent event )
{
  event.addListener( new CustomReloadListener() );
}

For me, extending JsonReloadListener was all I needed.

I hope this helps someone.

Playing 1.16.2

Forge 33.0.5

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.