NaturesAura/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorOffering.java

30 lines
1 KiB
Java
Raw Normal View History

2018-11-21 11:49:21 +01:00
package de.ellpeck.naturesaura.compat.patchouli;
2020-04-29 16:38:50 +02:00
import de.ellpeck.naturesaura.recipes.OfferingRecipe;
2018-11-21 11:49:21 +01:00
import vazkii.patchouli.api.IComponentProcessor;
2020-09-22 03:17:02 +02:00
import vazkii.patchouli.api.IVariable;
2018-11-21 11:49:21 +01:00
import vazkii.patchouli.api.IVariableProvider;
public class ProcessorOffering implements IComponentProcessor {
private OfferingRecipe recipe;
@Override
2020-09-22 03:17:02 +02:00
public void setup(IVariableProvider provider) {
this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe").asString());
2018-11-21 11:49:21 +01:00
}
@Override
2020-09-22 03:17:02 +02:00
public IVariable process(String key) {
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 "start" -> PatchouliCompat.ingredientVariable(this.recipe.startItem);
case "name" -> IVariable.wrap(this.recipe.output.getDisplayName().getString());
default -> null;
};
2018-11-21 11:49:21 +01:00
}
}