-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add Simple Renamer example. #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
PaintNinja
left a comment
There was a problem hiding this 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.
| private static final Logger LOGGER = LogUtils.getLogger(); | ||
|
|
||
| public ExampleMod(FMLJavaModLoadingContext context) { | ||
| LOGGER.info("If this shows up we can reference obfusication code: " + Blocks.DIRT.getDescriptionId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
| LOGGER.info("If this shows up we can reference obfusication code: " + Blocks.DIRT.getDescriptionId()); | |
| LOGGER.info("If this shows up we can reference obfuscated code: " + Blocks.DIRT.getDescriptionId()); |
| displayName="Test" | ||
| description="Test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| displayName="Test" | |
| description="Test" | |
| displayName="FG7 Obfuscation Example" | |
| description="Demonstrates how to build an obfuscated Forge mod jar for versions that don't have runtime MojMap (1.20.4 and older)" |
| id 'net.minecraftforge.renamer' version '1.0.1' | ||
| } | ||
|
|
||
| version = '0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| version = '0' | |
| version = '0.0' |
To match the mods.toml version
|
|
||
| version = '0' | ||
| group = 'com.example' | ||
| base.archivesName = 'test' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| base.archivesName = 'test' | |
| base.archivesName = 'obfuscation' |
| java.toolchain.languageVersion = JavaLanguageVersion.of(21) | ||
|
|
||
| minecraft { | ||
| mappings channel: 'official', version: '1.21.10' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.20.1 please, to avoid noobs being confused thinking that modern versions need reobf
| // 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') |
There was a problem hiding this comment.
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?
| @@ -0,0 +1,9 @@ | |||
| modLoader="javafml" | |||
| loaderVersion="[0,)" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| loaderVersion="[0,)" | |
| loaderVersion="*" |
I don't remember if the Neo mod detection in FML checks for "[2,)" or "[0,)", but a "*" definitely won't trigger a false-positive and goes through a fast-path skipping a maven version range comparison. Not all that relevant to this example but might as well as it's cleaner.
| implementation minecraft.dependency('net.minecraftforge:forge:1.21.10-60.0.17') | ||
| } | ||
|
|
||
| renamer.classes(jar) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| renamer.classes(jar) { | |
| renamer.classes(tasks.named('jar', Jar)) { |
To avoid eager configuration of the Jar task
| implementation minecraft.dependency('net.minecraftforge:forge:1.21.10-60.0.17') | ||
| } | ||
|
|
||
| renamer.classes(jar) { |
There was a problem hiding this comment.
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.
Simple example of using the renamer plugin to build a obfusicated jar.
Addresses #3
Two main concerns I wanted to bounce of @Jonathing
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.