Jump to content

Is there a forge event that triggers when all mods have loaded?


UntouchedWagons

Recommended Posts

Yes, sort of.  The FML lifecycle events are for this.  First all the mods go thorugh pre-init, then through init, and then through post-init.

 

So in the init handler you can be confident that all mods have gone through their pre-init, and so forth.

 

I think by the time you get to the server started event you can be sure that they are all loaded.  Anyway play with the FML life cycle events.  I describe them a bit in my events tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

@jabelar, no. There is no AllModsLoadedEvent. Please don't confuse people when a specific question was asked.

Such an event would have to be fired after all mods have finished FMLPostInitialization.

 

Anyways, thank you for explaining the FML lifecycle events which I'm pretty sure the poster knows about at least PreInit, Init, and PostInit anyways.

Link to comment
Share on other sites

@jabelar, no. There is no AllModsLoadedEvent. Please don't confuse people when a specific question was asked.

Such an event would have to be fired after all mods have finished FMLPostInitialization.

 

Anyways, thank you for explaining the FML lifecycle events which I'm pretty sure the poster knows about at least PreInit, Init, and PostInit anyways.

 

I know about preInit and Init but I didn't know about PostInit which might do what I want.

 

Hi

 

As you might have guessed from the two posts above, we're not quite sure what you mean by "loaded".

 

What are you trying to do, exactly?

 

-TGG

 

I want to loop through all the available recipes (crafting recipes, furnace recipes, recipe systems of other mods like Buildcraft's Assembly Table, etc...) and sort them according to owning mod. My end goal is to recreate my Resource Calculator as a mod rather than as a website I need to keep maintaining.

I like trains.

Link to comment
Share on other sites

Hi

 

In that case, I reckon there's a good chance that putting that code into PostInit will work, as Jabelar suggested.  Recipes are supposed to be all registered in Init.

From the forge docs...

 

 

PreInitialization - "Run before anything else. Read your config, create blocks, items, etc, and register them with the GameRegistry."

Initialization - "Do your mod setup. Build whatever data structures you care about. Register recipes."

PostInitialization -  "Handle interaction with other mods, complete your setup based on this.

 

-TGG

 

 

Link to comment
Share on other sites

Cool. I was looking at your tutorial and I saw there's events for the server starting and stopping but is there an event for the game (client-side) shutting down? I want to have a built-in HTTP server using netty and I want it running as long as the player has Minecraft running, not necessarily connected to a server.

I like trains.

Link to comment
Share on other sites

@jabelar, no. There is no AllModsLoadedEvent. Please don't confuse people when a specific question was asked.

Such an event would have to be fired after all mods have finished FMLPostInitialization.

 

Actually a specific question was not asked.  You assumed what "loaded" meant, and I gave them options to choose from.  Most people asking about "loaded" have something in mind, and based on the further conversation on this thread, the original poster did not in fact understand that the FML events indicated the state of the various mods loading.

 

In fact there is a FMLLoadCompleteEvent, although I'm not sure it registers to a general event bus or not.  But the LoaderState has an enum of AVAILABLE when all modes are loaded.

 

I'd like to also add that you can (mostly) control the order of the mod loading using the @Mod annotation attribute dependencies = "after:FileName".  I think you can specify that your mod loads after all, but of course if multiple mods did that then I'm not sure you could be fully sure.  But anyway, in the post init, if you made your mod load last, you could be pretty confident that all the mods had done their loading.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

You are right about what he wanted to know.

 

There is a caveat to assuming, however, that catching PostInit event means all mods loaded will be available. Since other mods (without forcing your mod to always be last) may still fail during PostInit, you cannot assume the system has stabilized on a set of mods at that point.

 

This is what I imagined the author of the post wanted to know. And the answer is indeed, you cannot know for certain.

Link to comment
Share on other sites

So is there an event of some sort that's triggered when the game itself is shutting down that works client side?

 

That's an interesting question.  There is a server stopping event and a server stopped event, but I'm not sure what that does when you're a client only.  You might still want to try it.

 

I guess it depends on what you specifically want to do.  I mean the client can be stopped in a number of ways, including just hitting the window close to force it to shut down.

 

For example, if you just want to know when a player returns to the main menu, I think you can do that by handling the gui open event and checking for the main menu, or something like that.

 

What exactly do you mean by "game itself is shutting down"?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

You are right about what he wanted to know.

 

I find that most of the time, people don't ask the question in the way that they need, otherwise they probably would have figured out the solution themselves!  It's like all the forum posts that say "how do you edit base classes" when they mean they just want to change the drops for an entity, etc.  If a person knew to ask: what event do I need to handle to change drops of a living entity, they probably would have found the LivingDropsEvent themselves...

 

So I usually supply people with information "around" the question they asked.

 

But back to your question you're certainly right that you can never be sure that other mods have honored the pre-init, init, and post-init in a way that you can trust.

 

I was looking at this further, and it seems that you can actually poll the FMLClientLoader.isLoading() function.  It returns a boolean called loading which goes to false at the very end of the post-init and in fact happens right around the message in the console that says "Forge Mod Loader has successfully loaded x mods".

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Actually, I think I just found a way to detect when all the mods are loaded!  Right at the point when they are all finished.

 

The new gui factory stuff for enabling the config guis calls the initialize() method for your guifactory right after all the mods are loaded in the finishMinecraftLoading() method in the FMLClientHandler class.  So if you register a gui factory, whatever you do in the initialize() method will be performed right at the moment when all mods are finished loading!

 

Ta da!

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Use postInit and if you have a specific mod that does things in postInit and you need your things to run after that use the dependencies property from the @Mod annotation.

 

That is actually my first suggestion, but Sequiteri didn't like the fact you couldn't make it generic (i.e. if you truly wanted all mods loaded, including ones you didn't know you needed to depend on).

 

First of all: Absolute ugly hack and also only works on the client.

 

The OP already established they were interested on the client side which is why I considered it a suitable suggestion.

 

I also don't think this is an "ugly hack".  It is really a nice hook, just like any other forge hook: basically there is a method call at exactly the right point that is meant for you to have full control over.  It seems pretty elegant to me because it is being used for exactly the same purpose -- the gui factory wants to know when all mods are loaded, just like we're trying to solve for.

 

Anyway, this is obviously academic because what the OP wants to achieve doesn't seem to really need such specific "all mods loaded" solution.

 

 

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa OLXTOTO telah menetapkan standar baru dalam dunia perjudian dengan menjadi platform terbesar untuk pengalaman gaming yang penuh kemenangan dan kegacoran, sepanjang masa. Dengan fokus yang kuat pada menyediakan permainan yang menghadirkan kesenangan tanpa batas dan peluang kemenangan besar, OLXTOTO telah menjadi pilihan utama bagi para pencinta judi berani di Indonesia. Maxwin: Mengejar Kemenangan Terbesar Maxwin bukan sekadar kata-kata kosong di OLXTOTO. Ini adalah konsep yang ditanamkan dalam setiap aspek permainan yang mereka tawarkan. Dari permainan slot yang menghadirkan jackpot besar hingga berbagai opsi permainan togel dengan hadiah fantastis, para pemain dapat memperoleh peluang nyata untuk mencapai kemenangan terbesar dalam setiap taruhan yang mereka lakukan. OLXTOTO tidak hanya menawarkan kesempatan untuk menang, tetapi juga menjadi wadah bagi para pemain untuk meraih impian mereka dalam perjudian yang berani. Gacor: Keberuntungan yang Tak Tertandingi Keberuntungan seringkali menjadi faktor penting dalam perjudian, dan OLXTOTO memahami betul akan hal ini. Dengan berbagai strategi dan analisis yang disediakan, pemain dapat menemukan peluang gacor yang tidak tertandingi dalam setiap taruhan. Dari hasil togel yang tepat hingga putaran slot yang menguntungkan, OLXTOTO memastikan bahwa setiap taruhan memiliki potensi untuk menjadi momen yang mengubah hidup. Inovasi dan Kualitas Tanpa Batas Tidak puas dengan prestasi masa lalu, OLXTOTO terus berinovasi untuk memberikan pengalaman gaming terbaik kepada para pengguna. Dengan menggabungkan teknologi terbaru dengan desain yang ramah pengguna, platform ini menyajikan antarmuka yang mudah digunakan tanpa mengorbankan kualitas. Setiap pembaruan dan peningkatan dilakukan dengan tujuan tunggal: memberikan pengalaman gaming yang tanpa kompromi kepada setiap pengguna. Komitmen Terhadap Kepuasan Pelanggan Di balik kesuksesan OLXTOTO adalah komitmen mereka terhadap kepuasan pelanggan. Tim dukungan pelanggan yang profesional siap membantu para pemain dalam setiap langkah perjalanan gaming mereka. Dari pertanyaan teknis hingga bantuan dengan transaksi keuangan, OLXTOTO selalu siap memberikan pelayanan terbaik kepada para pengguna mereka. Penutup: Mengukir Sejarah dalam Dunia Perjudian Daring OLXTOTO bukan sekadar platform perjudian berani biasa. Ini adalah ikon dalam dunia perjudian daring Indonesia, sebuah destinasi yang menyatukan kemenangan dan keberuntungan dalam satu tempat yang mengasyikkan. Dengan komitmen mereka terhadap kualitas, inovasi, dan kepuasan pelanggan, OLXTOTO terus mengukir sejarah dalam perjudian dunia berani, menjadi nama yang tak terpisahkan dari pengalaman gaming terbaik. Bersiaplah untuk mengalami sensasi kemenangan terbesar dan keberuntungan tak terduga di OLXTOTO - platform maxwin dan gacor terbesar sepanjang masa.
    • OLXTOTO - Bandar Togel Online Dan Slot Terbesar Di Indonesia OLXTOTO telah lama dikenal sebagai salah satu bandar online terkemuka di Indonesia, terutama dalam pasar togel dan slot. Dengan reputasi yang solid dan pengalaman bertahun-tahun, OLXTOTO menawarkan platform yang aman dan andal bagi para penggemar perjudian daring. DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI Beragam Permainan Togel Sebagai bandar online terbesar di Indonesia, OLXTOTO menawarkan berbagai macam permainan togel. Mulai dari togel Singapura, togel Hongkong, hingga togel Sidney, pemain memiliki banyak pilihan untuk mencoba keberuntungan mereka. Dengan sistem yang transparan dan hasil yang adil, OLXTOTO memastikan bahwa setiap taruhan diproses dengan cepat dan tanpa keadaan. Slot Online Berkualitas Selain togel, OLXTOTO juga menawarkan berbagai permainan slot online yang menarik. Dari slot klasik hingga slot video modern, pemain dapat menemukan berbagai opsi permainan yang sesuai dengan preferensi mereka. Dengan grafis yang memukau dan fitur bonus yang menggiurkan, pengalaman bermain slot di OLXTOTO tidak akan pernah membosankan. Keamanan dan Kepuasan Pelanggan Terjamin Keamanan dan kepuasan pelanggan merupakan prioritas utama di OLXTOTO. Mereka menggunakan teknologi enkripsi terbaru untuk melindungi data pribadi dan keuangan para pemain. Tim dukungan pelanggan yang ramah dan responsif siap membantu pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Promosi dan Bonus Menarik OLXTOTO sering menawarkan promosi dan bonus menarik kepada para pemainnya. Mulai dari bonus selamat datang hingga bonus deposit, pemain memiliki kesempatan untuk meningkatkan kemenangan mereka dengan memanfaatkan berbagai penawaran yang tersedia. Penutup Dengan reputasi yang solid, beragam permainan berkualitas, dan komitmen terhadap keamanan dan kepuasan pelanggan, OLXTOTO tetap menjadi salah satu pilihan utama bagi para pecinta judi online di Indonesia. Jika Anda mencari pengalaman berjudi yang menyenangkan dan terpercaya, OLXTOTO layak dipertimbangkan.
    • I have been having a problem with minecraft forge. Any version. Everytime I try to launch it it always comes back with error code 1. I have tried launching from curseforge, from the minecraft launcher. I have also tried resetting my computer to see if that would help. It works on my other computer but that one is too old to run it properly. I have tried with and without mods aswell. Fabric works, optifine works, and MultiMC works aswell but i want to use forge. If you can help with this issue please DM on discord my # is Haole_Dawg#6676
    • Add the latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here  
    • I have no idea how a UI mod crashed a whole world but HUGE props to you man, just saved me +2 months of progress!  
  • Topics

×
×
  • Create New...

Important Information

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