Jump to content

Recommended Posts

Posted

my mod has a "StructureManager" that overrides the ReloadListener <?> method. How do I register this listener correctly?
I created a Listener based on RecipeManager and saw that it registers to MinecraftServer. However, nothing works for me.
Here is an example of my registration code:

private void server(final FMLServerAboutToStartEvent event){

        LOGGER.info("SERVER ^>>>");

        event.getServer().getResourceManager().addReloadListener(structureManager);

}

Thank you in advance for your cooperation.

Posted
4 hours ago, poopoodice said:

Is the event being triggered? What's in your reload listener?

No, nothing starts. As I described the problem, I need a recipe file reloader. A very similar class -> RecipeManager. You gave a class that is not present in 1.15.2. How to be in this version?

Posted
3 hours ago, diesieben07 said:

The event you are using currently should be fine for 1.15.2. If it is not triggering, you are not registering it correctly. Show how you register your event handler.

public ArchitectsDream() {

        final IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

        eventBus.addListener(this::commonRegistry);

        eventBus.addListener(this::clientRegistry);

        eventBus.addListener(this::server);

}

"clientRegistry" and "commonRegistry" work

Posted
On 5/9/2021 at 5:18 PM, diesieben07 said:

The event fires on the forge event bus.

Thank you more for your help, I don't even know how to thank you :)

However, in "gratitude" I would like to ask one more question.

The fact is that my Manager supports 3 types of files and for each I have my own deserializer. And this order of events does not quite fit in with the Forge ReloadListener, where the T type is essentially the file extension that is obtained after preparation. (like for example the same RecipeManager passes keys and JsonObject). In this case, is it better to inherit from IFutureReloadListener or can you do something differently?
(To put it simply, I wanted to say that the apply and prepare methods and the type T are not entirely appropriate and unnecessary).

I hope you understand what I mean :)

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

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

Announcements



×
×
  • Create New...

Important Information

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