FabricMC / fabric-loader

Fabric's mostly-version-independent mod loader.
Apache License 2.0
625 stars 264 forks source link

Allow very early entry point #223

Open Janrupf opened 4 years ago

Janrupf commented 4 years ago

I'm developing a small mod which allows to download mods after launching the game. Some mod platforms don't allow distributing third party jars, so downloading them right before launch is the only option. In order for this to work, I need an entry point which executes my code before the rest of the mods are loaded. My current implementation only works on Forge and Launchwrapper, because I use Forge to detect my jar from the mods folder and inject a tweaker with a very low loading order, which then bootstraps my system, installs the mods and then continues the game launch. However, I have not been able to figure out a way to get the same effect on Fabric. I can imagine, that this would be possible, if the Fabric loader would read the jar files from the mods directory, look for a special manifest entry and then execute code in case such entry is found.

modmuss50 commented 4 years ago

Loader does have a PreLaunchEntrypoint that ensures that the classloader is setup correctaly. However this is still later than you need.

Adding mods later isnt an easy thing to slove as the dependency resoultion may fail without the added mods.

What you could do now is create a wrapper that calls fabric-loader once you have downloaded the mods, but this will requrie it being on the classpath at startup.

This isnt a trivial thing to slove, but its something that has been spoken about. Loader should really have a solid API to allow mods to be added after the first loading pass. Im not too sure how it will look when its done.

This issue is similar to https://github.com/FabricMC/fabric-loader/issues/175

Chocohead commented 4 years ago

You might want to be following the FabLab's venture into allowing this.

i509VCB commented 4 years ago

I've been thinking up a concept for this, but I am going to talk to Player to flesh out some of them before I end up nuking half of the loader codebase 😛

sfPlayer1 commented 4 years ago

The biggest issue I see there is moving half of loader into api territory if we're not careful..

liach commented 3 years ago

Imo a solution would be to expose an api for the mod discovery (mod candidate, etc.)

3TUSK commented 2 years ago

A simple follow-up on this issue ticket. I/We have a “mod” that does the following:

  1. fetch a list of mods from specified source
  2. check detached PGP signatures
  3. if a mod passes check, add the mod to the list of mods to load

, and I have done some preliminary research on this, only found it being impossible on Fabric Loader (need to implement custom ModCandidateFinder which is non-API, plus no possible time point to inject this custom ModCandidateFinder impl). After searching existing issue tickets, I believe that our use case is similar to that of OP's, thus a follow-up instead of a new ticket.

This “mod” is intended for use in in-game conventions (think BTM/LimboCon/BlanketCon, modding jams, etc.) where organizers anticipate rapid, frequent mod updates, but do not wish to rely on a specific launcher to handle the mod updates.

Possible workarounds are much appreciated.

sfPlayer1 commented 2 years ago

I wouldn't bother with workarounds, a proper solution is not too far off at this point.