aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-12-24 18:46:40 +0100
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-12-24 18:46:40 +0100
commiteacdf1e10f02be6f42957bbb065fec0345e3b64a (patch)
tree8d7cdac3688a1b76af46c043ef4261f523fb7e08
parent768bc557bb7ce1df0b1b090fba46bcf106a2bd03 (diff)
downloadGT5-Unofficial-eacdf1e10f02be6f42957bbb065fec0345e3b64a.tar.gz
GT5-Unofficial-eacdf1e10f02be6f42957bbb065fec0345e3b64a.tar.bz2
GT5-Unofficial-eacdf1e10f02be6f42957bbb065fec0345e3b64a.zip
Heating Coil Logic Overhaul
-rw-r--r--src/main/java/gregtech/api/enums/HeatingCoilLevel.java64
-rw-r--r--src/main/java/gregtech/api/interfaces/IHeatingCoil.java18
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings5.java57
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java337
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java287
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java320
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java150
7 files changed, 695 insertions, 538 deletions
diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
new file mode 100644
index 0000000000..7b1b3f7334
--- /dev/null
+++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
@@ -0,0 +1,64 @@
+package gregtech.api.enums;
+
+public enum HeatingCoilLevel {
+ None ( 0L),
+ // ULV ( 901L), //Not implemented
+ LV ( 1_801L), //Cupronickel
+ MV ( 2_701L), //KANTHAL
+ HV ( 3_601L), //NICHROME
+ EV ( 4_501L), //TUNGSTENSTEEL
+ IV ( 5_401L), //HSSG
+ // LuV ( 6_301L), //Not implemented
+ ZPM ( 7_201L), //NAQUADAH
+ UV ( 9_001L), //NAQUADAHALLOY
+ UHV ( 9_901L), //ELECTRUMFLUX
+ UEV (10_801L), //AWAKENEDDRACONIUM
+ UIV (11_701L),
+
+ //Not Implemented yet
+ UMV (12_601L),
+ UXV (13_501L),
+ OpV (14_401L),
+ MAX (15_301L),
+ ;
+
+ private final long HEAT;
+
+ HeatingCoilLevel(long heat) {
+ this.HEAT = heat;
+ }
+ /**
+ * @return the coil heat, used for recipes in the Electronic Blast Furnace for example
+ */
+ public long getHeat() {
+ return HEAT;
+ }
+
+ /**
+ * @return the coil tier, used for discount in the Pyrolyse Ofen for example
+ */
+ public byte getTier() {
+ return (byte) (this.ordinal() - 1);
+ }
+
+ /**
+ * @return the coil Level, used for Parallels in the Multi Furnace for example
+ */
+ public byte getLevel() {
+ return (byte) Math.max(16, 2 << (this.ordinal() -1));
+ }
+
+ /**
+ * @return the coil Discount, used for discount in the Multi Furnace for example
+ */
+ public byte getCostDiscount() {
+ return (byte) Math.min(1, 2 << (this.ordinal() -1 -4)); //-1 bcs. of none, -4 = offset
+ }
+
+ public static HeatingCoilLevel getFromTier(byte tier){
+ if (tier < 0 || tier > HeatingCoilLevel.values().length -1)
+ return HeatingCoilLevel.None;
+
+ return HeatingCoilLevel.values()[tier+1];
+ }
+}
diff --git a/src/main/java/gregtech/api/interfaces/IHeatingCoil.java b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java
new file mode 100644
index 0000000000..c8ceccf941
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java
@@ -0,0 +1,18 @@
+package gregtech.api.interfaces;
+
+import gregtech.api.enums.HeatingCoilLevel;
+import net.minecraft.item.ItemStack;
+
+import java.util.function.Consumer;
+
+public interface IHeatingCoil {
+
+ HeatingCoilLevel getCoilHeat(int meta);
+ default HeatingCoilLevel getCoilHeat(ItemStack stack) {
+ return getCoilHeat(stack.getItemDamage());
+ }
+
+ void setOnCoilCheck(Consumer<IHeatingCoil> callback);
+ Consumer<IHeatingCoil> getOnCoilCheck();
+}
+
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
index 55492c961c..1e03541fde 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
@@ -2,16 +2,23 @@ package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
+import java.util.function.Consumer;
+
+import static gregtech.api.enums.HeatingCoilLevel.*;
+
public class GT_Block_Casings5
- extends GT_Block_Casings_Abstract {
+ extends GT_Block_Casings_Abstract
+ implements IHeatingCoil {
+
public GT_Block_Casings5() {
super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
@@ -37,6 +44,7 @@ public class GT_Block_Casings5
ItemList.Casing_Coil_ElectrumFlux.set(new ItemStack(this, 1, 7));
ItemList.Casing_Coil_AwakenedDraconium.set(new ItemStack(this, 1, 8));
}
+
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int aSide, int aMeta) {
@@ -62,4 +70,47 @@ public class GT_Block_Casings5
}
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
}
-}
+
+ /*--------------- COIL CHECK IMPL. ------------*/
+
+ @Override
+ public HeatingCoilLevel getCoilHeat(int meta) {
+ getOnCoilCheck().accept(this);
+ switch (meta) {
+ case 0:
+ return LV;
+ case 1:
+ return MV;
+ case 2:
+ return HV;
+ case 3:
+ return EV;
+ case 4:
+ return IV;
+ case 5:
+ return ZPM;
+ case 6:
+ return UV;
+ case 7:
+ return UHV;
+ case 8:
+ return UIV;
+ default:
+ return None;
+ }
+ }
+
+ /*--------------- CALLBACK ------------*/
+
+ private Consumer<IHeatingCoil> callback;
+
+ @Override
+ public void setOnCoilCheck(Consumer<IHeatingCoil> callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public Consumer<IHeatingCoil> getOnCoilCheck() {
+ return this.callback;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index 061db80ece..c3b960476d 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -5,6 +5,9 @@ import static gregtech.api.enums.GT_Values.VN;
import java.util.ArrayList;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.interfaces.IHeatingCoil;
+import net.minecraft.block.Block;
import org.lwjgl.input.Keyboard;
import gregtech.api.GregTech_API;
@@ -37,6 +40,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
private FluidStack[] pollutionFluidStacks = new FluidStack[]{Materials.CarbonDioxide.getGas(1000),
Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)};
+ private static final int CASING_INDEX = 11;
+
public GT_MetaTileEntity_ElectricBlastFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -63,7 +68,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
.beginStructureBlock(3, 4, 3, true)
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 0)
- .addOtherStructurePart("Heating Coils (any tier)", "Two middle Layers")
+ .addOtherStructurePart("Heating Coils", "Two middle Layers")
.addEnergyHatch("Any bottom layer casing")
.addMaintenanceHatch("Any bottom layer casing")
.addMufflerHatch("Top middle")
@@ -83,9 +88,9 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
}
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11]};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -109,65 +114,85 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
int tInputList_sS = tInputList.size();
for (int i = 0; i < tInputList_sS - 1; i++) {
for (int j = i + 1; j < tInputList_sS; j++) {
- if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
- if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
- tInputList.remove(j--);
- tInputList_sS = tInputList.size();
- } else {
- tInputList.remove(i--);
- tInputList_sS = tInputList.size();
- break;
- }
+ if (!GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j)))
+ continue;
+
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ tInputList_sS = tInputList.size();
+ } else {
+ tInputList.remove(i--);
+ tInputList_sS = tInputList.size();
+ break;
}
}
}
- ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
+ ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]);
ArrayList<FluidStack> tFluidList = getStoredFluids();
int tFluidList_sS = tFluidList.size();
for (int i = 0; i < tFluidList_sS - 1; i++) {
for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
+ if (!GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j)))
+ continue;
+
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ } else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
}
}
}
- FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue)/900;
- byte overclockCount=calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- if(tHeatCapacityDivTiers>0){
- this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
- this.mMaxProgresstime >>=Math.min(tHeatCapacityDivTiers/2,overclockCount);//extra free overclocking if possible
- if(this.mMaxProgresstime<1) this.mMaxProgresstime=1;//no eu efficiency correction
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)};
- this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
- updateSlots();
- return true;
- }
+ FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]);
+ if (tInputList.size() <= 0)
+ return false;
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[tTier],
+ tFluids,
+ tInputs
+ );
+
+ if (tRecipe == null)
+ return false;
+ if (this.mHeatingCapacity < tRecipe.mSpecialValue)
+ return false;
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
+ return false;
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900;
+ byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
}
- return false;
+ if(tHeatCapacityDivTiers > 0) {
+ this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2,overclockCount);//extra free overclocking if possible
+ if(this.mMaxProgresstime < 1)
+ this.mMaxProgresstime = 1;//no eu efficiency correction
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ this.mOutputItems = new ItemStack[] {
+ tRecipe.getOutput(0),
+ tRecipe.getOutput(1)
+ };
+ this.mOutputFluids = new FluidStack[] {
+ tRecipe.getFluidOutput(0)
+ };
+ updateSlots();
+ return true;
}
/**
@@ -193,7 +218,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
//Long EUt calculation
long xEUt=aEUt;
//Isnt too low EUt check?
- long tempEUt = xEUt<V[1] ? V[1] : xEUt;
+ long tempEUt = Math.max(xEUt, V[1]);
mMaxProgresstime = aDuration;
@@ -224,97 +249,79 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
this.mHeatingCapacity = 0;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir))
return false;
- }
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) {
+
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir))
return false;
- }
- if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 11)) {
+
+ if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), CASING_INDEX))
return false;
- }
+
replaceDeprecatedCoils(aBaseMetaTileEntity);
+ Block heatingCoil = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir);
+ if (!(heatingCoil instanceof IHeatingCoil))
+ return false;
+
byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir);
- switch (tUsedMeta) {
- case 0:
- this.mHeatingCapacity = 1801;
- break;
- case 1:
- this.mHeatingCapacity = 2701;
- break;
- case 2:
- this.mHeatingCapacity = 3601;
- break;
- case 3:
- this.mHeatingCapacity = 4501;
- break;
- case 4:
- this.mHeatingCapacity = 5401;
- break;
- case 5:
- this.mHeatingCapacity = 7201;
- break;
- case 6:
- this.mHeatingCapacity = 9001;
- break;
- case 7:
- this.mHeatingCapacity = 9901;
- break;
- case 8:
- this.mHeatingCapacity = 10801;
- break;
- default:
- return false;
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((i != 0) || (j != 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != tUsedMeta) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) {
- return false;
- }
- if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 11)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- }
+ HeatingCoilLevel heatingCap = ((IHeatingCoil)heatingCoil).getCoilHeat(tUsedMeta);
+
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
- if ((xDir + i != 0) || (zDir + j != 0)) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) {
- return false;
- }
- }
- }
+ if ((i == 0) && (j == 0))
+ continue;
+ if ((xDir + i == 0) && (zDir + j == 0))
+ continue;
+
+ Block blockLow = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir);
+ if (!(blockLow instanceof IHeatingCoil))
+ return false;
+
+ Block blockHi = aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir);
+ if (!(blockHi instanceof IHeatingCoil))
+ return false;
+
+ byte metaLow = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir);
+ HeatingCoilLevel coilHeatLow = ((IHeatingCoil) blockLow).getCoilHeat(metaLow);
+ byte metaHi = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir);
+ HeatingCoilLevel coilHeatHi = ((IHeatingCoil) blockHi).getCoilHeat(metaHi);
+
+ if (heatingCap != coilHeatLow || heatingCap != coilHeatHi)
+ return false;
+
+ if (addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), CASING_INDEX))
+ continue;
+
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != CASING_INDEX)
+ return false;
+
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
+
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addOutputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != CASING_INDEX)
+ return false;
}
}
+ this.mHeatingCapacity = (int) heatingCap.getHeat();
this.mHeatingCapacity += 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
return true;
}
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
- boolean result= this.checkMachineFunction(aBaseMetaTileEntity,aStack);
- if (!result) this.mHeatingCapacity=0;
- return result;
+ return this.checkMachineFunction(aBaseMetaTileEntity,aStack);
}
public int getMaxEfficiency(ItemStack aStack) {
@@ -337,19 +344,30 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
int tUsedMeta;
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
- if ((xPos == tX) && (zPos == tZ)) {
+ if ((xPos == tX) && (zPos == tZ))
continue;
- }
for (int yPos = tY + 1; yPos <= tY + 2; yPos++) {
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos);
- if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1) {
- aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
- }
+ if (tUsedMeta < 12)
+ continue;
+ if (tUsedMeta > 14)
+ continue;
+ if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1)
+ continue;
+
+ aBaseMetaTileEntity.getWorld().setBlock(
+ xPos,
+ yPos,
+ zPos,
+ GregTech_API.sBlockCasings5,
+ tUsedMeta - 12,
+ 3
+ );
}
}
}
@@ -361,34 +379,37 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
FluidStack tLiquid = aLiquid.copy();
boolean isOutputPollution = false;
for (FluidStack pollutionFluidStack : pollutionFluidStacks) {
- if (tLiquid.isFluidEqual(pollutionFluidStack)) {
- isOutputPollution = true;
- break;
- }
+ if (!tLiquid.isFluidEqual(pollutionFluidStack))
+ continue;
+
+ isOutputPollution = true;
+ break;
}
if (isOutputPollution) {
targetHeight = this.controllerY + 3;
int pollutionReduction = 0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- pollutionReduction = 100 - tHatch.calculatePollutionReduction(100);
- break;
- }
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ pollutionReduction = 100 - tHatch.calculatePollutionReduction(100);
+ break;
}
tLiquid.amount = tLiquid.amount * (pollutionReduction + 5) / 100;
} else {
targetHeight = this.controllerY;
}
for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
- if (tHatch.getBaseMetaTileEntity().getYCoord() == targetHeight) {
- int tAmount = tHatch.fill(tLiquid, false);
- if (tAmount >= tLiquid.amount) {
- return tHatch.fill(tLiquid, true) >= tLiquid.amount;
- } else if (tAmount > 0) {
- tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
- }
- }
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? !tHatch.outputsSteam() : !tHatch.outputsLiquids())
+ continue;
+
+ if (tHatch.getBaseMetaTileEntity().getYCoord() != targetHeight)
+ continue;
+
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
}
}
return false;
@@ -398,18 +419,18 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
public String[] getInfoData() {
int mPollutionReduction=0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
- }
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
}
long storedEnergy=0;
long maxEnergy=0;
for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
}
return new String[]{
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index 5eca30def1..580bbea08d 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -1,14 +1,10 @@
package gregtech.common.tileentities.machines.multi;
-import static gregtech.api.enums.GT_Values.VN;
-
-import java.util.ArrayList;
-
-import org.lwjgl.input.Keyboard;
-
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -20,17 +16,25 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.input.Keyboard;
+
+import java.util.ArrayList;
+
+import static gregtech.api.enums.GT_Values.VN;
public class GT_MetaTileEntity_MultiFurnace
extends GT_MetaTileEntity_MultiBlockBase {
private int mLevel = 0;
private int mCostDiscount = 1;
+ private static final int CASING_INDEX = 11;
+
public GT_MetaTileEntity_MultiFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -54,25 +58,22 @@ public class GT_MetaTileEntity_MultiFurnace
.beginStructureBlock(3, 3, 3, true)
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 8)
- .addOtherStructurePart("Heating Coils (any tier)", "Middle layer")
+ .addOtherStructurePart("Heating Coils", "Middle layer")
.addEnergyHatch("Any bottom casing")
.addMaintenanceHatch("Any bottom casing")
.addMufflerHatch("Top Middle")
.addInputBus("Any bottom casing")
.addOutputBus("Any bottom casing")
.toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
+ return tt.getInformation();
+ return tt.getStructureInformation();
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
- }
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11]};
+ if (aSide == aFacing)
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -93,31 +94,24 @@ public class GT_MetaTileEntity_MultiFurnace
public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
- if (!tInputList.isEmpty()) {
- int mVolatage=GT_Utility.safeInt(getMaxInputVoltage());
- int tMaxParrallel = 8 * this.mLevel;
- int tCurrenParrallel = 0;
- ItemStack tSmeltStack = tInputList.get(0);
- ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null);
- if (tOutputStack == null)
- return false;
- for (int i = 0;i<tInputList.size();i++)
- {
- ItemStack item = tInputList.get(i);
- if (tSmeltStack.isItemEqual(item))
- {
- if (item.stackSize<(tMaxParrallel-tCurrenParrallel))
- {
- tCurrenParrallel += item.stackSize;
- item.stackSize = 0;
- }
- else
- {
- item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel;
- tCurrenParrallel = tMaxParrallel;
- break;
- }
- }
+ if (tInputList.isEmpty())
+ return false;
+
+ int mVolatage = GT_Utility.safeInt(getMaxInputVoltage());
+ int tMaxParrallel = 8 * this.mLevel;
+ int tCurrenParrallel = 0;
+ ItemStack tSmeltStack = tInputList.get(0);
+ ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null);
+ if (tOutputStack == null)
+ return false;
+ for (ItemStack item : tInputList)
+ if (tSmeltStack.isItemEqual(item)) if (item.stackSize < (tMaxParrallel - tCurrenParrallel)) {
+ tCurrenParrallel += item.stackSize;
+ item.stackSize = 0;
+ } else {
+ item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel;
+ tCurrenParrallel = tMaxParrallel;
+ break;
}
// this.mOutputItems = new ItemStack[8 * this.mLevel];
// for (int i = 0; (i < 256) && (j < this.mOutputItems.length); i++) {
@@ -125,37 +119,33 @@ public class GT_MetaTileEntity_MultiFurnace
// j++;
// }
// }
- tCurrenParrallel *= tOutputStack.stackSize;
- this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1];
- for (int i = 0; i<this.mOutputItems.length;i++)
- {
- ItemStack tNewStack = tOutputStack.copy();
- int size = tCurrenParrallel>64 ? 64 : tCurrenParrallel;
- tNewStack.stackSize = size;
- tCurrenParrallel -= size;
- this.mOutputItems[i] = tNewStack;
- }
+ tCurrenParrallel *= tOutputStack.stackSize;
+ this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1];
+ for (int i = 0; i < this.mOutputItems.length; i++) {
+ ItemStack tNewStack = tOutputStack.copy();
+ int size = Math.min(tCurrenParrallel, 64);
+ tNewStack.stackSize = size;
+ tCurrenParrallel -= size;
+ this.mOutputItems[i] = tNewStack;
+ }
+ if (this.mOutputItems.length > 0) {
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ calculateOverclockedNessMulti(4, 512, 1, mVolatage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
- if (this.mOutputItems != null && this.mOutputItems.length > 0) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- calculateOverclockedNessMulti(4, 512, 1, mVolatage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
+ this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1);
+ if (mEUt == Integer.MAX_VALUE - 1)
+ return false;
- this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1);
- if (mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- }
- updateSlots();
- return true;
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
}
- return false;
+ updateSlots();
+ return true;
}
private boolean checkMachineFunction(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
@@ -164,92 +154,68 @@ public class GT_MetaTileEntity_MultiFurnace
this.mLevel = 0;
this.mCostDiscount = 1;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
+
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir))
return false;
- }
- addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 11);
+
+ addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), CASING_INDEX);
replaceDeprecatedCoils(aBaseMetaTileEntity);
+ Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir);
+ if (!(coil instanceof IHeatingCoil))
+ return false;
+ IHeatingCoil heatingCoil = (IHeatingCoil) coil;
byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
- switch (tUsedMeta) {
- case 0:
- this.mLevel = 1;
- this.mCostDiscount = 1;
- break;
- case 1:
- this.mLevel = 2;
- this.mCostDiscount = 1;
- break;
- case 2:
- this.mLevel = 4;
- this.mCostDiscount = 1;
- break;
- case 3:
- this.mLevel = 8;
- this.mCostDiscount = 1;
- break;
- case 4:
- this.mLevel = 16;
- this.mCostDiscount = 2;
- break;
- case 5:
- this.mLevel = 16;
- this.mCostDiscount = 4;
- break;
- case 6:
- this.mLevel = 16;
- this.mCostDiscount = 8;
- break;
- case 7:
- this.mLevel = 16;
- this.mCostDiscount = 16;
- break;
- case 8:
- this.mLevel = 16;
- this.mCostDiscount = 24;
- break;
- default:
- return false;
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((i != 0) || (j != 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- for (int i = -1; i < 2; i++) {
+ HeatingCoilLevel heatingLevel = heatingCoil.getCoilHeat(tUsedMeta);
+
+ for (int i = -1; i < 2; i++)
for (int j = -1; j < 2; j++) {
- if ((xDir + i != 0) || (zDir + j != 0)) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) {
- return false;
- }
- }
- }
+
+ //Middle
+ if ((i == 0) && (j == 0))
+ continue;
+
+ Block coilM = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j);
+ if (!(coilM instanceof IHeatingCoil))
+ return false;
+ byte usedMetaM = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j);
+
+ IHeatingCoil heatingCoilM = (IHeatingCoil) coilM;
+ HeatingCoilLevel heatingLevelM = heatingCoilM.getCoilHeat(usedMetaM);
+
+ if (heatingLevelM != heatingLevel)
+ return false;
+
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != CASING_INDEX)
+ return false;
+
+ //Controller
+ if ((xDir + i == 0) && (zDir + j == 0))
+ continue;
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addOutputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != CASING_INDEX)
+ return false;
}
- }
+
+ this.mLevel = heatingLevel.getLevel();
+ this.mCostDiscount = heatingLevel.getCostDiscount();
return true;
}
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
- boolean result= this.checkMachineFunction(aBaseMetaTileEntity,aStack);
- if (!result) this.mLevel=0;
- return result;
- }
+
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
+ return this.checkMachineFunction(aBaseMetaTileEntity,aStack);
+ }
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
@@ -271,40 +237,33 @@ public class GT_MetaTileEntity_MultiFurnace
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
int tUsedMeta;
- for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
+ for (int xPos = tX - 1; xPos <= tX + 1; xPos++)
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
- if ((xPos == tX) && (zPos == tZ)) {
- continue;
- }
+ if ((xPos == tX) && (zPos == tZ)) continue;
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, tY + 1, zPos);
- if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) {
+ if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1)
aBaseMetaTileEntity.getWorld().setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
- }
}
- }
}
@Override
public String[] getInfoData() {
int mPollutionReduction=0;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
- }
- }
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches)
+ if (isValidMetaTileEntity(tHatch))
+ mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
long storedEnergy=0;
long maxEnergy=0;
- for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
}
- }
return new String[]{
StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
index e4ad65e4a4..5738703aef 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
@@ -1,9 +1,11 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -14,6 +16,7 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@@ -27,6 +30,9 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
private ForgeDirection orientation;
private int controllerX, controllerZ;
+ private static final byte CASING_INDEX = 49;
+ private HeatingCoilLevel heatLevel;
+
public GT_MetaTileEntity_OilCracker(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -46,7 +52,9 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
.beginStructureBlock(5, 3, 3, true)
.addController("Front center")
.addCasingInfo("Clean Stainless Steel Machine Casing", 18)
- .addOtherStructurePart("2 Rings of 8 Cupronickel Coils", "Each side of the controller")
+ .addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller")
+ .addInfo("Processing speed scales linearly with Coil tier:")
+ .addInfo("CuNi: 100%, FeAlCr: 150%, Ni4Cr: 200%, Fe50CW: 250%, etc.")
.addEnergyHatch("Any casing")
.addMaintenanceHatch("Any casing")
.addInputHatch("Steam/Hydrogen, Any middle ring casing")
@@ -54,19 +62,14 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
.addOutputHatch("Any left/right side casing")
.addStructureInfo("Input/Output Hatches must be on opposite sides!")
.toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return tt.getInformation();
+ return tt.getStructureInformation();
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49],
- new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER)};
- }
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]};
+ if (aSide == aFacing) return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX],
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -76,13 +79,22 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tInputList = getStoredFluids();
- FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[tInputList.size()]);
+ FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[0]);
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCrakingRecipes.findRecipe(
- getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs ,new ItemStack[]{mInventory[1]});
- if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluidInputs, new ItemStack[]{mInventory[1]})) {
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[tTier],
+ tFluidInputs ,
+ mInventory[1]
+ );
+
+ if (tRecipe == null)
+ return false;
+
+ if (tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
this.mEUt = tRecipe.mEUt;
@@ -91,18 +103,40 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
- if (this.mEUt > 0) {
+
+ if (this.mEUt > 0)
this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ this.mMaxProgresstime = Math.max(mMaxProgresstime / heatLevel.getTier(), 1);
+
this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
return true;
}
return false;
}
+ private boolean coilsNotPresent(IGregTechTileEntity aBaseMetaTileEntity, int x , int y, int z) {
+
+ Block coil = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+
+ if (!(coil instanceof IHeatingCoil))
+ return true;
+
+ IHeatingCoil heatingCoil = (IHeatingCoil) coil;
+ byte meta = aBaseMetaTileEntity.getMetaIDOffset(x, y, z);
+ HeatingCoilLevel heatLevel = heatingCoil.getCoilHeat(meta);
+ if (heatLevel == HeatingCoilLevel.None)
+ return true;
+
+ if (this.heatLevel == HeatingCoilLevel.None)
+ this.heatLevel = heatLevel;
+
+ return this.heatLevel != heatLevel;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ heatLevel = HeatingCoilLevel.None;
this.orientation = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing());
this.controllerX = aBaseMetaTileEntity.getXCoord();
this.controllerZ = aBaseMetaTileEntity.getZCoord();
@@ -111,127 +145,121 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
int amount = 0;
replaceDeprecatedCoils(aBaseMetaTileEntity);
boolean negSideInput = false, negSideOutput = false, posSideInput = false, posSideOutput = false;
+ // zDirection
+ // height
+ // xDirection
+ // height
if (xDir != 0) {
- for (int i = -1; i < 2; i++) {// xDirection
- for (int j = -1; j < 2; j++) {// height
+ for (int i = -1; i < 2; i++)
+ for (int j = -1; j < 2; j++)
for (int h = -2; h < 3; h++) {
- if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
- if (h == 1 || h == -1) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 0) {
- return false;
- }
- }
- if (h == 2 || h == -2) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
- if (addInputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideInput = true;
- } else {
- posSideInput = true;
- }
- } else if (addOutputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideOutput = true;
- } else {
- posSideOutput = true;
- }
- } else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4) {
+ if (j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))
+ continue;
+ if (h == 1 || h == -1) {
+ if (coilsNotPresent(aBaseMetaTileEntity, xDir + h, j, i + zDir))
+ return false;
+ }
+ if (h == 2 || h == -2) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ if (h == -2)
+ negSideInput = true;
+ else
+ posSideInput = true;
+ else if (addOutputToMachineList(tTileEntity, CASING_INDEX))
+ if (h == -2)
+ negSideOutput = true;
+ else
+ posSideOutput = true;
+ else if (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ if (!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4)
return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1) {
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1)
return false;
- }
amount++;
}
- }
- if (h == 0) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
- if ((!addMaintenanceToMachineList(tTileEntity, 49)) && (!addInputToMachineList(tTileEntity, 49))
- && (!addEnergyInputToMachineList(tTileEntity, 49))) {
- if (!((xDir + i) == 0 && j == 0 && (h + zDir) == 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- }
-
}
+ if (h == 0) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if ((xDir + i) == 0 && j == 0 && (h + zDir) == 0)
+ continue;
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4)
+ return false;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1)
+ return false;
+ amount++;
+ }
+
}
- }
- }
- } else {
- for (int i = -1; i < 2; i++) {// zDirection
- for (int j = -1; j < 2; j++) {// height
+ } else
+ for (int i = -1; i < 2; i++)
+ for (int j = -1; j < 2; j++)
for (int h = -2; h < 3; h++) {
- if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
- if (h == 1 || h == -1) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 0) {
- return false;
- }
- }
+ if (j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))
+ continue;
+ if (h == 1 || h == -1) {
+ if (coilsNotPresent(aBaseMetaTileEntity, xDir + h, j, i + zDir))
+ return false;
+ } else {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
if (h == 2 || h == -2) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
- if (addInputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideInput = true;
- } else {
- posSideInput = true;
- }
- } else if (addOutputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideOutput = true;
- } else {
- posSideOutput = true;
- }
- } else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4) {
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ if (h == -2)
+ negSideInput = true;
+ else
+ posSideInput = true;
+ else if (addOutputToMachineList(tTileEntity, CASING_INDEX)) {
+ if (h == -2)
+ negSideOutput = true;
+ else
+ posSideOutput = true;
+ } else {
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4)
return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 1) {
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 1)
return false;
- }
amount++;
}
- }
- if (h == 0) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
- if ((!addMaintenanceToMachineList(tTileEntity, 49)) && (!addInputToMachineList(tTileEntity, 49))
- && (!addEnergyInputToMachineList(tTileEntity, 49))) {
- if (!((xDir + h) == 0 && j == 0 && (i + zDir) == 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- }
+ } else {
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ continue;
+ if (j == 0 && i + zDir == 0)
+ continue;
+ if (aBaseMetaTileEntity.getBlockOffset(0, j, i + zDir) != GregTech_API.sBlockCasings4)
+ return false;
+ if (aBaseMetaTileEntity.getMetaIDOffset(0, j, i + zDir) != 1)
+ return false;
+ amount++;
+ }
}
}
- }
- }
- }
- if ((negSideInput && negSideOutput) || (posSideInput && posSideOutput)
- || (negSideInput && posSideInput) || (negSideOutput && posSideOutput)) {
- return false;
- }
- if (amount < 18) return false;
- return true;
+
+ if (negSideInput && negSideOutput)
+ return false;
+ if (posSideInput && posSideOutput)
+ return false;
+ if (negSideInput && posSideInput)
+ return false;
+ if (negSideOutput && posSideOutput)
+ return false;
+
+ return amount >= 18;
}
@Override
@@ -267,50 +295,52 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
- for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2)) {
- for (int yPos = tY - 1; yPos <= tY + 1; yPos++) {
+ for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2))
+ for (int yPos = tY - 1; yPos <= tY + 1; yPos++)
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos += (xDir != 0 ? 2 : 1)) {
- if ((yPos == tY) && (xPos == tX || zPos == tZ)) {
+ if ((yPos == tY) && (xPos == tX || zPos == tZ))
continue;
- }
- if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1 &&
- aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos) == 12)
- {
- aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, 0, 3);
- }
+ byte tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos);
+ if (tUsedMeta < 12)
+ continue;
+ if (tUsedMeta > 14)
+ continue;
+ if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1)
+ continue;
+
+ aBaseMetaTileEntity.getWorld().setBlock(
+ xPos,
+ yPos,
+ zPos,
+ GregTech_API.sBlockCasings5,
+ tUsedMeta - 12,
+ 3
+ );
}
- }
- }
}
@Override
public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> rList = new ArrayList<FluidStack>();
+ ArrayList<FluidStack> rList = new ArrayList<>();
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
FluidStack tStack = tHatch.getFillableStack();
if (tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) || tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) {
- if (isHatchInMiddleRing(tHatch)) {
- rList.add(tStack);
- }
- } else {
- if (!isHatchInMiddleRing(tHatch)) {
+ if (isHatchInMiddleRing(tHatch))
rList.add(tStack);
- }
- }
+ } else if (!isHatchInMiddleRing(tHatch))
+ rList.add(tStack);
}
}
return rList;
}
private boolean isHatchInMiddleRing(GT_MetaTileEntity_Hatch_Input inputHatch){
- if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH) {
+ if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
return inputHatch.getBaseMetaTileEntity().getXCoord() == this.controllerX;
- } else {
- return inputHatch.getBaseMetaTileEntity().getZCoord() == this.controllerZ;
- }
+ return inputHatch.getBaseMetaTileEntity().getZCoord() == this.controllerZ;
}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index c2e13a815f..b04510e981 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -3,8 +3,10 @@ package gregtech.common.tileentities.machines.multi;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -28,9 +30,9 @@ import org.lwjgl.input.Keyboard;
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
- private int coilMetaID;
+ private HeatingCoilLevel coilHeat;
//public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
- private final int CASING_INDEX = 1090;
+ private static final int CASING_INDEX = 1090;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -53,7 +55,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
.beginStructureBlock(5, 4, 5, true)
.addController("Front center")
.addCasingInfo("Pyrolyse Oven Casing", 60)
- .addOtherStructurePart("Heating Coils (any tier)", "Center 3x1x3 of the bottom layer")
+ .addOtherStructurePart("Heating Coils", "Center 3x1x3 of the bottom layer")
.addEnergyHatch("Any bottom layer casing")
.addMaintenanceHatch("Any bottom layer casing")
.addMufflerHatch("Center 3x1x3 area in top layer")
@@ -86,8 +88,8 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
int tInputList_sS=tInputList.size();
for (int i = 0; i < tInputList_sS - 1; i++) {
for (int j = i + 1; j < tInputList_sS; j++) {
- if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
- if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
tInputList.remove(j--); tInputList_sS=tInputList.size();
} else {
tInputList.remove(i--); tInputList_sS=tInputList.size();
@@ -96,14 +98,14 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
}
- ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
+ ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[0]), 0, 2);
ArrayList<FluidStack> tFluidList = getStoredFluids();
int tFluidList_sS=tFluidList.size();
for (int i = 0; i < tFluidList_sS - 1; i++) {
for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
tFluidList.remove(j--); tFluidList_sS=tFluidList.size();
} else {
tFluidList.remove(i--); tFluidList_sS=tFluidList.size();
@@ -112,43 +114,43 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
}
- FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
-
- //Dynamic recipe adding for newly found logWoods - wont be visible in nei most probably
- if(tRecipe==null){
- for(ItemStack is:tInputs) {
- for (int id : OreDictionary.getOreIDs(is)) {
- if (OreDictionary.getOreName(id).equals("logWood"))
- ProcessingLog.addPyrolyeOvenRecipes(is);
- }
- }
- tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- }
+ FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
+ if (tInputList.size() <= 0)
+ return false;
- if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
+ //Dynamic recipe adding for newly found logWoods - wont be visible in nei most probably
+ if(tRecipe==null){
+ for(ItemStack is:tInputs) {
+ for (int id : OreDictionary.getOreIDs(is)) {
+ if (OreDictionary.getOreName(id).equals("logWood"))
+ ProcessingLog.addPyrolyeOvenRecipes(is);
}
- this.mMaxProgresstime = Math.max(mMaxProgresstime * 2 / (1 + coilMetaID), 1);
- if (tRecipe.mOutputs.length > 0) this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
- if (tRecipe.mFluidOutputs.length > 0)
- this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
- updateSlots();
- return true;
}
+ tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
}
- return false;
+
+ if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
+ return false;
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
+ this.mMaxProgresstime = Math.max(mMaxProgresstime * 2 / (1 + coilHeat.getTier()), 1);
+ if (tRecipe.mOutputs.length > 0) this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
+ if (tRecipe.mFluidOutputs.length > 0)
+ this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
+ updateSlots();
+ return true;
}
@Override
@@ -166,29 +168,36 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
for (int h = 0; h < 4; h++) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// inner 3x3 without height
- if (h == 0) {// inner floor (Cupronickel or Kanthal coils)
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings5) {
+ if (h == 0) {// inner floor (Coils)
+
+ Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+
+ if (!(coil instanceof IHeatingCoil))
return false;
- }
+
int metaID = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (metaID > 8) {
+
+ HeatingCoilLevel coilHeat = ((IHeatingCoil)coil).getCoilHeat(metaID);
+
+ if (coilHeat == HeatingCoilLevel.None) {
return false;
} else {
if (firstCoil) {
- this.coilMetaID = metaID;
+ this.coilHeat = coilHeat;
firstCoil = false;
- } else if (metaID != this.coilMetaID) {
+ } else if (coilHeat != this.coilHeat) {
return false;
}
}
} else if (h == 3) {// inner ceiling (ulv casings + input + muffler)
- if ((!addInputToMachineList(tTileEntity, CASING_INDEX)) && (!addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
- }
+ if ((addInputToMachineList(tTileEntity, CASING_INDEX)) || (addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
+ continue;
+ }
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
+ return false;
}
} else {// inside air
if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) {
@@ -197,23 +206,28 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
} else {// outer 5x5 without height
if (h == 0) {// outer floor (controller, output, energy, maintainance, rest ulv casings)
- if ((!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) && (!addOutputToMachineList(tTileEntity, CASING_INDEX)) && (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))) {
- if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
- }
- }
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
+ continue;
}
- } else {// outer above floor (ulv casings)
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
+
+ if (addOutputToMachineList(tTileEntity, CASING_INDEX)) {
+ continue;
}
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
+
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX)) {
+ continue;
}
+
+ if ((xDir + i == 0) && (zDir + j == 0)) {
+ continue;
+ }//no controller
+ }
+ // outer above floor (ulv casings)
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
+ return false;
}
}
}
@@ -255,7 +269,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir * 2;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2;
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {