mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-05-18 06:28:43 +02:00
35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
package de.ellpeck.naturesaura.compat.patchouli;
|
|
|
|
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
|
|
import net.minecraft.world.level.Level;
|
|
import vazkii.patchouli.api.IComponentProcessor;
|
|
import vazkii.patchouli.api.IVariable;
|
|
import vazkii.patchouli.api.IVariableProvider;
|
|
|
|
public class ProcessorTreeRitual implements IComponentProcessor {
|
|
|
|
private TreeRitualRecipe recipe;
|
|
|
|
@Override
|
|
public void setup(Level level, IVariableProvider provider) {
|
|
this.recipe = PatchouliCompat.getRecipe("tree_ritual", provider.get("recipe").asString());
|
|
}
|
|
|
|
@Override
|
|
public IVariable process(Level level, String key) {
|
|
if (this.recipe == null)
|
|
return null;
|
|
if (key.startsWith("input")) {
|
|
var id = Integer.parseInt(key.substring(5)) - 1;
|
|
return this.recipe.ingredients.size() > id ? PatchouliCompat.ingredientVariable(this.recipe.ingredients.get(id)) : null;
|
|
} else {
|
|
return switch (key) {
|
|
case "output" -> IVariable.from(this.recipe.output);
|
|
case "sapling" -> PatchouliCompat.ingredientVariable(this.recipe.saplingType);
|
|
case "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString());
|
|
default -> null;
|
|
};
|
|
}
|
|
}
|
|
}
|