Skip to content

Add Simple Renamer example.#4

Open
LexManos wants to merge 4 commits intoMinecraftForge:masterfrom
LexManos:renamer
Open

Add Simple Renamer example.#4
LexManos wants to merge 4 commits intoMinecraftForge:masterfrom
LexManos:renamer

Conversation

@LexManos
Copy link
Member

@LexManos LexManos commented Feb 9, 2026

Simple example of using the renamer plugin to build a obfusicated jar.
Addresses #3

Two main concerns I wanted to bounce of @Jonathing

  1. This relies on having the mavenizer run, but currently doesn't invoke it in any way.
  2. This also relies on the modder finding the mcpconfig version/parchment version. Which I can imagine now people geting confused about.

So basically, FG needs to make a couple helpers to get the mappings artifacts.
Not super critical, FD7 is the primary, but I think something like the Files object you're doing for that is probably something we could pull for this as well.

Copy link

@PaintNinja PaintNinja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, a bit clearer how to reobf in FG7 now. Left a bunch of comments - some minor stuff, some more significant questions.

// This is generated by mavenizer, this is `net.minecraft:mappings_{channel}:{minecraft}-{mcp}:map2srg@tsrg.gz`
// I intend to both publish these as public artifacts on the Forge maven, and expose a FG helper to make you not need to find the MCP version
// Parchment is official mappings, just with parameters, so you can use official.
mappings('net.minecraft:mappings_official:1.21.10-20251007.101210:map2srg@tsrg.gz')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can users find the MCP timestamp found in this artifact string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my changes to FG, this information is now exposed via FG. I'm updating the example right now to show it.
We should probably build a matrix of exact MCP Versions for each forge version. For documentation. Until that happens, it is typically the latest version listed on MCPConfig's index.

implementation minecraft.dependency('net.minecraftforge:forge:1.21.10-60.0.17')
}

renamer.classes(jar) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does one register multiple reobf jar tasks for different inputs?

tasks.register('reobfJar', RenameJar) {
    // ?
}

Is renamer.classes(...) { ... } a helper for task registration or required for it to work? If the former and not much more verbose, I'd prefer knowing the standard Gradle way for registering the task.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sources function accepts a name as the first parameter
So to create a second task you can do:
renamer.classes('renameApiJar', apiJar) or renamer.classes(apiJar). Both will create the 'renameApiJar' task.

It is a helper that replaces:

def target = jar
tasks.register('rename' + target.name.capitalize, net.minecraftforge.renamer.gradle.RenameJar) {
  from target
}

I am adamantly against having modders import custom classes in their buildscript, but if you want to do it in your own you can. But it is not recommended as we're intending to add a sources variant that applies Srg2Source for you.

Eventually it will also add helpers for generating publish artifacts with the correct marker attributes denoting what name they are in. But that was pushed to a later date as its not important right now.

LexManos and others added 3 commits February 12, 2026 11:34
Co-authored-by: Paint_Ninja <PaintNinja@users.noreply.github.com>
Co-authored-by: Paint_Ninja <PaintNinja@users.noreply.github.com>
Co-authored-by: Paint_Ninja <PaintNinja@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants