From eddbd817397899d36a80f1fa328b0e3d40c5cc81 Mon Sep 17 00:00:00 2001 From: LLytho <29131229+LLytho@users.noreply.github.com> Date: Tue, 21 Jun 2022 21:28:21 +0200 Subject: [PATCH] Implement remaining IE handler --- .../unified/handler/RecipeConstants.java | 1 + .../unified/AlmostUnifiedRuntimeForge.java | 2 +- .../unified/compat/ie/IERecipeHandler.java | 17 +++++++++++++---- .../unified/compat/package-info.java | 6 ++++++ 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 Forge/src/main/java/com/almostreliable/unified/compat/package-info.java diff --git a/Common/src/main/java/com/almostreliable/unified/handler/RecipeConstants.java b/Common/src/main/java/com/almostreliable/unified/handler/RecipeConstants.java index 72d387c..ee99eae 100644 --- a/Common/src/main/java/com/almostreliable/unified/handler/RecipeConstants.java +++ b/Common/src/main/java/com/almostreliable/unified/handler/RecipeConstants.java @@ -4,6 +4,7 @@ public class RecipeConstants { public static final String ITEM = "item"; public static final String TAG = "tag"; public static final String INPUT = "input"; + public static final String INPUTS = "inputs"; public static final String INGREDIENT = "ingredient"; public static final String INGREDIENTS = "ingredients"; public static final String OUTPUT = "output"; diff --git a/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedRuntimeForge.java b/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedRuntimeForge.java index 8a87e04..4ede796 100644 --- a/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedRuntimeForge.java +++ b/Forge/src/main/java/com/almostreliable/unified/AlmostUnifiedRuntimeForge.java @@ -11,7 +11,7 @@ public class AlmostUnifiedRuntimeForge extends AlmostUnifiedRuntime { @Override protected void onRun() { - if(AlmostUnifiedPlatform.INSTANCE.isModLoaded(ModConstants.IE)) { + if (AlmostUnifiedPlatform.INSTANCE.isModLoaded(ModConstants.IE)) { IEModPriorityOverride.overrideModPriorities(modPriorities).run(); } } diff --git a/Forge/src/main/java/com/almostreliable/unified/compat/ie/IERecipeHandler.java b/Forge/src/main/java/com/almostreliable/unified/compat/ie/IERecipeHandler.java index 4d512b2..85ee72d 100644 --- a/Forge/src/main/java/com/almostreliable/unified/compat/ie/IERecipeHandler.java +++ b/Forge/src/main/java/com/almostreliable/unified/compat/ie/IERecipeHandler.java @@ -18,10 +18,19 @@ public class IERecipeHandler implements RecipeHandler { @Override public void transformRecipe(JsonObject json, RecipeContext context) { - // alloy recipes - replaceIEIngredient(json.get("input0"), context); - replaceIEIngredient(json.get("input1"), context); - replaceIEResult(json.get("secondaries"), context); + + replaceIEIngredient(json.get("input0"), context); // alloy recipes, refinery + replaceIEIngredient(json.get("input1"), context); // alloy recipes, refinery + replaceIEIngredient(json.get(RecipeConstants.INPUT), + context); // arc furnace, squeezer, cloche, coke oven, fermenter, fertilizer, metal_press + replaceIEIngredient(json.get("additives"), context); // arc furnace + replaceIEIngredient(json.get(RecipeConstants.INPUTS), context); // blueprint, mixer + + replaceIEResult(json.get("secondaries"), context); // alloy recipes, crusher + + JsonUtils.arrayForEach(json.get("secondaries"), JsonObject.class, secondary -> { + replaceIEResult(secondary.get(RecipeConstants.OUTPUT), context); + }); replaceIEResult(json.get(RecipeConstants.RESULT), context); replaceIEResult(json.get(RecipeConstants.RESULTS), context); diff --git a/Forge/src/main/java/com/almostreliable/unified/compat/package-info.java b/Forge/src/main/java/com/almostreliable/unified/compat/package-info.java new file mode 100644 index 0000000..47bdf3c --- /dev/null +++ b/Forge/src/main/java/com/almostreliable/unified/compat/package-info.java @@ -0,0 +1,6 @@ +@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault +package com.almostreliable.unified.compat; + +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault;