diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2021-01-31 15:55:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-31 15:55:21 +0100 |
commit | ea5026c2d72eaf1e4d8a9bf14ef05d81925e69f1 (patch) | |
tree | b20e6a6689192cb61748908af7f8aeaa9e4385a6 /src | |
parent | f13ba4771bd3ab6780bd40078f67b3717736194b (diff) | |
download | GT5-Unofficial-ea5026c2d72eaf1e4d8a9bf14ef05d81925e69f1.tar.gz GT5-Unofficial-ea5026c2d72eaf1e4d8a9bf14ef05d81925e69f1.tar.bz2 GT5-Unofficial-ea5026c2d72eaf1e4d8a9bf14ef05d81925e69f1.zip |
Power pass upgrade (#125)
* Implemented PowerPassUpgrade
* Fixes setBlock on adv. casings
* Configured code to use TecTech implementation of PowerPass
Co-authored-by: bartimaeusnek <no-email>
Former-commit-id: 83f241cf2df25e5d53fbfd510c549732ec851815
Diffstat (limited to 'src')
9 files changed, 443 insertions, 206 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index 228df30f2d..c5376dbf3b 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -83,6 +83,8 @@ public class BartWorksCrossmod { new TT_ImplosionCompressor(null,null); new TT_ElectronicBlastFurnace(null,null); new TT_MultiSmelter(null,null); + new TT_PyrolyseOven(null, null); + new BW_TT_HeatExchanger(null, null); } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java index 9643bd942d..28592e7802 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java @@ -170,7 +170,9 @@ public class BW_TT_HeatExchanger extends TT_Abstract_GT_Replacement { private void checkRecipe_Additions(float efficiency){ Materials m = null; - if (last == null || !mInputHotFluidHatch.getFluid().isFluidEqual(last.getPlasma(1))) { + if (last != null && mInputHotFluidHatch.getFluid().isFluidEqual(last.getPlasma(1))) { + m = last; + } else { for (Materials materials : Materials.values()) { if (mInputHotFluidHatch.getFluid().isFluidEqual(materials.getPlasma(1))) { last = m = materials; @@ -183,8 +185,6 @@ public class BW_TT_HeatExchanger extends TT_Abstract_GT_Replacement { } } } - else - m = last; if (m == null) return; @@ -358,7 +358,8 @@ public class BW_TT_HeatExchanger extends TT_Abstract_GT_Replacement { "1 - Cold Fluid Output", "2 - Hot Fluid Input", "Needs an additional Output Hatch", - "Needs an additional Input Hatch" + "Needs an additional Input Hatch", + "20 Casings at least!" }; @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java index 53ffab396f..ad7915aff0 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java @@ -10,6 +10,7 @@ import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; +import gregtech.api.util.GT_Recipe; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -32,12 +33,12 @@ public abstract class TT_Abstract_GT_Replacement extends GT_MetaTileEntity_Multi @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", ePowerPass,false,true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", this.ePowerPassCover, false, true); } @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, ePowerPass, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.ePowerPassCover, false, true); } @Override @@ -70,11 +71,11 @@ public abstract class TT_Abstract_GT_Replacement extends GT_MetaTileEntity_Multi return 0; } - private static final String[] sfStructureDescription = new String[] {"1 - Muffler"}; + protected void setEfficiencyAndOc(GT_Recipe gtRecipe) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; - @Override - public String[] getStructureDescription(ItemStack itemStack) { - return sfStructureDescription; + calculateOverclockedNessMulti(gtRecipe.mEUt, gtRecipe.mDuration, 1, getMaxInputVoltage()); } public final boolean addEBFInputsBottom(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -96,6 +97,8 @@ public abstract class TT_Abstract_GT_Replacement extends GT_MetaTileEntity_Multi return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java index 202b5207be..e4a2b0b300 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java @@ -236,38 +236,38 @@ public class TT_ElectronicBlastFurnace extends TT_Abstract_GT_Replacement_Coils ItemStack[] tInputs = this.getCompactedInputs(); FluidStack[] tFluids = this.getCompactedFluids(); - if (tInputs.length > 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))) { - return false; - } - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - int tHeatCapacityDivTiers = ((this.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; + if (tInputs.length <= 0) { + return false; } - 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 + || (this.mHeatingCapacity < tRecipe.mSpecialValue) + || (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + return false; + } + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + int tHeatCapacityDivTiers = ((this.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; } /** @@ -323,18 +323,18 @@ public class TT_ElectronicBlastFurnace extends TT_Abstract_GT_Replacement_Coils public String[] getInfoData() { int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (!isValidMetaTileEntity(tHatch)) - continue; - mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); + if (isValidMetaTileEntity(tHatch)) { + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); + } } long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (!isValidMetaTileEntity(tHatch)) - continue; - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + if (isValidMetaTileEntity(tHatch)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + } } return new String[]{ diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java index 3e614fb204..aec51a8d70 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java @@ -22,39 +22,30 @@ package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement; -import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.bartimaeusnek.crossmod.tectech.helper.StructureDefinitions; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.google.common.collect.ArrayListMultimap; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.*; -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 org.lwjgl.input.Keyboard; import java.util.List; -import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.*; +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_STR_CHECK; +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; public class TT_ImplosionCompressor extends TT_Abstract_GT_Replacement { @@ -101,28 +92,31 @@ public class TT_ImplosionCompressor extends TT_Abstract_GT_Replacement { ).build(); public final boolean addImplosionHatches(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity != null) { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - else - return false; - - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) - return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) - return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + if (aTileEntity == null) { + return false; } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + else + return false; + + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) + return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) + return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); return false; } @@ -193,39 +187,38 @@ public class TT_ImplosionCompressor extends TT_Abstract_GT_Replacement { 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[0]); - if (tInputList.size() > 0) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); - if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - //OC THAT EXPLOSIVE SHIT!!! - calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage()); - //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.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - sendLoopStart(SOUND_INDEX); - updateSlots(); - return true; - } + if (tInputList.size() <= 0) { + return false; } - return false; + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + if ((tRecipe == null) || (!tRecipe.isRecipeInputEqual(true, null, tInputs))) { + return false; + } + setEfficiencyAndOc(tRecipe); + //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.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + sendLoopStart(SOUND_INDEX); + updateSlots(); + return true; } @Override @@ -243,7 +236,8 @@ public class TT_ImplosionCompressor extends TT_Abstract_GT_Replacement { private static final String[] sfStructureDescription = new String[] { "0 - Air", - "Required: Muffler Hatch, Output Bus, Input Bus, Energy Hatch, Maintenance Hatch" + "Required: Muffler Hatch, Output Bus, Input Bus, Energy Hatch, Maintenance Hatch", + "16 Casings at least!" }; @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java index f0345a3330..d38f1800ba 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java @@ -183,16 +183,19 @@ public class TT_MultiSmelter extends TT_Abstract_GT_Replacement_Coils { 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; - } + for (ItemStack item : tInputList) { + if (!tSmeltStack.isItemEqual(item)) { + continue; + } + if (item.stackSize < (tMaxParrallel - tCurrenParrallel)) { + tCurrenParrallel += item.stackSize; + item.stackSize = 0; + } else { + item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel; + tCurrenParrallel = tMaxParrallel; + break; + } + } tCurrenParrallel *= tOutputStack.stackSize; this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1]; for (int i = 0; i < this.mOutputItems.length; i++) { diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java index fc37d7d2a2..8cdaaf581b 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java @@ -22,22 +22,14 @@ package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement; -import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.bartimaeusnek.crossmod.tectech.helper.CoilAdder; -import com.github.bartimaeusnek.crossmod.tectech.helper.IHasCoils; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.StructureDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; 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_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -45,13 +37,10 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; 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.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -75,9 +64,9 @@ public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils { private static final IStructureDefinition<TT_OilCrackingUnit> STRUCTURE_DEFINITION = StructureDefinition.<TT_OilCrackingUnit>builder().addShape("main", transpose(new String[][]{ - {"ABABA","ABGBA","ABABA"}, - {"AB~BA","E---F","ABABA"}, - {"ABABA","ABABA","ABABA"} + {"ABGBA","ABGBA","ABGBA"}, + {"AB~BA","E---F","ABGBA"}, + {"ABGBA","ABGBA","ABGBA"} }) ).addElement( 'A', @@ -119,10 +108,29 @@ public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils { ) ).addElement( 'G', - ofHatchAdder( - TT_OilCrackingUnit::addMiddleFluidHatch, - TEXTURE_INDEX, - 1 + ofChain( + ofHatchAdder( + TT_OilCrackingUnit::addMiddleFluidHatch, + TEXTURE_INDEX, + 3), + onElementPass( + x -> ++x.blocks, + ofBlock( + GregTech_API.sBlockCasings4, + 1 + ) + ), + ofHatchAdder( + TT_OilCrackingUnit::addClassicMaintenanceToMachineList, + TEXTURE_INDEX, + 1 + ), + ofHatchAdder( + TT_OilCrackingUnit::addEnergyIOToMachineList, + TEXTURE_INDEX, + 1 + ) + ) ).build(); @@ -130,7 +138,9 @@ public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils { "0 - Air", "1 - Input Hatch", "2 - Output Hatch", - "Required: Maintenance Hatch, Energy Hatch" + "3 - 1x Input Hatch, rest Casings, Maintenance Hatch or Energy Hatch", + "Required: Maintenance Hatch, Energy Hatch, at Position 3 or instead of Casings", + "18 Casings at least!" }; @Override @@ -240,23 +250,21 @@ public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCrakingRecipes.findRecipe( getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs , mInventory[1]); - if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage()); - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - this.mEUt *= Math.pow(0.95D, this.getCoilHeat().getTier()); - - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) { + return false; + } + setEfficiencyAndOc(tRecipe); + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + this.mEUt *= Math.pow(0.95D, this.getCoilHeat().getTier()); - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - return true; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); } - return false; + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + return true; } @Override @@ -265,19 +273,21 @@ public class TT_OilCrackingUnit extends TT_Abstract_GT_Replacement_Coils { 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))) - rList.add(tStack); + if (!isValidMetaTileEntity(tHatch) || tHatch.getFillableStack() == null) { + continue; } + FluidStack tStack = tHatch.getFillableStack(); + if (!tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) && !tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) + rList.add(tStack); } - if (this.middleFluidHatch != null && isValidMetaTileEntity(this.middleFluidHatch) && this.middleFluidHatch.getFillableStack() != null) { - this.middleFluidHatch.mRecipeMap = getRecipeMap(); - FluidStack tStack = this.middleFluidHatch.getFillableStack(); - if (tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) || tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) - rList.add(tStack); + if (this.middleFluidHatch == null || !isValidMetaTileEntity(this.middleFluidHatch) || this.middleFluidHatch.getFillableStack() == null) { + return rList; } + this.middleFluidHatch.mRecipeMap = getRecipeMap(); + FluidStack tStack = this.middleFluidHatch.getFillableStack(); + if (tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) || tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) + rList.add(tStack); return rList; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_PyrolyseOven.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_PyrolyseOven.java new file mode 100644 index 0000000000..43ec2f0dde --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_PyrolyseOven.java @@ -0,0 +1,232 @@ +package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement; + +import com.github.bartimaeusnek.crossmod.tectech.helper.CoilAdder; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +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.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.loaders.oreprocessing.ProcessingLog; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_STR_CHECK; +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT_BLUEPRINT; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; + +public class TT_PyrolyseOven extends TT_Abstract_GT_Replacement_Coils { + private static final int TEXTURE_INDEX = 1090; + private static final int pollutionPerTick = 30; + + public TT_PyrolyseOven(Object unused, Object unused2) { + super(1159, "multimachine.pyro", "Pyrolyse Oven"); + } + + public TT_PyrolyseOven(String aName) { + super(aName); + } + + private static final Block casingBlock; + private static final int casingMeta; + + private int blocks = 0; + + static { + if (Loader.isModLoaded("dreamcraft")) { + casingBlock = GameRegistry.findBlock("dreamcraft", "gt.blockcasingsNH"); + casingMeta = 2; + } else { + casingBlock = GregTech_API.sBlockCasings1; + casingMeta = 0; + } + } + + private static final IStructureDefinition<TT_PyrolyseOven> STRUCTURE_DEFINITION = StructureDefinition + .<TT_PyrolyseOven>builder() + .addShape("main", + transpose(new String[][]{ + {"AAAAA", "ACCCA", "ACCCA", "ACCCA", "AAAAA"}, + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"BB~BB", "BDDDB", "BDDDB", "BDDDB", "BBBBB"} + }) + ).addElement( + 'D', + CoilAdder.getINSTANCE() + ).addElement( + 'A', + onElementPass(x -> x.blocks++, + ofBlock( + casingBlock, + casingMeta + ) + ) + ).addElement( + 'B', + ofChain( + ofHatchAdder( + TT_PyrolyseOven::addClassicOutputToMachineList, TEXTURE_INDEX, + 1 + ), + ofHatchAdder( + TT_PyrolyseOven::addEnergyIOToMachineList, TEXTURE_INDEX, + 1 + ), + ofHatchAdder( + TT_PyrolyseOven::addClassicMaintenanceToMachineList, TEXTURE_INDEX, + 1 + ), + onElementPass(x -> x.blocks++, + ofBlock( + casingBlock, + casingMeta + ) + ) + ) + + ).addElement( + 'C', + ofChain( + ofHint(2), + ofHatchAdder( + TT_PyrolyseOven::addClassicInputToMachineList, TEXTURE_INDEX, + 2 + ), + ofHatchAdder( + TT_PyrolyseOven::addClassicMufflerToMachineList, TEXTURE_INDEX, + 2 + ), + onElementPass(x -> x.blocks++, + ofBlock( + casingBlock, + casingMeta + ) + ) + ) + + ) + .build(); + + @Override + public IStructureDefinition<TT_PyrolyseOven> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + @Override + protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + this.setCoilHeat(HeatingCoilLevel.None); + this.blocks = 0; + return this.structureCheck_EM("main", 2,3,0) && this.blocks >= 60; + } + + private static final String[] desc = new String[]{ + "Coke Oven", + "Controller block for the Pyrolyse Oven", + "Industrial Charcoal producer", + "Processing speed scales linearly with Coil tier:", + "CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.", + "EU/t is not affected by Coil tier", + "Creates up to: " + 20 * pollutionPerTick + " Pollution per Second", + ADV_STR_CHECK, + TT_BLUEPRINT + }; + + @Override + public String[] getDescription() { + return desc; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]}; + } + + @Override + public boolean checkRecipe_EM(ItemStack aStack) { + ItemStack[] tInputs = getCompactedInputs(); + FluidStack[] tFluids = getCompactedFluids(); + + if (tInputs.length <= 0) + return false; + + 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) + tRecipe = addRecipesDynamically(tInputs, tFluids, tTier); + + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) + return false; + setEfficiencyAndOc(tRecipe); + //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 + this.heatingCoilLevel.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; + } + + private GT_Recipe addRecipesDynamically(ItemStack[] tInputs, FluidStack[] tFluids, int tTier) { + if (tInputs.length <= 1 && (tInputs[0] == null || tInputs[0].getItem() == GT_Utility.getIntegratedCircuit(0).getItem())) { + return null; + } + int oreId = OreDictionary.getOreID("logWood"); + for (ItemStack is : tInputs) { + for (int id : OreDictionary.getOreIDs(is)) { + if (oreId == id) { + ProcessingLog.addPyrolyeOvenRecipes(is); + return GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + } + } + } + return null; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new TT_PyrolyseOven(this.mName); + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return pollutionPerTick; + } + + private static final String[] sfStructureDescription = new String[] { + "0 - Air", + "1 - Output Hatch, Output Bus, Energy Hatch, Maintenance Hatch, Casing", + "2 - Input Hatch, Input Bus, Muffler Hatch, Casing", + "60 Casings at least!" + }; + + @Override + public String[] getStructureDescription(ItemStack itemStack) { + return sfStructureDescription; + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + this.structureBuild_EM("main", 2,3,0, b, itemStack); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java index 16332b91ad..0b415a0d4c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java @@ -22,16 +22,11 @@ package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement; -import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.bartimaeusnek.crossmod.tectech.helper.StructureDefinitions; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -41,12 +36,9 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -145,24 +137,23 @@ public class TT_VacuumFreezer extends TT_Abstract_GT_Replacement { byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, tInput); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, tInput)) { - 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(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; - } + if (tRecipe == null) { + continue; } + if (!tRecipe.isRecipeInputEqual(true, null, tInput)) { + continue; + } + setEfficiencyAndOc(tRecipe); + //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(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + updateSlots(); + return true; } return false; } @@ -178,26 +169,27 @@ public class TT_VacuumFreezer extends TT_Abstract_GT_Replacement { } public final boolean addVacuumFreezerHatches(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity != null) { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - else - return false; - - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) - return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) - return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + if (aTileEntity == null) { + return false; } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + else + return false; + + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) + return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) + return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); return false; } } |