patrick-choe / mojang-spigot-remapper

Apache License 2.0
22 stars 3 forks source link

Mojang -> Spigot Remapper


Description

Gradle plugin for remapping mojang-mapped artifact to spigot-mapped

Uses SpecialSource for remapping.


Note

For those seeking for nms & stable remapper, try using userdev from PaperMC/paperweight project.

I will not (can not) provide any additional help for additional non-spigot features (incl. support for specific spigot fork)

There could be some methods that do not remap properly, so it is required to find some workarounds for those methods.


Applying plugin

Kotlin

Using the plugins DSL:

plugins {
    id("io.github.patrick.remapper") version "1.4.2"
}

Using legacy plugin application:

Click to View ```kotlin buildscript { repositories { maven { url = uri("https://plugins.gradle.org/m2/") } } dependencies { classpath("io.github.patrick-choe:mojang-spigot-remapper:1.4.2") } } apply(plugin = "io.github.patrick.remapper") ```

Groovy

Using the plugins DSL:

plugins {
    id "io.github.patrick.remapper" version "1.4.2"
}

Using legacy plugin application:

Click to View ```groovy buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "io.github.patrick-choe:mojang-spigot-remapper:1.4.2" } } apply plugin: "io.github.patrick.remapper" ```

How to use


Advanced configuration option

tasks {
    remap {
        // Required
        // Specify minecraft (spigot) version of your project.
        // TODO: Auto-detect library version by default
        version.set("1.20.5")

        // Use this option to change remapping action.
        // Defaults to `RemapTask.Action.MOJANG_TO_SPIGOT`.
        action.set(RemapTask.Action.MOJANG_TO_SPIGOT)

        // If this option is set to true, the entire task would be skipped.
        skip.set(true)

        // Use this option to explicitly set the input task.
        // Defaults to `jar` task.
        inputTask.set(jar)

        // If this option is used, instead of overwriting an existing artifact,
        // the remap output would be available at file named as `archiveName`.
        // Note that `archiveName` has higher priority over `archiveClassifier`. 
        archiveName.set("${project.name}-${project.version}-remapped.jar")

        // If this option is used, instead of overwriting an existing artifact,
        // the remap output would be available at "${archiveBaseName}-${archiveVersion}-${archiveClassifier}.jar"
        // Note that `archiveName` has higher priority over `archiveClassifier`. 
        archiveClassifier.set("remapped")

        // Use this option to set output directory of remapped archive file.
        // Defaults to output directory of input task.
        archiveDirectory.set(File(projectDir, "output"))
    }
}

Additional information

All contributions are welcome!

If you encounter any problems, or have suggestions, please leave an issue!

Contact me at


Changelog

1.4.2

1.4.1 - Update library versions - Fix deprecated gradle features (Thanks to [@gmitch215](https://github.com/gmitch215))
1.4.0 - Update library versions - Modify buildscript - Change type of `archiveDirectory` option to `DirectoryProperty` (Thanks to [@AlexProgrammerDE](https://github.com/AlexProgrammerDE)) - Change visibility of `ActualProcedure` to `internal`
1.3.0 - Update library versions - Add archiveDirectory option
1.2.0 - Fix internal implementation of remapping - Change configuration options
1.1.2 - Fix publication error from v1.1.1
1.1.1 - Update library versions - Add note about `userdev`
1.1.0 - Add archiveName, archiveClassifier option
1.0.0 - Initial release