diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-13 17:58:06 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-13 17:58:06 +0000 |
commit | 741e8427a9f4e9bee4768e44fa88df832e825e95 (patch) | |
tree | 98fd64acf29cba8def71d01c51956e5bc2309192 /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 394d6a29a42bd4a9005c13b3f00284fd2bb6b9f4 (diff) | |
download | GT5-Unofficial-741e8427a9f4e9bee4768e44fa88df832e825e95.tar.gz GT5-Unofficial-741e8427a9f4e9bee4768e44fa88df832e825e95.tar.bz2 GT5-Unofficial-741e8427a9f4e9bee4768e44fa88df832e825e95.zip |
+ Added support for TecTech Multi-Amp Energy Hatches. Closes #565.
$ Fixed COMET behaving like a Fusion Reactor. No more weird power usage/output.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java | 82 |
1 files changed, 70 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index f41efe602a..50c3c42600 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -99,9 +99,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult try { calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) {} - - mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>(); + } + catch (NoSuchMethodException | SecurityException e) {} } @@ -121,7 +120,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>(); // Custom Behaviour Map - private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours; + private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>();; public GregtechMeta_MultiBlockBase(final int aID, final String aName, @@ -1034,7 +1033,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult */ // First populate the map if we need to. - if (mCustomBehviours == null || mCustomBehviours.isEmpty()) { + if (mCustomBehviours.isEmpty()) { mCustomBehviours.putAll(Multiblock_API.getSpecialBehaviourItemMap()); } @@ -1553,7 +1552,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult this.mDischargeHatches.clear(); this.mControlCoreBus.clear(); this.mAirIntakes.clear(); - this.mMultiDynamoHatches.clear(); + this.mTecTechEnergyHatches.clear(); + this.mTecTechDynamoHatches.clear(); } } @@ -1578,7 +1578,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult tTileEntity = localIterator.next(); } tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mMultiDynamoHatches + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechDynamoHatches + .iterator(); localIterator.hasNext(); tTileEntity + .getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { + tTileEntity = localIterator.next(); + } + tTileEntity = null; + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechEnergyHatches .iterator(); localIterator.hasNext(); tTileEntity .getBaseMetaTileEntity() .doExplosion(gregtech.api.enums.GT_Values.V[8])) { @@ -1873,7 +1880,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult //Handle TT Multi-A Dynamos else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) { log("Found isThisHatchMultiDynamo"); - aDidAdd = addToMachineListInternal(mMultiDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); } //Handle Fluid Hatches using seperate logic @@ -2126,10 +2133,16 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult /** - * This is the array Used to Store the Tectech Multi-Amp hatches. + * This is the array Used to Store the Tectech Multi-Amp Dynamo hatches. + */ + + public ArrayList<GT_MetaTileEntity_Hatch> mTecTechDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); + + /** + * This is the array Used to Store the Tectech Multi-Amp Energy hatches. */ - public ArrayList<GT_MetaTileEntity_Hatch> mMultiDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); + public ArrayList<GT_MetaTileEntity_Hatch> mTecTechEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); /** * TecTech Multi-Amp Dynamo Support @@ -2149,12 +2162,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } if (isThisHatchMultiDynamo(aTileEntity)) { updateTexture(aTileEntity, aBaseCasingIndex); - return this.mMultiDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + return this.mTecTechDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); } return false; } - @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); @@ -2176,6 +2188,52 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); } + + + /** + * TecTech Multi-Amp Energy Hatch Support + * @param aTileEntity - The Energy Hatch + * @param aBaseCasingIndex - Casing Texture + * @return + */ + + public boolean addMultiAmpEnergyToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex){ + //GT_MetaTileEntity_Hatch_DynamoMulti + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (isThisHatchMultiEnergy(aTileEntity)) { + updateTexture(aTileEntity, aBaseCasingIndex); + return this.mTecTechEnergyHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + } + return false; + } + + public boolean isThisHatchMultiEnergy(Object aMetaTileEntity){ + Class<?> mDynamoClass; + mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(aMetaTileEntity)){ + return true; + } + } + return false; + } + + @Override + public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (LoadedMods.TecTech){ + if (isThisHatchMultiDynamo(aTileEntity)) { + addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); + } + + } + return super.addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); + } /** |