diff options
author | Linnea Gräf <nea@nea.moe> | 2024-03-05 23:04:55 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-03-05 23:04:55 +0100 |
commit | 73c606bf8ea782ffd2fb35597a5991add8c78af7 (patch) | |
tree | 595b23ea4e587300fdf1da4b6f66790e3adabe41 /src/main/java/moe/nea/zwirn/Zwirn.java | |
parent | 4f704c99ab3f4a294aba9d1f2b0ae7929e2b4a4b (diff) | |
download | zwirn-73c606bf8ea782ffd2fb35597a5991add8c78af7.tar.gz zwirn-73c606bf8ea782ffd2fb35597a5991add8c78af7.tar.bz2 zwirn-73c606bf8ea782ffd2fb35597a5991add8c78af7.zip |
Add searge enricher
Diffstat (limited to 'src/main/java/moe/nea/zwirn/Zwirn.java')
-rw-r--r-- | src/main/java/moe/nea/zwirn/Zwirn.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/zwirn/Zwirn.java b/src/main/java/moe/nea/zwirn/Zwirn.java index 746c993..3612007 100644 --- a/src/main/java/moe/nea/zwirn/Zwirn.java +++ b/src/main/java/moe/nea/zwirn/Zwirn.java @@ -3,6 +3,10 @@ package moe.nea.zwirn; import net.fabricmc.stitch.commands.tinyv2.TinyFile; import org.jetbrains.annotations.NotNull; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; import java.util.List; public class Zwirn { @@ -17,6 +21,21 @@ public class Zwirn { return new TinyMerger(base, overlay, sharedNamespace).merge(); } + public static @NotNull TinyFile enrichSeargeWithMCP(@NotNull TinyFile searge, @NotNull Path mcpArchiveRoot) throws IOException { + if (!searge.getHeader().getNamespaces().equals(Arrays.asList("left", "right"))) + throw new IllegalArgumentException("Searge namespaces need to be left and right"); + var fields = mcpArchiveRoot.resolve("fields.csv"); + var methods = mcpArchiveRoot.resolve("methods.csv"); + var params = mcpArchiveRoot.resolve("params.csv"); + if (!Files.exists(fields)) + throw new IllegalArgumentException("Missing fields.csv"); + if (!Files.exists(methods)) + throw new IllegalArgumentException("Missing methods.csv"); + if (!Files.exists(params)) + throw new IllegalArgumentException("Missing params.csv"); + return new EnrichSeargeWithMCP(searge, fields, methods, params).mergeTinyFile(); + } + public static @NotNull TinyFile createOverlayTinyFile( @NotNull TinyFile base, @NotNull TinyFile overlay, @NotNull List<@NotNull String> retainedNamespaces, |