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;
|
2018-10-31 01:17:58 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2018-10-30 11:08:50 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
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) {
|
2018-10-30 11:08:50 +01:00
|
|
|
ResourceLocation res = new ResourceLocation(provider.get("recipe"));
|
2018-11-11 13:26:19 +01:00
|
|
|
this.recipe = NaturesAuraAPI.ALTAR_RECIPES.get(res);
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String process(String key) {
|
|
|
|
switch (key) {
|
|
|
|
case "input":
|
|
|
|
return PatchouliAPI.instance.serializeItemStack(this.recipe.input);
|
|
|
|
case "output":
|
|
|
|
return PatchouliAPI.instance.serializeItemStack(this.recipe.output);
|
2018-10-31 01:17:58 +01:00
|
|
|
case "catalyst":
|
|
|
|
if (this.recipe.catalyst != null)
|
|
|
|
return PatchouliAPI.instance.serializeItemStack(new ItemStack(this.recipe.catalyst));
|
|
|
|
else
|
|
|
|
return null;
|
2018-10-30 11:08:50 +01:00
|
|
|
case "name":
|
|
|
|
return this.recipe.output.getDisplayName();
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2018-10-31 01:17:58 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean allowRender(String group) {
|
|
|
|
return group.isEmpty() || group.equals(this.recipe.catalyst == null ? "altar" : "catalyst");
|
|
|
|
}
|
2018-10-30 11:08:50 +01:00
|
|
|
}
|