Skip to content

Commit 94fd83d

Browse files
committed
Only respect use_mappingio=false when Enigma has an alternative reader/writer
1 parent 4f39292 commit 94fd83d

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

enigma/src/main/java/cuchaz/enigma/translation/mapping/serde/MappingFormat.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ public void write(EntryTree<EntryMapping> mappings, Path path, ProgressListener
6969
}
7070

7171
public void write(EntryTree<EntryMapping> mappings, MappingDelta<EntryMapping> delta, Path path, ProgressListener progressListener, MappingSaveParameters saveParameters) {
72-
if (!hasMappingIoWriter || !useMappingIo()) {
73-
if (writer == null) {
74-
throw new IllegalStateException(name() + " does not support writing");
75-
}
76-
72+
if (!hasMappingIoWriter || (!useMappingIo() && writer != null)) {
7773
writer.write(mappings, usedMappingIoWriterLast ? MappingDelta.added(mappings) : delta, path, progressListener, saveParameters);
7874
usedMappingIoWriterLast = false;
7975
return;
@@ -107,11 +103,7 @@ public EntryTree<EntryMapping> read(Path path, ProgressListener progressListener
107103
}
108104

109105
public EntryTree<EntryMapping> read(Path path, ProgressListener progressListener, MappingSaveParameters saveParameters, JarIndex index) throws IOException, MappingParseException {
110-
if (!useMappingIo()) {
111-
if (reader == null) {
112-
throw new IllegalStateException(name() + " does not support reading");
113-
}
114-
106+
if (mappingIoCounterpart == null || (!useMappingIo() && reader != null)) {
115107
return reader.read(path, progressListener, saveParameters);
116108
}
117109

@@ -180,9 +172,7 @@ public boolean isWritable() {
180172
return writer != null || hasMappingIoWriter;
181173
}
182174

183-
@ApiStatus.Internal
184175
private boolean useMappingIo() {
185-
if (mappingIoCounterpart == null) return false;
186176
return System.getProperty("enigma.use_mappingio", "true").equals("true");
187177
}
188178

0 commit comments

Comments
 (0)