mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-28 02:25:46 -05:00
add Applied Energistics compat
This commit is contained in:
parent
20472767e1
commit
09873d3d9b
4 changed files with 53 additions and 4 deletions
|
@ -8,6 +8,7 @@ public final class ModConstants {
|
||||||
|
|
||||||
// custom unify handlers
|
// custom unify handlers
|
||||||
public static final String AD_ASTRA = "ad_astra";
|
public static final String AD_ASTRA = "ad_astra";
|
||||||
|
public static final String APPLIED_ENERGISTICS = "ae2";
|
||||||
public static final String AMETHYST_IMBUEMENT = "amethyst_imbuement";
|
public static final String AMETHYST_IMBUEMENT = "amethyst_imbuement";
|
||||||
public static final String ARS_CREO = "ars_creo";
|
public static final String ARS_CREO = "ars_creo";
|
||||||
public static final String ARS_ELEMENTAL = "ars_elemental";
|
public static final String ARS_ELEMENTAL = "ars_elemental";
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.almostreliable.unified.compat;
|
||||||
|
|
||||||
|
import com.almostreliable.unified.api.recipe.RecipeConstants;
|
||||||
|
import com.almostreliable.unified.api.recipe.RecipeContext;
|
||||||
|
import com.almostreliable.unified.api.recipe.RecipeUnifier;
|
||||||
|
import com.almostreliable.unified.api.recipe.RecipeUnifierBuilder;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class AppliedEnergisticsUnifier implements RecipeUnifier {
|
||||||
|
|
||||||
|
public static final String DROPS = "drops";
|
||||||
|
public static final String TOP = "top";
|
||||||
|
public static final String MIDDLE = "middle";
|
||||||
|
public static final String BOTTOM = "bottom";
|
||||||
|
public static final String AMMO = "ammo";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collectUnifier(RecipeUnifierBuilder builder) {
|
||||||
|
// entropy
|
||||||
|
builder.put(RecipeConstants.OUTPUT, this::createOutputDropsReplacement);
|
||||||
|
// inscriber
|
||||||
|
builder.put(
|
||||||
|
RecipeConstants.INGREDIENTS,
|
||||||
|
(json, ctx) -> ctx.createIngredientReplacement(json, TOP, MIDDLE, BOTTOM)
|
||||||
|
);
|
||||||
|
// matter cannon
|
||||||
|
builder.put(AMMO, (json, ctx) -> ctx.createIngredientReplacement(json));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private JsonElement createOutputDropsReplacement(JsonElement json, RecipeContext ctx) {
|
||||||
|
if (json instanceof JsonObject jsonObject && jsonObject.has(DROPS)) {
|
||||||
|
JsonElement resultReplacement = ctx.createResultReplacement(
|
||||||
|
jsonObject.get(DROPS),
|
||||||
|
false,
|
||||||
|
RecipeConstants.ITEM
|
||||||
|
);
|
||||||
|
if (resultReplacement != null) {
|
||||||
|
jsonObject.add(DROPS, resultReplacement);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,7 @@
|
||||||
package com.almostreliable.unified;
|
package com.almostreliable.unified;
|
||||||
|
|
||||||
import com.almostreliable.unified.api.ModConstants;
|
import com.almostreliable.unified.api.ModConstants;
|
||||||
import com.almostreliable.unified.compat.AdAstraRecipeUnifier;
|
import com.almostreliable.unified.compat.*;
|
||||||
import com.almostreliable.unified.compat.AmethystImbuementRecipeUnifier;
|
|
||||||
import com.almostreliable.unified.compat.GregTechModernRecipeUnifier;
|
|
||||||
import com.almostreliable.unified.compat.ModernIndustrializationRecipeUnifier;
|
|
||||||
import com.almostreliable.unified.recipe.unifier.RecipeHandlerFactory;
|
import com.almostreliable.unified.recipe.unifier.RecipeHandlerFactory;
|
||||||
import com.almostreliable.unified.utils.UnifyTag;
|
import com.almostreliable.unified.utils.UnifyTag;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
@ -47,6 +44,7 @@ public class AlmostUnifiedPlatformFabric implements AlmostUnifiedPlatform {
|
||||||
@Override
|
@Override
|
||||||
public void bindRecipeHandlers(RecipeHandlerFactory factory) {
|
public void bindRecipeHandlers(RecipeHandlerFactory factory) {
|
||||||
factory.registerForMod(ModConstants.AD_ASTRA, new AdAstraRecipeUnifier());
|
factory.registerForMod(ModConstants.AD_ASTRA, new AdAstraRecipeUnifier());
|
||||||
|
factory.registerForMod(ModConstants.APPLIED_ENERGISTICS, new AppliedEnergisticsUnifier());
|
||||||
factory.registerForMod(ModConstants.AMETHYST_IMBUEMENT, new AmethystImbuementRecipeUnifier());
|
factory.registerForMod(ModConstants.AMETHYST_IMBUEMENT, new AmethystImbuementRecipeUnifier());
|
||||||
factory.registerForMod(ModConstants.GREGTECH_MODERN, new GregTechModernRecipeUnifier());
|
factory.registerForMod(ModConstants.GREGTECH_MODERN, new GregTechModernRecipeUnifier());
|
||||||
factory.registerForMod(ModConstants.MODERN_INDUSTRIALIZATION, new ModernIndustrializationRecipeUnifier());
|
factory.registerForMod(ModConstants.MODERN_INDUSTRIALIZATION, new ModernIndustrializationRecipeUnifier());
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class AlmostUnifiedPlatformForge implements AlmostUnifiedPlatform {
|
||||||
@Override
|
@Override
|
||||||
public void bindRecipeHandlers(RecipeHandlerFactory factory) {
|
public void bindRecipeHandlers(RecipeHandlerFactory factory) {
|
||||||
factory.registerForMod(ModConstants.AD_ASTRA, new AdAstraRecipeUnifier());
|
factory.registerForMod(ModConstants.AD_ASTRA, new AdAstraRecipeUnifier());
|
||||||
|
factory.registerForMod(ModConstants.APPLIED_ENERGISTICS, new AppliedEnergisticsUnifier());
|
||||||
List.of(
|
List.of(
|
||||||
ModConstants.ARS_CREO,
|
ModConstants.ARS_CREO,
|
||||||
ModConstants.ARS_ELEMENTAL,
|
ModConstants.ARS_ELEMENTAL,
|
||||||
|
|
Loading…
Reference in a new issue