aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/zwirn/Zwirn.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-05 23:04:55 +0100
committerLinnea Gräf <nea@nea.moe>2024-03-05 23:04:55 +0100
commit73c606bf8ea782ffd2fb35597a5991add8c78af7 (patch)
tree595b23ea4e587300fdf1da4b6f66790e3adabe41 /src/main/java/moe/nea/zwirn/Zwirn.java
parent4f704c99ab3f4a294aba9d1f2b0ae7929e2b4a4b (diff)
downloadzwirn-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.java19
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,