DimensionalDevelopment / Rift

A lightweight mod loader and API for Minecraft 1.13
MIT License
122 stars 50 forks source link

[Feature Request] Can Rift add TweakClass for CoreMod like LiteLoader and Forge? #4

Closed xfl03 closed 6 years ago

xfl03 commented 6 years ago

Feature

If a Mod has "TweakClass" in its METAINF, it means the mod wants to use the TweakClass provided.
Can Rift add TweakClass to LaunchWrapper for CoreMod like LiteLoader and Forge?
Thanks a lot.

Implements

Runemoro commented 6 years ago

This can be done in Rift by creating a class that implements InitializationListener. From there, mods can add class transformers and tweakers by calling LaunchWrapper's methods.

Once we switch to ModLauncher, though, tweak classes will be loaded as services by ModLauncher, so they will just need to register their tweak class as a service by adding it to META-INF/services.

xfl03 commented 6 years ago

I think it is meaningful to implement this feature in Rift directly.
Forge and LiteLoader both implement it, which means it could be a universal way to register TweakClass in ModLoader.

By doing this, a mod with TweakClass registered in manifest can be loaded in all modloaders.

Runemoro commented 6 years ago

It would, yes, but we will be switching to ModLauncher very soon which won't support IClassTransformers anymore. ModLauncher will have a universal way to register them (META-INF/services) which will be supported by Rift.

xfl03 commented 6 years ago

ModLauncher cannot work now and there is no change in 24 days. In my view, it still has a long time to switch to ModLauncher, why not support this feature to wait for the release of ModLauncher?

Thanks a lot!

xfl03 commented 6 years ago

I made this feature by myself :( https://github.com/xfl03/RiftTweakLoader

xfl03 commented 6 years ago

Please DO NOT ONLY make the feature for OptiFine. There is NOT ONLY OptiFine could be loaded in this way. I don't think it's a right thing to DISCRIMINATE any mod.

I have made CustomSkinLoader to be loaded like Optifine, which means if there is a way OptiFine can be loaded, my mod can also be loaded. (Like TweakMod, loaded as library and so on) But you made OptiFine as a special mod to support it, while you are ignoring other TweakMod.

In your idea, you have said:

This can be done in Rift by creating a class that implements InitializationListener. From there, mods can add class transformers and tweakers by calling LaunchWrapper's methods. It would, yes, but we will be switching to ModLauncher very soon which won't support IClassTransformers anymore.

It means you WON'T let Rift support TweakMod loading, and TweakMod should load IClassTransformer itself by adding InitializationListener to register it. But you made it for OptiFine specially, can I think other TweakMod is NOT A MOD?

Runemoro commented 6 years ago

This is not done for Optifine. Optifine's TweakClass is ignored as it would only works with Forge. We're creating a custom tweaker and InitializationListener to set it up instead.

Using the TweakClass of a mod would cause several problems:

xfl03 commented 6 years ago

There's no way of checking they're for the right Minecraft version. 1.12 mods would also be loaded.

If I put 1.12.2 OptiFine into mods, it also will be loaded and cause a crash. Users should take effort to put a jar file into mods folder rather than mod loader detect all thing for users. And why should other TweakMod add TweakClass by itself rather than by Rift automaticly?

Another thing, please change to ModLauncher as soon as possible, almost all the modder is looking forward to have a look of it.