TechReborn/ToAddBack/compat/nei/recipes/BlastFurnaceRecipeHandler.java

80 lines
2.8 KiB
Java
Raw Normal View History

package techreborn.compat.nei.recipes;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
2015-11-08 13:15:45 +01:00
import reborncore.common.util.ItemUtils;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
import techreborn.client.gui.GuiBlastFurnace;
2015-07-24 23:29:00 +02:00
import techreborn.lib.Reference;
2015-07-02 20:51:24 +02:00
import java.awt.*;
import java.util.List;
public class BlastFurnaceRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
2015-09-11 14:34:20 +02:00
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 40 - offset, 25 - offset, false);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
2015-09-11 14:34:20 +02:00
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 40 - offset, 43 - offset, false);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
2015-09-11 14:34:20 +02:00
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 100 - offset, 35 - offset, false);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 1) {
2015-09-11 14:34:20 +02:00
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 118 - offset, 35 - offset, false);
outputs.add(pStack4);
}
}
@Override
public String getRecipeName() {
return Reference.blastFurnaceRecipe;
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_blast_furnace.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiBlastFurnace.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(55, 20, 25, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
}
@Override
public void drawBackground(int recipeIndex) {
super.drawBackground(recipeIndex);
CachedRecipe recipe = arecipes.get(recipeIndex);
if (recipe instanceof CachedGenericRecipe) {
if (((CachedGenericRecipe) recipe).recipie instanceof BlastFurnaceRecipe) {
BlastFurnaceRecipe blastFurnaceRecipeHandler = (BlastFurnaceRecipe) ((CachedGenericRecipe) recipe).recipie;
GuiDraw.drawString("Requires " + blastFurnaceRecipeHandler.neededHeat + " heat", 14, 135, -1);
}
}
}
}