2018-10-30 11:08:50 +01:00
|
|
|
package de.ellpeck.naturesaura.compat.patchouli;
|
|
|
|
|
2020-04-29 16:38:50 +02:00
|
|
|
import de.ellpeck.naturesaura.recipes.AltarRecipe;
|
2021-12-16 21:56:27 +01:00
|
|
|
import net.minecraft.world.item.crafting.Ingredient;
|
2018-10-30 11:08:50 +01:00
|
|
|
import vazkii.patchouli.api.IComponentProcessor;
|
2020-09-22 03:17:02 +02:00
|
|
|
import vazkii.patchouli.api.IVariable;
|
2018-10-30 11:08:50 +01:00
|
|
|
import vazkii.patchouli.api.IVariableProvider;
|
|
|
|
|
|
|
|
public class ProcessorAltar implements IComponentProcessor {
|
|
|
|
|
|
|
|
private AltarRecipe recipe;
|
|
|
|
|
|
|
|
@Override
|
2020-09-22 03:17:02 +02:00
|
|
|
public void setup(IVariableProvider provider) {
|
|
|
|
this.recipe = PatchouliCompat.getRecipe("altar", provider.get("recipe").asString());
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-09-22 03:17:02 +02:00
|
|
|
public IVariable process(String key) {
|
2019-03-31 10:21:59 +02:00
|
|
|
if (this.recipe == null)
|
2020-09-22 15:01:16 +02:00
|
|
|
return null;
|
2021-12-16 21:56:27 +01:00
|
|
|
return switch (key) {
|
|
|
|
case "input" -> PatchouliCompat.ingredientVariable(this.recipe.input);
|
|
|
|
case "output" -> IVariable.from(this.recipe.output);
|
|
|
|
case "catalyst" -> this.recipe.catalyst != Ingredient.EMPTY ? PatchouliCompat.ingredientVariable(this.recipe.catalyst) : null;
|
|
|
|
case "type" -> this.recipe.requiredType != null ? IVariable.from(this.recipe.getDimensionBottle()) : null;
|
|
|
|
case "name" -> IVariable.wrap(this.recipe.output.getDisplayName().getString());
|
|
|
|
default -> null;
|
|
|
|
};
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|
2018-10-31 01:17:58 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean allowRender(String group) {
|
2018-11-20 11:44:07 +01:00
|
|
|
return group.isEmpty() || group.equals(this.recipe.catalyst == Ingredient.EMPTY ? "altar" : "catalyst");
|
2018-10-31 01:17:58 +01:00
|
|
|
}
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|