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
|
@ -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…
Add table
Add a link
Reference in a new issue