2018-10-30 11:08:50 +01:00
|
|
|
package de.ellpeck.naturesaura.compat.patchouli;
|
|
|
|
|
2018-11-11 13:26:19 +01:00
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|
|
|
import de.ellpeck.naturesaura.api.recipes.AltarRecipe;
|
2020-02-25 22:57:10 +01:00
|
|
|
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
|
|
|
import de.ellpeck.naturesaura.items.ModItems;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2018-11-20 11:44:07 +01:00
|
|
|
import net.minecraft.item.crafting.Ingredient;
|
2018-10-30 11:08:50 +01:00
|
|
|
import vazkii.patchouli.api.IComponentProcessor;
|
|
|
|
import vazkii.patchouli.api.IVariableProvider;
|
|
|
|
import vazkii.patchouli.api.PatchouliAPI;
|
|
|
|
|
|
|
|
public class ProcessorAltar implements IComponentProcessor {
|
|
|
|
|
|
|
|
private AltarRecipe recipe;
|
|
|
|
|
|
|
|
@Override
|
2018-11-10 23:25:53 +01:00
|
|
|
public void setup(IVariableProvider<String> provider) {
|
2019-03-31 10:21:59 +02:00
|
|
|
this.recipe = PatchouliCompat.getRecipe(NaturesAuraAPI.ALTAR_RECIPES, provider.get("recipe"));
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String process(String key) {
|
2019-03-31 10:21:59 +02:00
|
|
|
if (this.recipe == null)
|
|
|
|
return null;
|
2018-10-30 11:08:50 +01:00
|
|
|
switch (key) {
|
|
|
|
case "input":
|
2018-11-20 11:44:07 +01:00
|
|
|
return PatchouliAPI.instance.serializeIngredient(this.recipe.input);
|
2018-10-30 11:08:50 +01:00
|
|
|
case "output":
|
|
|
|
return PatchouliAPI.instance.serializeItemStack(this.recipe.output);
|
2018-10-31 01:17:58 +01:00
|
|
|
case "catalyst":
|
2018-11-20 11:44:07 +01:00
|
|
|
if (this.recipe.catalyst != Ingredient.EMPTY)
|
|
|
|
return PatchouliAPI.instance.serializeIngredient(this.recipe.catalyst);
|
2018-10-31 01:17:58 +01:00
|
|
|
else
|
|
|
|
return null;
|
2020-02-25 22:57:10 +01:00
|
|
|
case "type":
|
|
|
|
if (this.recipe.requiredType != null)
|
|
|
|
return PatchouliAPI.instance.serializeItemStack(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), this.recipe.requiredType));
|
|
|
|
else
|
|
|
|
return null;
|
2018-10-30 11:08:50 +01:00
|
|
|
case "name":
|
2020-01-21 21:04:44 +01:00
|
|
|
return this.recipe.output.getDisplayName().getFormattedText();
|
2018-10-30 11:08:50 +01:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|