diff options
| author | 2023-11-16 14:48:13 +0100 | |
|---|---|---|
| committer | 2023-11-16 14:48:13 +0100 | |
| commit | b327ba0b31c2229bb49240e456cd7cb604b8e2fa (patch) | |
| tree | c26d70159a7719dba68d3e6ecb05741088d14357 | |
| parent | Don't only write diffs when MIO writer was last used (diff) | |
| download | enigma-fork-b327ba0b31c2229bb49240e456cd7cb604b8e2fa.tar.gz enigma-fork-b327ba0b31c2229bb49240e456cd7cb604b8e2fa.tar.xz enigma-fork-b327ba0b31c2229bb49240e456cd7cb604b8e2fa.zip | |
Keep API compatibility
| -rw-r--r-- | enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java index 2c6c9fd..3a00aec 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | package cuchaz.enigma.command; | 1 | package cuchaz.enigma.command; |
| 2 | 2 | ||
| 3 | import java.io.IOException; | 3 | import java.io.IOException; |
| 4 | import java.io.UncheckedIOException; | ||
| 4 | import java.nio.file.Files; | 5 | import java.nio.file.Files; |
| 5 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 6 | 7 | ||
| @@ -47,7 +48,7 @@ public final class MappingCommandsUtil { | |||
| 47 | throw new IllegalArgumentException("no reader for " + type); | 48 | throw new IllegalArgumentException("no reader for " + type); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | public static void write(EntryTree<EntryMapping> mappings, String type, Path path, MappingSaveParameters saveParameters) throws IOException { | 51 | public static void write(EntryTree<EntryMapping> mappings, String type, Path path, MappingSaveParameters saveParameters) { |
| 51 | if (type.equals("enigma")) { | 52 | if (type.equals("enigma")) { |
| 52 | MappingFormat.ENIGMA_DIRECTORY.write(mappings, path, ProgressListener.none(), saveParameters); | 53 | MappingFormat.ENIGMA_DIRECTORY.write(mappings, path, ProgressListener.none(), saveParameters); |
| 53 | return; | 54 | return; |
| @@ -64,9 +65,14 @@ public final class MappingCommandsUtil { | |||
| 64 | new TinyV2Writer(split[1], split[2]).write(mappings, path, ProgressListener.none(), saveParameters); | 65 | new TinyV2Writer(split[1], split[2]).write(mappings, path, ProgressListener.none(), saveParameters); |
| 65 | return; | 66 | return; |
| 66 | } | 67 | } |
| 68 | |||
| 69 | try { | ||
| 70 | VisitableMappingTree tree = MappingIoConverter.toMappingIo(mappings, ProgressListener.none(), split[1], split[2]); | ||
| 71 | tree.accept(MappingWriter.create(path, net.fabricmc.mappingio.format.MappingFormat.TINY_2_FILE)); | ||
| 72 | } catch (IOException e) { | ||
| 73 | throw new UncheckedIOException(e); | ||
| 74 | } | ||
| 67 | 75 | ||
| 68 | VisitableMappingTree tree = MappingIoConverter.toMappingIo(mappings, ProgressListener.none(), split[1], split[2]); | ||
| 69 | tree.accept(MappingWriter.create(path, net.fabricmc.mappingio.format.MappingFormat.TINY_2_FILE)); | ||
| 70 | return; | 76 | return; |
| 71 | } | 77 | } |
| 72 | 78 | ||
| @@ -82,8 +88,13 @@ public final class MappingCommandsUtil { | |||
| 82 | return; | 88 | return; |
| 83 | } | 89 | } |
| 84 | 90 | ||
| 85 | VisitableMappingTree tree = MappingIoConverter.toMappingIo(mappings, ProgressListener.none(), split[1], split[2]); | 91 | try { |
| 86 | tree.accept(MappingWriter.create(path, net.fabricmc.mappingio.format.MappingFormat.TINY_FILE)); | 92 | VisitableMappingTree tree = MappingIoConverter.toMappingIo(mappings, ProgressListener.none(), split[1], split[2]); |
| 93 | tree.accept(MappingWriter.create(path, net.fabricmc.mappingio.format.MappingFormat.TINY_FILE)); | ||
| 94 | } catch (IOException e) { | ||
| 95 | throw new UncheckedIOException(e); | ||
| 96 | } | ||
| 97 | |||
| 87 | return; | 98 | return; |
| 88 | } | 99 | } |
| 89 | 100 | ||