Moved blast furnace recipes over to new crafter still needs to get heat
This commit is contained in:
parent
37467cab7e
commit
ddb4b5cb20
8 changed files with 198 additions and 346 deletions
|
@ -1,58 +0,0 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlastFurnaceRecipe {
|
||||
ItemStack input1, input2;
|
||||
ItemStack output1, output2;
|
||||
int tickTime;
|
||||
int minHeat;
|
||||
|
||||
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,int tickTime, int minHeat) {
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.output1 = output1;
|
||||
this.output2 = output2;
|
||||
this.tickTime = tickTime;
|
||||
this.minHeat = minHeat;
|
||||
}
|
||||
|
||||
public BlastFurnaceRecipe(Item input1, Item input2, int inputAmount, Item output1, net.minecraft.item.Item output2, int tickTime, int minHeat) {
|
||||
if(input1 != null)
|
||||
this.input1 = new ItemStack(input1, inputAmount);
|
||||
if(input2 != null)
|
||||
this.input2 = new ItemStack(input1, inputAmount);
|
||||
if (output1 != null)
|
||||
this.output1 = new ItemStack(output1);
|
||||
if (output2 != null)
|
||||
this.output2 = new ItemStack(output2);
|
||||
this.tickTime = tickTime;
|
||||
this.minHeat = minHeat;
|
||||
}
|
||||
|
||||
public ItemStack getInput1() {
|
||||
return input1;
|
||||
}
|
||||
|
||||
public ItemStack getInput2() {
|
||||
return input2;
|
||||
}
|
||||
|
||||
public ItemStack getOutput1() {
|
||||
return output1;
|
||||
}
|
||||
|
||||
public ItemStack getOutput2() {
|
||||
return output2;
|
||||
}
|
||||
|
||||
public int getTickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
|
||||
public int getMinHeat() {
|
||||
return minHeat;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,35 +7,6 @@ import techreborn.util.ItemUtils;
|
|||
|
||||
public final class TechRebornAPI {
|
||||
|
||||
public static ArrayList<BlastFurnaceRecipe> blastFurnaceRecipes = new ArrayList<BlastFurnaceRecipe>();
|
||||
|
||||
public static void registerBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
|
||||
boolean shouldAdd = true;
|
||||
for (BlastFurnaceRecipe blastFurnaceRecipe : blastFurnaceRecipes) {
|
||||
if (ItemUtils.isItemEqual(blastFurnaceRecipe.getInput1(), recipie.getInput1(), false, true) && ItemUtils.isItemEqual(blastFurnaceRecipe.getInput2(), recipie.getInput2(), false, true)) {
|
||||
{
|
||||
try {
|
||||
throw new RegisteredItemRecipe(
|
||||
"Item "
|
||||
+ recipie.getInput1()
|
||||
.getUnlocalizedName()
|
||||
+ " and " + recipie.getInput2().getUnlocalizedName() + " is already being used in a recipe for the BlastFurnace");
|
||||
} catch (RegisteredItemRecipe registeredItemRecipe) {
|
||||
registeredItemRecipe.printStackTrace();
|
||||
shouldAdd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldAdd){
|
||||
blastFurnaceRecipes.add(recipie);
|
||||
//This adds the same recipe but backwards. so you can swap the inputs
|
||||
blastFurnaceRecipes.add(new BlastFurnaceRecipe(recipie.getInput2(), recipie.getInput1(), recipie.output1, recipie.output2, recipie.tickTime, recipie.minHeat));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void addRollingMachinceRecipe(ItemStack output,
|
||||
Object... components)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
|
||||
public class BlastFurnaceRecipe extends BaseRecipe {
|
||||
|
||||
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1 , ItemStack output2, int tickTime, int euPerTick) {
|
||||
super("blastFurnaceRecipe", tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
inputs.add(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import techreborn.api.recipe.RecipeHandler;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.api.recipe.machines.LatheRecipe;
|
||||
import techreborn.api.recipe.machines.PlateCuttingMachineRecipe;
|
||||
|
@ -36,6 +37,7 @@ public class ModRecipes {
|
|||
addUUrecipes();
|
||||
addHammerRecipes();
|
||||
addIndustrialSawmillRecipes();
|
||||
addBlastFurnaceRecipes();
|
||||
}
|
||||
|
||||
public static void addShappedRecipes() {
|
||||
|
@ -477,6 +479,11 @@ public class ModRecipes {
|
|||
RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false));
|
||||
}
|
||||
|
||||
public static void addBlastFurnaceRecipes()
|
||||
{
|
||||
RecipeHandler.addRecipe(new BlastFurnaceRecipe(new ItemStack(Items.apple), new ItemStack(Items.diamond), new ItemStack(Blocks.acacia_stairs), new ItemStack(Blocks.anvil), 200, 30));
|
||||
}
|
||||
|
||||
public static void addUUrecipes() {
|
||||
if(ConfigTechReborn.UUrecipesIridiamOre)
|
||||
CraftingHelper.addShapedOreRecipe((IC2Items.getItem("iridiumOre")),
|
||||
|
|
|
@ -13,8 +13,9 @@ import net.minecraft.network.Packet;
|
|||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.api.BlastFurnaceRecipe;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.api.upgrade.UpgradeHandler;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -27,13 +28,27 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II
|
|||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64);
|
||||
public BlastFurnaceRecipe recipe;
|
||||
public RecipeCrafter crafter;
|
||||
public static int euTick = 5;
|
||||
|
||||
public TileBlastFurnace() {
|
||||
//TODO configs
|
||||
energy = new BasicSink(this, 1000,
|
||||
ConfigTechReborn.CentrifugeTier);
|
||||
energy = new BasicSink(this, 1000,ConfigTechReborn.CentrifugeTier);
|
||||
int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[2];
|
||||
outputs[0] = 2;
|
||||
outputs[1] = 3;
|
||||
crafter = new RecipeCrafter("blastFurnaceRecipe", this, energy, 2, 2, inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
energy.updateEntity();
|
||||
crafter.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,97 +105,97 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
energy.updateEntity();
|
||||
if (getStackInSlot(0) != null && getStackInSlot(1) != null) {
|
||||
if (recipe == null) {
|
||||
for (BlastFurnaceRecipe furnaceRecipe : TechRebornAPI.blastFurnaceRecipes) {
|
||||
if (ItemUtils.isItemEqual(getStackInSlot(0), furnaceRecipe.getInput1(), true, true) && ItemUtils.isItemEqual(getStackInSlot(1), furnaceRecipe.getInput2(), true, true)) {
|
||||
recipe = furnaceRecipe;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!ItemUtils.isItemEqual(getStackInSlot(0), recipe.getInput1(), true, true) || !ItemUtils.isItemEqual(getStackInSlot(1), recipe.getInput2(), true, true)) {
|
||||
recipe = null;
|
||||
tickTime = 0;
|
||||
return;
|
||||
}
|
||||
if (tickTime >= recipe.getTickTime()) {
|
||||
//When both slots are empty
|
||||
if (getStackInSlot(2) == null && getStackInSlot(3) == null) {
|
||||
setInventorySlotContents(2, recipe.getOutput1());
|
||||
setInventorySlotContents(3, recipe.getOutput2());
|
||||
tickTime = 0;
|
||||
recipe = null;
|
||||
} else
|
||||
//When both are the same as the recipe
|
||||
if (ItemUtils.isItemEqual(getStackInSlot(2), recipe.getOutput1(), true, true) && ItemUtils.isItemEqual(getStackInSlot(3), recipe.getOutput2(), true, true) && !areBothOutputsFull()) {
|
||||
decrStackSize(2, -recipe.getOutput1().stackSize);
|
||||
decrStackSize(3, -recipe.getOutput2().stackSize);
|
||||
tickTime = 0;
|
||||
recipe = null;
|
||||
} else
|
||||
//When slot one has stuff and slot 2 is empty
|
||||
if (ItemUtils.isItemEqual(getStackInSlot(2), recipe.getOutput1(), true, true) && getStackInSlot(3) == null) {
|
||||
//Stops if the first slot if full
|
||||
if (recipe.getOutput1() != null
|
||||
&& getStackInSlot(2) != null
|
||||
&& getStackInSlot(2).stackSize
|
||||
+ recipe.getOutput1().stackSize > recipe
|
||||
.getOutput1().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
decrStackSize(2, recipe.getOutput1().stackSize);
|
||||
setInventorySlotContents(3, recipe.getOutput2());
|
||||
tickTime = 0;
|
||||
recipe = null;
|
||||
} else
|
||||
//When slot 2 has stuff and slot 1 is empty
|
||||
if (ItemUtils.isItemEqual(getStackInSlot(3), recipe.getInput2(), true, true) && getStackInSlot(2) == null) {
|
||||
if (recipe.getOutput2() != null
|
||||
&& getStackInSlot(3) != null
|
||||
&& getStackInSlot(3).stackSize
|
||||
+ recipe.getOutput2().stackSize > recipe
|
||||
.getOutput1().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
decrStackSize(3, recipe.getOutput2().stackSize);
|
||||
setInventorySlotContents(2, recipe.getOutput1());
|
||||
tickTime = 0;
|
||||
recipe = null;
|
||||
}
|
||||
} else if (getHeat() >= recipe.getMinHeat()) {
|
||||
if (energy.canUseEnergy(5)) {
|
||||
tickTime++;
|
||||
energy.useEnergy(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
recipe = null;
|
||||
tickTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areBothOutputsFull() {
|
||||
if (recipe.getOutput1() != null
|
||||
&& getStackInSlot(2) != null
|
||||
&& getStackInSlot(2).stackSize
|
||||
+ recipe.getOutput1().stackSize > recipe
|
||||
.getOutput1().getMaxStackSize()) {
|
||||
return true;
|
||||
}
|
||||
if (recipe.getOutput2() != null
|
||||
&& getStackInSlot(3) != null
|
||||
&& getStackInSlot(3).stackSize
|
||||
+ recipe.getOutput2().stackSize > recipe
|
||||
.getOutput1().getMaxStackSize()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public void updateEntity(){
|
||||
// super.updateEntity();
|
||||
// energy.updateEntity();
|
||||
// if (getStackInSlot(0) != null && getStackInSlot(1) != null) {
|
||||
// if (recipe == null) {
|
||||
// for (BlastFurnaceRecipe furnaceRecipe : TechRebornAPI.blastFurnaceRecipes) {
|
||||
// if (ItemUtils.isItemEqual(getStackInSlot(0), furnaceRecipe.getInput1(), true, true) && ItemUtils.isItemEqual(getStackInSlot(1), furnaceRecipe.getInput2(), true, true)) {
|
||||
// recipe = furnaceRecipe;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (!ItemUtils.isItemEqual(getStackInSlot(0), recipe.getInput1(), true, true) || !ItemUtils.isItemEqual(getStackInSlot(1), recipe.getInput2(), true, true)) {
|
||||
// recipe = null;
|
||||
// tickTime = 0;
|
||||
// return;
|
||||
// }
|
||||
// if (tickTime >= recipe.getTickTime()) {
|
||||
// //When both slots are empty
|
||||
// if (getStackInSlot(2) == null && getStackInSlot(3) == null) {
|
||||
// setInventorySlotContents(2, recipe.getOutput1());
|
||||
// setInventorySlotContents(3, recipe.getOutput2());
|
||||
// tickTime = 0;
|
||||
// recipe = null;
|
||||
// } else
|
||||
// //When both are the same as the recipe
|
||||
// if (ItemUtils.isItemEqual(getStackInSlot(2), recipe.getOutput1(), true, true) && ItemUtils.isItemEqual(getStackInSlot(3), recipe.getOutput2(), true, true) && !areBothOutputsFull()) {
|
||||
// decrStackSize(2, -recipe.getOutput1().stackSize);
|
||||
// decrStackSize(3, -recipe.getOutput2().stackSize);
|
||||
// tickTime = 0;
|
||||
// recipe = null;
|
||||
// } else
|
||||
// //When slot one has stuff and slot 2 is empty
|
||||
// if (ItemUtils.isItemEqual(getStackInSlot(2), recipe.getOutput1(), true, true) && getStackInSlot(3) == null) {
|
||||
// //Stops if the first slot if full
|
||||
// if (recipe.getOutput1() != null
|
||||
// && getStackInSlot(2) != null
|
||||
// && getStackInSlot(2).stackSize
|
||||
// + recipe.getOutput1().stackSize > recipe
|
||||
// .getOutput1().getMaxStackSize()) {
|
||||
// return;
|
||||
// }
|
||||
// decrStackSize(2, recipe.getOutput1().stackSize);
|
||||
// setInventorySlotContents(3, recipe.getOutput2());
|
||||
// tickTime = 0;
|
||||
// recipe = null;
|
||||
// } else
|
||||
// //When slot 2 has stuff and slot 1 is empty
|
||||
// if (ItemUtils.isItemEqual(getStackInSlot(3), recipe.getInput2(), true, true) && getStackInSlot(2) == null) {
|
||||
// if (recipe.getOutput2() != null
|
||||
// && getStackInSlot(3) != null
|
||||
// && getStackInSlot(3).stackSize
|
||||
// + recipe.getOutput2().stackSize > recipe
|
||||
// .getOutput1().getMaxStackSize()) {
|
||||
// return;
|
||||
// }
|
||||
// decrStackSize(3, recipe.getOutput2().stackSize);
|
||||
// setInventorySlotContents(2, recipe.getOutput1());
|
||||
// tickTime = 0;
|
||||
// recipe = null;
|
||||
// }
|
||||
// } else if (getHeat() >= recipe.getMinHeat()) {
|
||||
// if (energy.canUseEnergy(5)) {
|
||||
// tickTime++;
|
||||
// energy.useEnergy(5);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// recipe = null;
|
||||
// tickTime = 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public boolean areBothOutputsFull() {
|
||||
// if (recipe.getOutput1() != null
|
||||
// && getStackInSlot(2) != null
|
||||
// && getStackInSlot(2).stackSize
|
||||
// + recipe.getOutput1().stackSize > recipe
|
||||
// .getOutput1().getMaxStackSize()) {
|
||||
// return true;
|
||||
// }
|
||||
// if (recipe.getOutput2() != null
|
||||
// && getStackInSlot(3) != null
|
||||
// && getStackInSlot(3).stackSize
|
||||
// + recipe.getOutput2().stackSize > recipe
|
||||
// .getOutput1().getMaxStackSize()) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
|
|
Loading…
Reference in a new issue