From bed00c94152f8c3e23aea1ffa6ee94e1b808480c Mon Sep 17 00:00:00 2001 From: LLytho Date: Wed, 28 Sep 2022 17:50:15 +0200 Subject: [PATCH] Add support for amethyst imbuement --- .../unified/api/ModConstants.java | 1 + .../unified/AlmostUnifiedPlatformFabric.java | 4 ++- .../AmethystImbuementRecipeUnifier.java | 29 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Fabric/src/main/java/com/almostreliable/unified/compat/AmethystImbuementRecipeUnifier.java diff --git a/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java b/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java index 2189948..f66cc98 100644 --- a/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java +++ b/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java @@ -3,6 +3,7 @@ package com.almostreliable.unified.api; @SuppressWarnings("SpellCheckingInspection") public final class ModConstants { public static final String IE = "immersiveengineering"; + public static final String AMETHYST_IMBUEMENT = "amethyst_imbuement"; private ModConstants() {} } diff --git a/Fabric/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformFabric.java b/Fabric/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformFabric.java index de4498a..275be99 100644 --- a/Fabric/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformFabric.java +++ b/Fabric/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformFabric.java @@ -1,5 +1,7 @@ package com.almostreliable.unified; +import com.almostreliable.unified.api.ModConstants; +import com.almostreliable.unified.compat.AmethystImbuementRecipeUnifier; import com.almostreliable.unified.recipe.unifier.RecipeHandlerFactory; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; @@ -40,6 +42,6 @@ public class AlmostUnifiedPlatformFabric implements AlmostUnifiedPlatform { @Override public void bindRecipeHandlers(RecipeHandlerFactory factory) { - + factory.registerForMod(ModConstants.AMETHYST_IMBUEMENT, new AmethystImbuementRecipeUnifier()); } } diff --git a/Fabric/src/main/java/com/almostreliable/unified/compat/AmethystImbuementRecipeUnifier.java b/Fabric/src/main/java/com/almostreliable/unified/compat/AmethystImbuementRecipeUnifier.java new file mode 100644 index 0000000..e825eaf --- /dev/null +++ b/Fabric/src/main/java/com/almostreliable/unified/compat/AmethystImbuementRecipeUnifier.java @@ -0,0 +1,29 @@ +package com.almostreliable.unified.compat; + +import com.almostreliable.unified.api.recipe.RecipeUnifier; +import com.almostreliable.unified.api.recipe.RecipeUnifierBuilder; + +import java.util.List; + +@SuppressWarnings("SpellCheckingInspection") +public class AmethystImbuementRecipeUnifier implements RecipeUnifier { + @Override + public void collectUnifier(RecipeUnifierBuilder builder) { + final List fields = List.of("imbueA", + "imbueB", + "imbueC", + "imbueD", + "craftA", + "craftB", + "craftC", + "craftD", + "craftE", + "craftF", + "craftG", + "craftH", + "craftI"); + + fields.forEach(field -> builder.put(field, (json, ctx) -> ctx.createIngredientReplacement(json))); + builder.put("resultA", (json, ctx) -> ctx.createResultReplacement(json)); + } +}