Moved blast furnace recipes over to new crafter still needs to get heat

This commit is contained in:
Gig 2015-06-25 20:17:14 +01:00
parent 37467cab7e
commit ddb4b5cb20
8 changed files with 198 additions and 346 deletions

View file

@ -1,158 +0,0 @@
package techreborn.compat.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import techreborn.api.BlastFurnaceRecipe;
import techreborn.api.TechRebornAPI;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.config.ConfigTechReborn;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mark on 29/04/15.
*/
public class BlastFurnaceRecipeHandler extends TemplateRecipeHandler {
public class CachedBlastFurnaceRecipe extends CachedRecipe {
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public BlastFurnaceRecipe centrifugeRecipie;
public CachedBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
this.centrifugeRecipie = recipie;
int offset = 4;
PositionedStack pStack = new PositionedStack(
recipie.getInput1(), 56 - offset, 25 - offset);
pStack.setMaxSize(1);
this.input.add(pStack);
PositionedStack pStack2 = new PositionedStack(
recipie.getInput2(), 56 - offset, 43 - offset);
pStack.setMaxSize(1);
this.input.add(pStack2);
if (recipie.getOutput1() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput1(),
116 - offset, 35 - offset));
}
if (recipie.getOutput2() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput2(),
116 - offset, 53 - offset));
}
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getOtherStacks() {
return this.outputs;
}
@Override
public PositionedStack getResult() {
return null;
}
}
@Override
public String getRecipeName() {
return "Blast Furnace";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_blast_furnace.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiBlastFurnace.class;
}
@Override
public void drawBackground(int recipeIndex) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
GuiDraw.drawTooltipBox(10, 80, 145, 50);
GuiDraw.drawString("Info:", 14, 84, -1);
CachedRecipe recipe = arecipes.get(recipeIndex);
if (recipe instanceof CachedBlastFurnaceRecipe) {
CachedBlastFurnaceRecipe centrifugeRecipie = (CachedBlastFurnaceRecipe) recipe;
GuiDraw.drawString(
"EU needed: "
+ (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie
.getTickTime()), 14, 94, -1);
GuiDraw.drawString("Ticks to smelt: "
+ centrifugeRecipie.centrifugeRecipie.getTickTime(), 14,
104, -1);
GuiDraw.drawString("Time to smelt: "
+ centrifugeRecipie.centrifugeRecipie.getTickTime() / 20
+ " seconds", 14, 114, -1);
}
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), "tr.blast", new Object[0]));
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("tr.blast")) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
addCached(centrifugeRecipie);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput1(), result)) {
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput2(), result)) {
addCached(centrifugeRecipie);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput1(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput2(), ingredient)) {
addCached(centrifugeRecipie);
}
}
}
private void addCached(BlastFurnaceRecipe recipie) {
this.arecipes.add(new CachedBlastFurnaceRecipe(recipie));
}
}

View file

@ -4,6 +4,7 @@ import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import techreborn.compat.nei.recipes.AlloySmelterRecipeHandler;
import techreborn.compat.nei.recipes.AssemblingMachineRecipeHandler;
import techreborn.compat.nei.recipes.BlastFurnaceRecipeHandler;
import techreborn.compat.nei.recipes.CentrifugeRecipeHandler;
import techreborn.compat.nei.recipes.ChemicalReactorRecipeHandler;
import techreborn.compat.nei.recipes.GrinderRecipeHandler;
@ -26,14 +27,11 @@ public class NEIConfig implements IConfigureNEI {
return ModInfo.MOD_VERSION;
}
public static BlastFurnaceRecipeHandler blastFurnaceRecipeHandle;
@Override
public void loadConfig() {
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
ImplosionCompressorRecipeHandler implosion = new ImplosionCompressorRecipeHandler();
API.registerUsageHandler(implosion);
@ -75,13 +73,15 @@ public class NEIConfig implements IConfigureNEI {
API.registerUsageHandler(elec);
API.registerRecipeHandler(elec);
BlastFurnaceRecipeHandler blast = new BlastFurnaceRecipeHandler();
API.registerUsageHandler(blast);
API.registerRecipeHandler(blast);
API.registerUsageHandler(shapedRollingMachineHandler);
API.registerRecipeHandler(shapedRollingMachineHandler);
API.registerUsageHandler(shapelessRollingMachineHandler);
API.registerRecipeHandler(shapelessRollingMachineHandler);
API.registerUsageHandler(NEIConfig.blastFurnaceRecipeHandle);
API.registerRecipeHandler(NEIConfig.blastFurnaceRecipeHandle);
}
}

View file

@ -0,0 +1,56 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.util.ItemUtils;
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) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 40 - offset, 25 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 40 - offset, 43 - offset);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 100 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 1) {
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 118 - offset, 35 - offset);
outputs.add(pStack4);
}
}
@Override
public String getRecipeName() {
return "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;
}
}