From 01c3d909eca52fa80ae84aa2985d8e0d0aecdc61 Mon Sep 17 00:00:00 2001 From: rlnt Date: Sun, 17 Mar 2024 12:04:59 +0100 Subject: [PATCH] add Blood Magic compat --- CHANGELOG.md | 3 ++ .../unified/api/ModConstants.java | 1 + .../unified/AlmostUnifiedPlatformForge.java | 1 + .../compat/BloodMagicRecipeUnifier.java | 39 +++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 Forge/src/main/java/com/almostreliable/unified/compat/BloodMagicRecipeUnifier.java diff --git a/CHANGELOG.md b/CHANGELOG.md index b37cf2e7..e9c0dd36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning]. ## Unreleased +### Added +- added support for Blood Magic + ### Fixed - fixed `show_notification` recipe key not being ignored by default 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 5ecae36d..c3c70f32 100644 --- a/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java +++ b/Common/src/main/java/com/almostreliable/unified/api/ModConstants.java @@ -14,6 +14,7 @@ public final class ModConstants { public static final String ARS_ELEMENTAL = "ars_elemental"; public static final String ARS_NOUVEAU = "ars_nouveau"; public static final String ARS_SCALAES = "ars_scalaes"; + public static final String BLOOD_MAGIC = "bloodmagic"; public static final String CYCLIC = "cyclic"; public static final String ENDER_IO = "enderio"; public static final String GREGTECH_MODERN = "gtceu"; diff --git a/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformForge.java b/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformForge.java index 39b9c0dc..53b0fcec 100644 --- a/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformForge.java +++ b/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedPlatformForge.java @@ -60,6 +60,7 @@ public void bindRecipeHandlers(RecipeHandlerFactory factory) { ModConstants.ARS_NOUVEAU, ModConstants.ARS_SCALAES ).forEach(modId -> factory.registerForMod(modId, new ArsNouveauRecipeUnifier())); + factory.registerForMod(ModConstants.BLOOD_MAGIC, new BloodMagicRecipeUnifier()); factory.registerForMod(ModConstants.CYCLIC, new CyclicRecipeUnifier()); factory.registerForMod(ModConstants.ENDER_IO, new EnderIORecipeUnifier()); factory.registerForMod(ModConstants.GREGTECH_MODERN, new GregTechModernRecipeUnifier()); diff --git a/Forge/src/main/java/com/almostreliable/unified/compat/BloodMagicRecipeUnifier.java b/Forge/src/main/java/com/almostreliable/unified/compat/BloodMagicRecipeUnifier.java new file mode 100644 index 00000000..c7c27c87 --- /dev/null +++ b/Forge/src/main/java/com/almostreliable/unified/compat/BloodMagicRecipeUnifier.java @@ -0,0 +1,39 @@ +package com.almostreliable.unified.compat; + +import com.almostreliable.unified.api.recipe.RecipeConstants; +import com.almostreliable.unified.api.recipe.RecipeUnifier; +import com.almostreliable.unified.api.recipe.RecipeUnifierBuilder; + +import java.util.List; + +public class BloodMagicRecipeUnifier implements RecipeUnifier { + + public static final String ADDED_INPUT = "addedinput"; + public static final String ADDED_OUTPUT = "addedoutput"; + public static final String BASE_INPUT = "baseinput"; + public static final String INPUT0 = "input0"; + public static final String INPUT1 = "input1"; + public static final String INPUT2 = "input2"; + public static final String INPUT3 = "input3"; + public static final String TOOL = "tool"; + public static final String TYPE = "type"; + + @Override + public void collectUnifier(RecipeUnifierBuilder builder) { + List.of( + // arc + TOOL, + // array + ADDED_INPUT, + BASE_INPUT, + // soulforge + INPUT0, + INPUT1, + INPUT2, + INPUT3 + ).forEach(key -> builder.put(key, (json, ctx) -> ctx.createIngredientReplacement(json))); + + // arc + builder.put(ADDED_OUTPUT, (json, ctx) -> ctx.createResultReplacement(json, false, TYPE, RecipeConstants.ITEM)); + } +}