/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.integration.jei.runicaltar;
import java.util.List;
import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.tile.mana.TilePool;
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
private final List<List<ItemStack>> input;
private final ItemStack output;
private final int manaUsage;
@SuppressWarnings("unchecked")
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
}
}
input = builder.build();
output = recipe.getOutput();
manaUsage = recipe.getManaUsage();
}
@Override
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutput(ItemStack.class, output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}