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.TreeRitualRecipe;
|
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 ProcessorTreeRitual implements IComponentProcessor {
|
|
|
|
|
|
|
|
private TreeRitualRecipe recipe;
|
|
|
|
|
|
|
|
@Override
|
2020-09-22 03:17:02 +02:00
|
|
|
public void setup(IVariableProvider provider) {
|
|
|
|
this.recipe = PatchouliCompat.getRecipe("tree_ritual", 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;
|
2018-10-30 11:08:50 +01:00
|
|
|
if (key.startsWith("input")) {
|
|
|
|
int id = Integer.parseInt(key.substring(5)) - 1;
|
2018-11-20 11:44:07 +01:00
|
|
|
if (this.recipe.ingredients.length > id)
|
2020-09-22 18:03:56 +02:00
|
|
|
return PatchouliCompat.ingredientVariable(this.recipe.ingredients[id]);
|
2018-10-30 11:08:50 +01:00
|
|
|
else
|
2020-09-22 15:01:16 +02:00
|
|
|
return null;
|
2018-10-30 11:08:50 +01:00
|
|
|
} else {
|
|
|
|
switch (key) {
|
|
|
|
case "output":
|
2020-09-22 03:17:02 +02:00
|
|
|
return IVariable.from(this.recipe.result);
|
2018-10-30 11:08:50 +01:00
|
|
|
case "sapling":
|
2020-09-22 18:03:56 +02:00
|
|
|
return PatchouliCompat.ingredientVariable(this.recipe.saplingType);
|
2018-10-30 11:08:50 +01:00
|
|
|
case "name":
|
2020-09-22 03:17:02 +02:00
|
|
|
return IVariable.wrap(this.recipe.result.getDisplayName().getString());
|
2018-10-30 11:08:50 +01:00
|
|
|
default:
|
2020-09-22 15:01:16 +02:00
|
|
|
return null;
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|