Refmapper
Kotlin mixins support
Originally made for LavaHack
Building
To build refmapper you need to have JDK 17 installed
- Download refmapper source code by clicking
Code -> Download ZIP
on the main page - Extract the source code somewhere and open cmd (on Windows) or Terminal
- Execute
gradlew build
(if you're on Windows) orchmod +x ./gradlew && ./gradlew build
(if you're on Linux) and wait until the building process finishes - After that you should have a file called
refmapper-VERSION.jar
inside<refmapper src>/build/libs
folder - Use it anywhere you need
Downloading
You can download stable prebuilt JARs from the releases page
Usage via CLI
To use CLI you need to have tiny
mappings and named
minecraft.jar
Getting tiny
mappings
- Figure out yarn mappings version you need
- Replace
YARN_VERSION
in link from next step to your yarn mappings version - Download archive from
https://maven.fabricmc.net/net/fabricmc/yarn/YARN_VERSION/yarn-YARN_VERSION-tiny.gz
- Extract the archive somewhere
- Generate
tiny
mappings with yarn2tiny
Getting named
minecraft jar
- Setup empty fabric mod project
- Execute
gradlew getSources
(if you're on Windows) orchmod +x ./gradlew && gradlew getSources
(if you're on Linux) and wait until the process finishes - Open each folder in
<project src>/.gradle/loom-cache/minecraftMaven/
until you no longer see more folders - Move
XXX.jar
file(notXXX-sources.jar
) to somewhere
Making mod executable
- Execute
java -jar refmapper-VERSION.jar "raw mod" "refmapped mod" "tiny mappings" "named minecraft jar"
- Move
"refmapped mod"
into.minecraft/mods
folder - Enjoy!
Usage via gradle
To use refmapper you need to have project of fabric mod
- Make sure to check up if you have mixins written in kotlin or refmapper is useless
- Download
refmapper-VERSION.jar
and put it into<project src>
- Create
<project src>/refmapper
folder - Get
tiny
mappings, rename it totiny
and put into<project src>/refmapper
- Put the following code into
<project src>/build.gradle.kts
task<Exec>("refmapper") {
commandLine(
"java",
"-jar",
"refmapper-VERSION.jar",
"build/libs/MOD_NAME-MOD_VERSION.jar",
"build/libs/MOD_NAME-MOD_VERSION-refmap.jar",
"refmapper/tiny",
".gradle/loom-cache/minecraftMaven/net/minecraft/minecraft-merged-project-root/MINECRAFT_VERSION1-net.fabricmc.yarn.MINECRAFT_VERSION2.YARN_MAPPINGS-YARN_VERSION/minecraft-merged-project-root-MINECRAFT_VERSION1-net.fabricmc.yarn.MINECRAFT_VERSION2.YARN_MAPPINGS-YARN_VERSION.jar"
)
}
- Replace
MOD_NAME
to${base.archivesName.get()}
- Replace
MOD_VERSION
to$version
if you're using build.gradle.kts
from kotlin mod template
- Replace
MINECRAFT_VERSION1
to${project.extra["minecraft_version"] as String}
- Replace
MINECRAFT_VERSION2
to${(project.extra["minecraft_version"] as String).replace('.', '_')}
- Replace
YARN_MAPPINGS
to${project.extra["yarn_mappings"] as String}
- Replace
YARN_VERSION
tov2
if you're using custom build.gradle.kts
- Replace
MINECRAFT_VERSION1
to minecraft version inX.XX.X
format - Replace
MINECRAFT_VERSION2
to minecraft version inX_XX_X
format - Replace
YARN_MAPPINGS
to yarn mappings for your minecraft version - Replace
YARN_VERSION
to yarn mappings version format(v2
by default)
After each gradlew build
execute gradlew refmapper
Built mod file is MOD_NAME-MOD_VERSION-refmap.jar
We are
Handling Inject
/Redirect
/ModifyArgs
/Accessor
/Invoker
hooks
Handling HEAD
/TAIL
/RETURN
/INVOKE
/FIELD
/JUMP
injection points
Remapping mixins with ClassTypeSignature
as target
Remapping shadow fields/methods
Remapping accesswinder instead of fabric loom(WIP
)
Known issues
Redirect
/ModifyArgs
hook may not work for methods whose descriptor is different from ()V
Remapped shadow field/method counters do not work correctly
Mixins with override methods are not currently supported(WIP
)