docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

Modrinth plugin game version check optional for incorrect publish data

Open hawtre opened this issue 3 months ago • 8 comments

Enhancement Type

Improve an existing feature

Describe the enhancement

If you use MODRINTH_PROJECTS to specify a plugin you want to use, but the plugin hasn't explicitly marked itself as supporting the Minecraft version you're using, the plugin will fail to download. Sometimes plugins won't receive an update in a long time, but the plugin still functions across game updates.

This seems to happen because the Minecraft version is used as a filter when calling the Modrinth API.

It'd be nice to have an option that controls whether the version filter is used.

hawtre avatar Oct 03 '25 02:10 hawtre

It would be better to contact the mod author rather than making me do more work but...

I could see this being possible where the user gives a special version of "any" in place of the other options

adding a colon and then the version id, version number/name, or release type after the project slug. The version ID or number can be found in the 'Metadata' section. Valid release types are release, beta, alpha.

In that case it would pick the first version from the list returned from Modrinth.

Does that seem fine?

itzg avatar Oct 03 '25 12:10 itzg

If this "any" identifier would disable the version filter in the Modrinth API call, then it would work for me.

Personally, I think an option to control the "magic" of tying the defined Minecraft version to the plugin filtering would be nice too. I prefer to explicitly define things, and the "magic" side effects of configuration like this adds a lot of confusion for me, because it happens implicitly.

I also think it's worth considering disabling the game version filter if the plugin version is explicitly defined. e.g. plugin-foo v1.0 supports MC v1.21.5. I define MC v1.21.8, plugin-foo:1.0, and the plugin is downloaded because I've explicitly stated that plugin-foo:1.0 is what I want.

hawtre avatar Oct 03 '25 15:10 hawtre

If this "any" identifier would disable the version filter in the Modrinth API call, then it would work for me.

Personally, I think an option to control the "magic" of tying the defined Minecraft version to the plugin filtering would be nice too. I prefer to explicitly define things, and the "magic" side effects of configuration like this adds a lot of confusion for me, because it happens implicitly.

I generally agree, but I can't do anything about Modrinth and the mod developers that publish there. All I can do is use Modrinth's download API.

I also think it's worth considering disabling the game version filter if the plugin version is explicitly defined. e.g. plugin-foo v1.0 supports MC v1.21.5. I define MC v1.21.8, plugin-foo:1.0, and the plugin is downloaded because I've explicitly stated that plugin-foo:1.0 is what I want.

That should already be the case; howver, I might be thinking of the case where the exact version ID (not name) is provided. I'll investigate later.

itzg avatar Oct 03 '25 17:10 itzg

BTW, can you provide a specific example of a mod that incorrectly published version compatibility?

itzg avatar Oct 03 '25 17:10 itzg

BTW, can you provide a specific example of a mod that incorrectly published version compatibility?

Here's one example: EntityDetection

I also think it's worth considering disabling the game version filter if the plugin version is explicitly defined. e.g. plugin-foo v1.0 supports MC v1.21.5. I define MC v1.21.8, plugin-foo:1.0, and the plugin is downloaded because I've explicitly stated that plugin-foo:1.0 is what I want.

That should already be the case; howver, I might be thinking of the case where the exact version ID (not name) is provided. I'll investigate later.

Using entitydetection:1.3.0 won't work if the VERSION env var is set to "1.21.8" from my testing. I see a request made to https://api.modrinth.com/v2/project/NUsm3vyS/version?loaders=["spigot"]&game_versions=["1.21.8"] which doesn't return any results, so the 1.3.0 version won't be installed.

services:
  mc:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"
      TYPE: "PAPER"
      VERSION: "1.21.8"
      DEBUG: "TRUE"
      MODRINTH_PROJECTS: |
        entitydetection:1.3.0

I've noticed another thing... the "loader" being used is "spigot" despite the TYPE env var being set to "paper". Paper has hard-forked from Spigot so it's now more important to be able to distinguish between the two.

hawtre avatar Oct 03 '25 20:10 hawtre

I've noticed another thing... the "loader" being used is "spigot" despite the TYPE env var being set to "paper". Paper has hard-forked from Spigot so it's now more important to be able to distinguish between the two.

I'm aware of that; however, I have to support all versions of Paper in which is tries to find plugins by Paper and then by Spigot. Notice there were two calls:

            [mc-image-helper] 19:23:55.403 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/projects?ids=%5B%22entitydetection%22%5D headers=[user-agent: itzg/mc-image-helper/??? (cmd=modrinth), x-fetch-session: c7013afc-756f-44bc-a577-a3f15def8e79, accept: application/json, host: api.modrinth.com]
            [mc-image-helper] 19:23:55.527 DEBUG : Starting with project='EntityDetection' slug=entitydetection
Paper ====> [mc-image-helper] 19:23:55.545 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/NUsm3vyS/version?loaders=%5B%22paper%22%5D&game_versions=%5B%221.21.8%22%5D headers=[user-agent: itzg/mc-image-helper/??? (cmd=modrinth), x-fetch-session: c7013afc-756f-44bc-a577-a3f15def8e79, accept: application/json, host: api.modrinth.com]
Spigot ===> [mc-image-helper] 19:23:55.614 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/NUsm3vyS/version?loaders=%5B%22spigot%22%5D&game_versions=%5B%221.21.8%22%5D headers=[user-agent: itzg/mc-image-helper/??? (cmd=modrinth), x-fetch-session: c7013afc-756f-44bc-a577-a3f15def8e79, accept: application/json, host: api.modrinth.com]
            [mc-image-helper] 19:23:55.671 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/NUsm3vyS headers=[user-agent: itzg/mc-image-helper/??? (cmd=modrinth), x-fetch-session: c7013afc-756f-44bc-a577-a3f15def8e79, accept: application/json, host: api.modrinth.com]

itzg avatar Oct 04 '25 00:10 itzg

BTW, using version ID works as I expected entitydetection:Z9ToY6fX

Image

itzg avatar Oct 04 '25 00:10 itzg

BTW, using version ID works as I expected entitydetection:Z9ToY6fX

Awesome, I'll switch over to using version IDs

hawtre avatar Oct 04 '25 21:10 hawtre