gnembon / fabric-carpet

Fabric Carpet
MIT License
1.72k stars 275 forks source link

[RFC] Allow Scarpet Apps to specify a minimum version #642

Closed altrisi closed 3 years ago

altrisi commented 3 years ago

Currently, there is no way for an app to ask for a minimum Carpet/extension version, and if it's using newer features, it will just fail with something similar to Function not defined, or just silently failing to apply some new feature or event, which could derive to app malfunction.

Therefore I suggest adding a new map to the __config() to prevent an app from loading in case the current Carpet version doesn't apply to the requirements set by the app.

It could be something like the following:


__config() -> 
{
  'requires' -> 
  {
    'carpet' -> '>=1.14.20',
    'some-scarpet-extension' -> '1.2.3'
  }
}

It could be based on the modid, and then use FabricLoader's (not Fabric API) version "APIs" (it is located in the api package) to check for compatibility directly using mod's metadata parser, so it would allow all operators supported by Fabric in Scarpet. That could be useful, for example, in case it's using old, removed functions and no one is willing to update it, it could specify, for instance 'carpet' -> '<=1.14.19'.

This could make users not be able to load an app even if it's compatible: Well, actually not, since if they know it's compatible, they also probably know how to delete that from the config. And also, this would tell people to update, which I don't think is bad.

Thoughts?

altrisi commented 3 years ago

Moved to Discussions in #644.