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

31 lines
1.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;
2023-07-08 12:32:27 +02:00
import net.minecraft.world.level.Level;
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
2023-07-08 12:32:27 +02:00
public void setup(Level level, IVariableProvider provider) {
2020-09-22 03:17:02 +02:00
this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe").asString());
2018-11-21 11:49:21 +01:00
}
@Override
2023-07-08 12:32:27 +02:00
public IVariable process(Level level, 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);
2021-12-28 11:53:10 +01:00
case "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString());
2021-12-16 21:56:27 +01:00
default -> null;
};
2018-11-21 11:49:21 +01:00
}
}