#Mapping problem with SpecialSource (using gradle and spigot 1.18.1)

1 messages · Page 1 of 1 (latest)

mighty patrol
short kiln
#

How are you remapping it

mighty patrol
short kiln
#

Probably is an issue with the gradlesource plugin then. I can send you the way that I remap with gradle if you'd like? It's quite a bit longer though since it's not a plugin.

mighty patrol
#

(bringing back the old messages)

short kiln
#

Ah, yeah you're probably missing something. Hang on let me check.

#

Why are you using SpecialSource 1.10

#

Try 1.11.0 and see if that works.

mighty patrol
#

i used both 1.10 and 1.11 same thing

short kiln
#

Oh!

#

Are you on Windows?

mighty patrol
#

yes

short kiln
#

Ah, found the issue then. It's really dumb. Lol

mighty patrol
#

and as stated in my message i've already replaced the vars

short kiln
#

Replace the : before $HOME with ;

mighty patrol
#

oh rly

short kiln
#

Yep. In Linux, which is what md_5 uses, : is correct. On Windows it requires ;.

mighty patrol
#

(╯°□°)╯︵ ┻━┻

short kiln
#

Yeah I ran into the same issue. I facepalmed pretty hard when I noticed lol

mighty patrol
#

why is this a thing since it's arguments given to an app, i mean why does java changes this on windows lol

short kiln
#

Probably because of how Windows references Drives

#

C:/

#

So colon can't be used

mighty patrol
#

oh yeah that bad design idea thing x')

#

kay lemme check the result then now

#

okay, yeah it's wroking correctly, so this has something to do with the gradle plugin

short kiln
#

Yeah most likely

mighty patrol
#

it's annoying there are no official gradle plugins cuse i'm more familiar with gradle than maven

short kiln
#

Yeah, I agree. I just made a task to run the commands when I build.

mighty patrol
#

if your method using cli or a custom gradle java task?

#

yeah that's what i'm trying to avoid

short kiln
#

It's using a task that just runs the CLI commands lol

#

Yeah, it's long but it works

#

So 🤷‍♂️

mighty patrol
#

cuse i could make a task that uses directly the methods from the SpecialSource jar using java tasks

short kiln
#

I mean if you know how to make gradle plugins you should definitely try lol

#

I'd use it

mighty patrol
#

actually never made a gradle plugin but java task, i already did one at some point

#

but at least for now, I would take your task using the cli

#

if you don't mind

mighty patrol
#

so you're overwriting the built jar with the remapped one like md5 does?

short kiln
#

Yep, the initial input file will be the finalized remapped one at the end.

mighty patrol
#

cuse i was keeping the original built jar and renaming the remapped one xxxxx-spigot.jar

short kiln
#

You can do that too

#

Just add -spigot in the -o argument in the 2nd command

mighty patrol
#

yeah just trying to make my habits

short kiln
#

That's pretty much what mine does lol

mighty patrol
#

well, i can confirm that it is a success

#

this is what i came up with (note i'm using the shadow plugin, so if not using, replace shadowJar with jar)

task remapJar {
    group = 'build'
    String home_dir = project.gradle.gradleUserHomeDir.parent
    String maven_repo = "${home_dir}/.m2/repository/org/spigotmc/"
    String mc_ver = project.mc_version + "-R0.1-SNAPSHOT"

    dependencies {
        compileOnly "net.md-5:SpecialSource:${project.specialsource_version}:shaded"
    }

    doLast {
        String tooling_path = project.configurations.compileClasspath.find {
            it.name.startsWith("SpecialSource-${project.specialsource_version}-shaded")
        }

        String jar_basename = "${jar.archiveBaseName.get()}-${jar.archiveVersion.get()}"

        // remap to obf
        exec {
            commandLine 'java',
                    '-cp', "${tooling_path};${maven_repo}/spigot/${mc_ver}/spigot-${mc_ver}-remapped-mojang.jar", 'net.md_5.specialsource.SpecialSource',
                    '-l', // --live
                    '-i', "${buildDir}/libs/${shadowJar.archiveFileName.get()}",
                    '-o', "${buildDir}/libs/${jar_basename}-obf.jar",
                    '-m', "${maven_repo}/minecraft-server/${mc_ver}/minecraft-server-${mc_ver}-maps-mojang.txt",
                    '-r', '-q' // --reverse, --quiet
        }

        // remap to Spigot
        exec {
            commandLine 'java',
                    '-cp', "${tooling_path};${maven_repo}/spigot/${mc_ver}/spigot-${mc_ver}-remapped-obf.jar", 'net.md_5.specialsource.SpecialSource',
                    '-l',
                    '-i', "${buildDir}/libs/${jar_basename}-obf.jar",
                    '-o', "${buildDir}/libs/${jar_basename}-spigot.jar",
                    '-m', "${maven_repo}/minecraft-server/${mc_ver}/minecraft-server-${mc_ver}-maps-spigot.csrg",
                    '-q'
        }
    }
}

assemble.dependsOn(remapJar)