Skip to content

patrick-choe/mojang-spigot-remapper

Repository files navigation

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
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
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

  • Prerequisite: Run BuildTools with --remapped option.
  • Setup by applying the plugin to the project. See above for more details.
    • This will add remap task to the project.
  • Configure remap task. Advanced configuration option is available in the below section.
    • Example:
      tasks {
          remap {
              version.set("1.20.5")
          }
      }
  • Run remap task to remap mojang-mapped jar artifact to spigot-mapped.

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

  • Discord: patrickkr
  • Email: mailpatrickkr [@] gmail.com

Changelog

1.4.2

  • Remove transitive dependency inheritance
  • Remove unnecessary error suppressing
1.4.1
  • Update library versions
  • Fix deprecated gradle features (Thanks to @gmitch215)
1.4.0
  • Update library versions
  • Modify buildscript
  • Change type of archiveDirectory option to DirectoryProperty (Thanks to @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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages