fix Integrated Dynamics result unification

This commit is contained in:
LLytho 2023-12-31 20:23:01 +01:00 committed by rlnt
parent d2adce55b2
commit 798f2f032d
No known key found for this signature in database

View file

@ -4,7 +4,6 @@ import com.almostreliable.unified.api.recipe.RecipeConstants;
import com.almostreliable.unified.api.recipe.RecipeContext; import com.almostreliable.unified.api.recipe.RecipeContext;
import com.almostreliable.unified.api.recipe.RecipeUnifier; import com.almostreliable.unified.api.recipe.RecipeUnifier;
import com.almostreliable.unified.api.recipe.RecipeUnifierBuilder; import com.almostreliable.unified.api.recipe.RecipeUnifierBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive; import com.google.gson.JsonPrimitive;
@ -34,8 +33,12 @@ public class IntegratedDynamicsRecipeUnifier implements RecipeUnifier {
@Nullable @Nullable
private JsonElement createResultReplacement(@Nullable JsonElement json, RecipeContext ctx) { private JsonElement createResultReplacement(@Nullable JsonElement json, RecipeContext ctx) {
if (json instanceof JsonObject jsonObject && jsonObject.get(ITEMS) instanceof JsonArray jsonArray) { if (json instanceof JsonObject jsonObject && jsonObject.has(ITEMS)) {
ctx.createResultReplacement(jsonArray); JsonElement resultReplacement = ctx.createResultReplacement(jsonObject.get(ITEMS));
if (resultReplacement != null) {
jsonObject.add(ITEMS, resultReplacement);
return jsonObject;
}
} }
return null; return null;