mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Don't read the intermediary file immediately
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -30,6 +30,7 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.loom.configuration.providers.mappings.MappingLayer;
|
||||
import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace;
|
||||
@@ -37,7 +38,7 @@ import net.fabricmc.mappingio.MappingVisitor;
|
||||
import net.fabricmc.mappingio.adapter.MappingNsCompleter;
|
||||
import net.fabricmc.mappingio.format.Tiny2Reader;
|
||||
|
||||
public record IntermediaryMappingLayer(File tinyFile) implements MappingLayer {
|
||||
public record IntermediaryMappingLayer(Supplier<File> tinyFile) implements MappingLayer {
|
||||
@Override
|
||||
public MappingNamespace getSourceNamespace() {
|
||||
return MappingNamespace.OFFICIAL;
|
||||
@@ -48,7 +49,7 @@ public record IntermediaryMappingLayer(File tinyFile) implements MappingLayer {
|
||||
// Populate named with intermediary and add Add a "named" namespace
|
||||
MappingNsCompleter nsCompleter = new MappingNsCompleter(mappingVisitor, Collections.singletonMap(MappingNamespace.NAMED.stringValue(), MappingNamespace.INTERMEDIARY.stringValue()), true);
|
||||
|
||||
try (BufferedReader reader = Files.newBufferedReader(tinyFile().toPath(), StandardCharsets.UTF_8)) {
|
||||
try (BufferedReader reader = Files.newBufferedReader(tinyFile().get().toPath(), StandardCharsets.UTF_8)) {
|
||||
Tiny2Reader.read(reader, nsCompleter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
||||
public record IntermediaryMappingsSpec() implements MappingsSpec<IntermediaryMappingLayer> {
|
||||
@Override
|
||||
public IntermediaryMappingLayer createLayer(MappingContext context) {
|
||||
return new IntermediaryMappingLayer(context.mappingsProvider().intermediaryTinyFile());
|
||||
return new IntermediaryMappingLayer(context.mappingsProvider()::intermediaryTinyFile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user