Add support for amethyst imbuement

This commit is contained in:
LLytho 2022-09-28 17:50:15 +02:00
parent 2e50963fe0
commit bed00c9415
3 changed files with 33 additions and 1 deletions

View file

@ -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() {}
}

View file

@ -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());
}
}

View file

@ -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<String> 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));
}
}