diff options
Diffstat (limited to 'src/main/java/moe/nea/zwirn/Zwirn.java')
-rw-r--r-- | src/main/java/moe/nea/zwirn/Zwirn.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/zwirn/Zwirn.java b/src/main/java/moe/nea/zwirn/Zwirn.java new file mode 100644 index 0000000..db616d7 --- /dev/null +++ b/src/main/java/moe/nea/zwirn/Zwirn.java @@ -0,0 +1,17 @@ +package moe.nea.zwirn; + +import net.fabricmc.stitch.commands.tinyv2.TinyFile; +import org.jetbrains.annotations.NotNull; + +public class Zwirn { + public static @NotNull TinyFile mergeTinyFile( + @NotNull TinyFile base, @NotNull TinyFile overlay, + @NotNull String sharedNamespace) { + var namespaces = base.getHeader().getNamespaces(); + if (!namespaces.containsAll(overlay.getHeader().getNamespaces())) + throw new IllegalArgumentException("When merging a tiny file, overlay may not introduce a new namespace."); + if (!overlay.getHeader().getNamespaces().contains(sharedNamespace)) + throw new IllegalArgumentException("When merging a tiny file, overlay must contain the shared namespace"); + return new TinyMerger(base, overlay, sharedNamespace).merge(); + } +} |