juraj-hrivnak / Pakku

A multiplatform modpack manager for Minecraft: Java Edition. Create modpacks for CurseForge, Modrinth or both simultaneously.
https://juraj-hrivnak.github.io/Pakku/
European Union Public License 1.2
24 stars 3 forks source link

Confusion about mismatched/duplicated project slugs #15

Closed Wxrlds closed 1 month ago

Wxrlds commented 3 months ago

I'm in the process of setting up a multiplatform project and stumbled across this issue with the "Chameleon" mod.

Essentially, the program is getting confused when the project slug for a mod is used by another mod on the other platform.

Probably easiest to understand if I give an example:

The Chameleon mod on Curseforge has the chameleon slug, while the same Chameleon mod on Modrinth has the texel-chameleon slug.

The issue is that on Modrinth, there is another Mod that has the chameleon slug, causing the program to do weird things.

java -jar pakku.jar add rZrAKGe1:rwV3yGi9
> {mr=texel-chameleon} was not found on CurseForge.
Specify CurseForge: 230497
> {modrinth=chameleon, curseforge=chameleon} versions do not match across platforms.
   [modrinth: Chameleon-1.12.2-4.1.3.jar, curseforge: Chameleon-1.12-4.1.3.jar]

The interesting part is what gets written to the pakku-lock.json

  1. The slug and id of the modrinth id is not the same slug from the add command
  2. The file_name and url of the modrinth version are correct
    {
            "pakku_id": "rRtVmg3bmRaIy308",
            "type": "MOD",
            "side": "BOTH",
            "slug": {
                "modrinth": "chameleon",
                "curseforge": "chameleon"
            },
            "name": {
                "modrinth": "Chameleon",
                "curseforge": "Chameleon"
            },
            "id": {
                "modrinth": "DNMzKpyW",
                "curseforge": "230497"
            },
            "files": [
                {
                    "type": "modrinth",
                    "file_name": "Chameleon-1.12.2-4.1.3.jar",
                    "mc_versions": [
                        "1.12",
                        "1.12.1",
                        "1.12.2"
                    ],
                    "loaders": [
                        "forge"
                    ],
                    "release_type": "release",
                    "url": "https://cdn.modrinth.com/data/rZrAKGe1/versions/rwV3yGi9/Chameleon-1.12.2-4.1.3.jar",
                    "id": "rwV3yGi9",
                    "parent_id": "rZrAKGe1",
                    "hashes": {
                        "sha512": "50def09ba7c254adc7cbcf21a8d52f3e17beee59003d779a2f3bcde627270474183e9e0d0592f4e314b37922a91ab364e60290bc7a0c4cc7bf6c17cc4e52c0c0",
                        "sha1": "77c74d2311db380ba8251617b131f2f7fe5a7b44"
                    },
                    "required_dependencies": [
                    ],
                    "size": 94972
                },
                {
                    "type": "curseforge",
                    "file_name": "Chameleon-1.12-4.1.3.jar",
                    "mc_versions": [
                        "1.12.1",
                        "1.12",
                        "1.12.2"
                    ],
                    "release_type": "release",
                    "url": "https://edge.forgecdn.net/files/2450/900/Chameleon-1.12-4.1.3.jar",
                    "id": "2450900",
                    "parent_id": "230497",
                    "hashes": {
                        "sha1": "5ed3dd5fd1ebded57bfe525b4ece11232bd14e5e",
                        "md5": "e42efa8f4fd42d2918128a826b740e98"
                    },
                    "required_dependencies": [
                    ],
                    "size": 96859
                }
            ]
        }

    It probably doesn't help that the author uploaded two different files

juraj-hrivnak commented 3 months ago

One solution is to replace the wrong slug in the lock file with the correct slug.

juraj-hrivnak commented 3 months ago

Pakku could ask before assuming the other slug is correct. I will see what I can do.

Wxrlds commented 2 months ago

Putting this here to document some more mods that have the same issue cause

The Iris Shader Mod has the same issue but causes the program to crash entirely:

❯❯❯ {cf=irisshaders} was not found on Modrinth.
Specify Modrinth: iris
teksturepako.pakku.api.data.PakkuException: Can not combine two projects of different type! Project(pakkuId=iE8eT4slmi54hPf1, pakkuLinks=[], type=WORLD, side=null, slug={curseforge=iris}, name={curseforge=Iris}, id={curseforge=715898}, updateStrategy=LATEST, redistributable=false, files=[]) WORLD + Project(pakkuId=sHj18EhUXxDFNQN5, pakkuLinks=[], type=MOD, side=CLIENT, slug={modrinth=iris}, name={modrinth=Iris Shaders}, id={modrinth=YL57xq9U}, updateStrategy=LATEST, redistributable=true, files=[]) MOD
    at teksturepako.pakku.api.projects.Project.plus(Project.kt:49)
    at teksturepako.pakku.api.platforms.Multiplatform.requestProject(Multiplatform.kt:50)
    at teksturepako.pakku.api.platforms.Multiplatform$requestProject$1.invokeSuspend(Multiplatform.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at teksturepako.pakku.cli.cmd.Import.run(Import.kt:33)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:306)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:319)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:40)
    at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:458)
    at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:455)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:475)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:482)
    at teksturepako.pakku.MainKt.main(Main.kt:31)
Error: Modrinth kotlin.Unit

Reason is because on Curseforge the Iris mod has the slug irisshaders but also on CurseForge, there is a "Minecraft Worlds" project with the slug iris https://www.curseforge.com/minecraft/worlds/iris

On Modrinth the Iris Shader Mod has the slug iris

juraj-hrivnak commented 1 month ago

The Iris Shader Mod has the same issue but causes the program to crash entirely:

Thanks. This is a good reminder that the exception should be an error instead.

juraj-hrivnak commented 4 weeks ago

Released in v0.16.0.