Yarn: Automated way to generate named jars

Created on 2 Apr 2021  ·  5Comments  ·  Source: FabricMC/yarn

Hi there,
I wrote a tool called PixLyzer. It uses the yarn mappings for < 1.14.4 and mojang mappings for 1.14.4+. I like yarn mappings way more, than the original ones.

My problem is, that I need to integrate the named jar integration in my script. I have no time to manually generate yarn jars for newer versions and for all versions between 21w13a and 1.14.4. My last attempt for generating the older mappings was to checkout 1.14.4? and change the minecraft version here: https://github.com/FabricMC/yarn/blob/21w13a/build.gradle#L29. Older versions are gradle incompatible and/or don't have mapNamedJar

How to automatically generate mappings for older versions automatically? (By that I mean something like gradle mapNamedJar 1.15.2.

Thanks

discussion toolchain

Most helpful comment

Hi,

You can use tiny remapper to remap jars with given mappings.

You can find a download here: https://maven.fabricmc.net/net/fabricmc/tiny-remapper/0.3.2/ (use the fat jar if you want to use it via the cli)
You can find yarn in the tiny format here: https://maven.fabricmc.net/net/fabricmc/yarn/ (the none v2 jar or gz files will be best for older game versions)

Tiny reampper also has an API if you wish to call it directally in your code (just pull it in via maven). You can use the mapNamedJar as an example of this: https://github.com/FabricMC/yarn/blob/21w13a/build.gradle#L1050

Should just be a matter of getting your tool to download minecraft and the version of yarn you want to use and then invoke tiny remapper.

All 5 comments

Hi,

You can use tiny remapper to remap jars with given mappings.

You can find a download here: https://maven.fabricmc.net/net/fabricmc/tiny-remapper/0.3.2/ (use the fat jar if you want to use it via the cli)
You can find yarn in the tiny format here: https://maven.fabricmc.net/net/fabricmc/yarn/ (the none v2 jar or gz files will be best for older game versions)

Tiny reampper also has an API if you wish to call it directally in your code (just pull it in via maven). You can use the mapNamedJar as an example of this: https://github.com/FabricMC/yarn/blob/21w13a/build.gradle#L1050

Should just be a matter of getting your tool to download minecraft and the version of yarn you want to use and then invoke tiny remapper.

@modmuss50 Thanks for the (super quick) answer, I will definitely try it out. Sadly, I had not time the last days to answer.

Hi there,
got another question.

(Assume you use version 21w13a and want to map from official to named):

I can use tiny remapper to map from offical to intermediary. All fine with this one. Now I want to map from intermediary to named. When I checkout 21w13a and run gradle mapNamedJar I see in the temp folder a file called merge-v2.tiny. When I use this file and run the remapper everything is fine and I get the jar that I am used to. When I use the yarn mappings from maven (no matter what, the merged ones, the v2, ...) I can map most of the classes to the named names, but some (e.g. net/minecraft/class_6171) are just not getting renamed. I checked the mappings and when grepping after this class I get the following outtput:

moritz@moritz-tp:~/yarn$ grep -r "net/minecraft/class_6171"
mappings/net/minecraft/unused/packageinfo/PackageInfo6171.mapping:CLASS net/minecraft/class_6171 net/minecraft/unused/packageinfo/PackageInfo6171 
.gradle/temp/yarn-mappings-v2.tiny:c    net/minecraft/class_6171        net/minecraft/unused/packageinfo/PackageInfo6171
.gradle/temp/yarn-mappings.tiny:CLASS   net/minecraft/class_6171        net/minecraft/unused/packageinfo/PackageInfo6171
.gradle/temp/unmerged-named-v2-with-enum.tiny:c net/minecraft/class_6171        net/minecraft/unused/packageinfo/PackageInfo6171
.gradle/temp/merged-reordered-v2.tiny:c dlr     net/minecraft/class_6171        net/minecraft/unused/packageinfo/PackageInfo6171
.gradle/temp/merged-v2.tiny:c   net/minecraft/class_6171        dlr     net/minecraft/unused/packageinfo/PackageInfo6171
.gradle/minecraft/21w13a-intermediary-inverted-v2.tiny:c        net/minecraft/class_6171        dlr
.gradle/minecraft/21w13a-intermediary.tiny:CLASS        dlr     net/minecraft/class_6171
.gradle/minecraft/21w13a-intermediary-v2.tiny:c dlr     net/minecraft/class_6171


moritz@moritz-tp:~/test$ grep -r "net/minecraft/class_6171"
Übereinstimmungen in Binärdatei intermediary.jar
Übereinstimmungen in Binärdatei yarn.jar
intermediary.tiny:c     dlr     net/minecraft/class_6171

So no named mapping is available. Are the mappings in maven different or am I doing something wrong?

Ty

(Okay small edit: I used old tiny mappings, but still: check class net/minecraft/class_5348$1)

v2 does not contain the intermediary names, you need to download those seprately from maven and either combine the mappings or go from official -> intermediary -> named.

I can map from official to intermediary without a problem. I use v2 or v1 from maven (https://maven.fabricmc.net/net/fabricmc/yarn/) but nowhere is a named name from this class. That's the problem and not that it won't map at all (almost all ones are mapped)

Was this page helpful?
0 / 5 - 0 ratings