mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-01 21:17:46 -05:00
Fix record signatures based on data provided by mappings. (#507)
Reads "extras/record_signatures.json" from mappings jar, just works with yarn.
Mojmap:
```
mappings loom.layered {
officialMojangMappings()
signatureFix("net.fabricmc:yarn:21w38a+build.9:v2")
}
```
This commit is contained in:
@@ -28,6 +28,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -59,10 +60,10 @@ public final class TinyRemapperHelper {
|
||||
}
|
||||
|
||||
public static TinyRemapper getTinyRemapper(Project project, String fromM, String toM) throws IOException {
|
||||
return getTinyRemapper(project, fromM, toM, false);
|
||||
return getTinyRemapper(project, fromM, toM, false, (builder) -> { });
|
||||
}
|
||||
|
||||
public static TinyRemapper getTinyRemapper(Project project, String fromM, String toM, boolean fixRecords) throws IOException {
|
||||
public static TinyRemapper getTinyRemapper(Project project, String fromM, String toM, boolean fixRecords, Consumer<TinyRemapper.Builder> builderConsumer) throws IOException {
|
||||
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||
MemoryMappingTree mappingTree = extension.getMappingsProvider().getMappings();
|
||||
|
||||
@@ -72,7 +73,7 @@ public final class TinyRemapperHelper {
|
||||
|
||||
int intermediaryNsId = mappingTree.getNamespaceId(MappingsNamespace.INTERMEDIARY.toString());
|
||||
|
||||
return TinyRemapper.newRemapper()
|
||||
TinyRemapper.Builder builder = TinyRemapper.newRemapper()
|
||||
.withMappings(create(mappingTree, fromM, toM, true))
|
||||
.withMappings(out -> JSR_TO_JETBRAINS.forEach(out::acceptClass))
|
||||
.renameInvalidLocals(true)
|
||||
@@ -84,8 +85,10 @@ public final class TinyRemapperHelper {
|
||||
}
|
||||
|
||||
return next;
|
||||
})
|
||||
.build();
|
||||
});
|
||||
|
||||
builderConsumer.accept(builder);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static Path[] getMinecraftDependencies(Project project) {
|
||||
|
||||
Reference in New Issue
Block a user