-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vastly simplify mod initialization #110
Conversation
Last commit published: f45adb69e7dd04a9794046cf689928a546f9f89b. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #110' // https://github.com/neoforged/FancyModLoader/pull/110
url 'https://prmaven.neoforged.net/FancyModLoader/pr110'
content {
includeModule('net.neoforged.fancymodloader', 'earlydisplay')
includeModule('net.neoforged.fancymodloader', 'loader')
}
}
} |
There is a usecase (that would need s simple hook) that will no longer be possible after this PR, namely getting a callback after the modlist ( Previously this was (perhaps unintentionally) possible with the following:
(Until recently this had the downside that an The usecase for me specifically is a sub-loader that supports Neo, Forge & Fabric (and Quilt). I do have a But when I have build the containers for NF I would now have no more options to hook into FML to make sure I can also built my modlist before the mods get constructed. |
@Elec332 thanks for the reply.
I don't have the impression that it must be done like that. Couldn't you build the mod list on-demand? For example the first time it is queried. You could also do the loader finalization the first time an ElecModContainer is built. |
While a part of it could be done lazily like that (and I considered it before I found the custom loader state way worked, but I really disliked it), it is really not a nice way of doing things. First of all saying "the first of an unknown number of mods is being loaded, so we're building the modlist I guess, let's do part of the finalization" is not a great way of doing things. It is currently possible with all (big) loaders; Fabric (and Quilt) makes their containers so early that a Neo would in this case be the one loader where it would be impossible to fully finilize the loader before any mods get loaded, which considering the amount of hooks available for custom 'stuff' in FML would seem a bit strange to me. A nice place for something like this could be a (default) method in
Since I guess lifecyle events were replaced by the
which would be called right before the new |
Some sort of SPI-loaded early initialization hook would make sense in my opinion. I could see it being used by other loader abstractions. |
@Elec332 I added |
Looks good, thanks! |
Well I don't entirely know what structural changes are going on here, and it's non-obvious from just browsing the changeset, but I don't see anything egregious |
loader/src/main/java/net/neoforged/fml/loading/progress/StartupNotificationManager.java
Show resolved
Hide resolved
This reverts commit 76b3c4d.
Changed finalization logic for all loaders for consistent behaviour. Will look into a better alternative later
Redo mod loading to remove a lot of unnecessary indirection, and finally make the code understandable.
All the steps are now handled by straightforward methods in
ModLoader
such asdispatchParallelEvent
orrunInitTask
. Dispatch happens in a single NeoForge class.See neoforged/NeoForge#774.