From 94fd83d4e7c651fe5ff5372f25f3bee0ec6f89ad Mon Sep 17 00:00:00 2001 From: NebelNidas Date: Sun, 25 Aug 2024 15:19:42 +0200 Subject: [PATCH] Only respect `use_mappingio=false` when Enigma has an alternative reader/writer --- .../translation/mapping/serde/MappingFormat.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingFormat.java b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingFormat.java index d6071b79..bb70c04e 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingFormat.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingFormat.java @@ -69,11 +69,7 @@ public void write(EntryTree mappings, Path path, ProgressListener } public void write(EntryTree mappings, MappingDelta delta, Path path, ProgressListener progressListener, MappingSaveParameters saveParameters) { - if (!hasMappingIoWriter || !useMappingIo()) { - if (writer == null) { - throw new IllegalStateException(name() + " does not support writing"); - } - + if (!hasMappingIoWriter || (!useMappingIo() && writer != null)) { writer.write(mappings, usedMappingIoWriterLast ? MappingDelta.added(mappings) : delta, path, progressListener, saveParameters); usedMappingIoWriterLast = false; return; @@ -107,11 +103,7 @@ public EntryTree read(Path path, ProgressListener progressListener } public EntryTree read(Path path, ProgressListener progressListener, MappingSaveParameters saveParameters, JarIndex index) throws IOException, MappingParseException { - if (!useMappingIo()) { - if (reader == null) { - throw new IllegalStateException(name() + " does not support reading"); - } - + if (mappingIoCounterpart == null || (!useMappingIo() && reader != null)) { return reader.read(path, progressListener, saveParameters); } @@ -180,9 +172,7 @@ public boolean isWritable() { return writer != null || hasMappingIoWriter; } - @ApiStatus.Internal private boolean useMappingIo() { - if (mappingIoCounterpart == null) return false; return System.getProperty("enigma.use_mappingio", "true").equals("true"); }