Sometimes it's possible to have Mixin configured on a project but have it write an empty xxx-mappings.tsrg file. In this case, the reobfJar task will fail due to an out-of-bounds in srgutils:
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at net.minecraftforge.srgutils.InternalUtils.loadNamed(InternalUtils.java:39)
at net.minecraftforge.srgutils.InternalUtils.load(InternalUtils.java:28)
at net.minecraftforge.srgutils.IMappingFile.load(IMappingFile.java:27)
at net.minecraftforge.srgutils.IMappingFile.load(IMappingFile.java:22)
at net.minecraftforge.gradle.userdev.tasks.RenameJarInPlace.apply(RenameJarInPlace.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Reproduction steps
Download the MDK and convert it to use ForgeGradle 6.
Add the Mixin Gradle plugin, and set up MixinGradle with the following:
Sometimes it's possible to have Mixin configured on a project but have it write an empty
xxx-mappings.tsrg
file. In this case, thereobfJar
task will fail due to an out-of-bounds in srgutils:Reproduction steps
Note no mixin configs are configured.
./gradlew reobfJar
. The build should fail asbuild/tmp/compileJava/compileJava-mappings.tsrg
is empty.