diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-15 12:26:48 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-15 12:26:48 +1000 |
commit | 51bf52ffba6d4f4b31f0c2caf8a809bd5695c8dc (patch) | |
tree | 11f0c47804adc1e27c6e553487f3b22d007aaa5d /src/Java/gtPlusPlus | |
parent | 9d7b0cbc44d88cc757b3539077c9925daf1e38d1 (diff) | |
parent | 0b65e63e3705fc9ead2ddcb71e9da4ad808a2959 (diff) | |
download | GT5-Unofficial-51bf52ffba6d4f4b31f0c2caf8a809bd5695c8dc.tar.gz GT5-Unofficial-51bf52ffba6d4f4b31f0c2caf8a809bd5695c8dc.tar.bz2 GT5-Unofficial-51bf52ffba6d4f4b31f0c2caf8a809bd5695c8dc.zip |
Merge branch 'master' of https://github.com/draknyte1/GTplusplus
Diffstat (limited to 'src/Java/gtPlusPlus')
6 files changed, 148 insertions, 20 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 21ba73c1cb..5306b2610c 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -41,7 +41,7 @@ import net.minecraft.launchwrapper.Launch; import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") -@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO;") +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; beyondrealitycore;") public class GTplusplus implements ActionListener { //Mod Instance @@ -71,11 +71,11 @@ public class GTplusplus implements ActionListener { public void preInit(final FMLPreInitializationEvent event) { Utils.LOG_INFO("Loading " + CORE.name + " V" + CORE.VERSION); - //Get Graphics Mode. - CORE.mFancyGraphics = Minecraft.isFancyGraphicsEnabled(); if(!Utils.isServer()){ enableCustomCapes = true; + //Get Graphics Mode. + CORE.mFancyGraphics = Minecraft.isFancyGraphicsEnabled(); } //Give this a go mate. diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index c7bf277974..78b7cf4326 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -10,6 +10,8 @@ import java.util.concurrent.ConcurrentHashMap; import com.mojang.authlib.GameProfile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.Pair; @@ -44,7 +46,8 @@ public class CORE { public static boolean DEVENV = false; public static boolean DEBUG = false; - public static boolean mFancyGraphics; + @SideOnly(Side.CLIENT) + public static boolean mFancyGraphics = false; //Only can be set in Dev, no config or setting elsewhere. public static final boolean LOAD_ALL_CONTENT = false;; diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index d93e5acdfc..c807d8f03c 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -47,7 +47,8 @@ public class LoadedMods { public static boolean PamsHarvestcraft = false; public static boolean GalacticraftCore = false; public static boolean Mekanism = false; - public static boolean RedTech = false; + public static boolean RedTech = false; //RedMage's Mod + public static boolean TecTech = false; //Technus' Mod @@ -248,14 +249,19 @@ public class LoadedMods { Utils.LOG_INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); totalMods++; } + else { + Utils.LOG_INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); + } if (Loader.isModLoaded("GTRedtech") == true){ RedTech = true; Utils.LOG_INFO("Components enabled for: GTRedtech"); totalMods++; } - else { - Utils.LOG_INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); - } + if (Loader.isModLoaded("tectech") == true){ + TecTech = true; + Utils.LOG_INFO("Components enabled for: TecTech"); + totalMods++; + } Utils.LOG_INFO("Content found for "+totalMods+" mods"); 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 1fe2426ced..5d8e2dd933 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 @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; @@ -12,6 +14,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_Recipe; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; @@ -223,13 +226,23 @@ GT_MetaTileEntity_MultiBlockBase { } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { + updateTexture(aBaseCasingIndex); return this.mChargeHatches.add( (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { + updateTexture(aBaseCasingIndex); return this.mDischargeHatches.add( (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity); } + if (LoadedMods.TecTech){ + if (isThisHatchMultiDynamo()) { + updateTexture(aBaseCasingIndex); + return this.mMultiDynamoHatches.add( + (GT_MetaTileEntity_Hatch) aMetaTileEntity); + } + + } return super.addToMachineList(aTileEntity, aBaseCasingIndex); } @@ -243,8 +256,7 @@ GT_MetaTileEntity_MultiBlockBase { return false; } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { - //((GT_MetaTileEntity_Hatch) aMetaTileEntity); - //.updateTexture(aBaseCasingIndex); + updateTexture(aBaseCasingIndex); return this.mChargeHatches.add( (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity); } @@ -261,8 +273,7 @@ GT_MetaTileEntity_MultiBlockBase { return false; } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { - //((GT_MetaTileEntity_Hatch) aMetaTileEntity) - //.updateTexture(aBaseCasingIndex); + updateTexture(aBaseCasingIndex); return this.mDischargeHatches.add( (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity); } @@ -279,7 +290,7 @@ GT_MetaTileEntity_MultiBlockBase { return false; } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - //((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + updateTexture(aBaseCasingIndex); ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); } @@ -295,10 +306,96 @@ GT_MetaTileEntity_MultiBlockBase { return false; } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - //((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + updateTexture(aBaseCasingIndex); return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); } return false; } + + /** + * Enable Texture Casing Support if found in GT 5.09 + */ + + public boolean updateTexture(int aCasingID){ + try { + Method mProper = Class.forName("gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch").getDeclaredMethod("updateTexture", int.class); + if (mProper != null){ + mProper.setAccessible(true); + mProper.invoke(this, aCasingID); + } + else { + return false; + } + } + catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} + return false; + } + + + + + + + + + + /** + * TecTech Support + */ + + + /** + * This is the array Used to Store the Tectech Multi-Amp hatches. + */ + + public ArrayList<GT_MetaTileEntity_Hatch> mMultiDynamoHatches = new ArrayList(); + + /** + * TecTech Multi-Amp Dynamo Support + * @param aTileEntity - The Dynamo Hatch + * @param aBaseCasingIndex - Casing Texture + * @return + */ + + public boolean addMultiAmpDynamoToMachineList(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 (isThisHatchMultiDynamo()) { + updateTexture(aBaseCasingIndex); + return this.mMultiDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + } + return false; + } + + public boolean isThisHatchMultiDynamo(){ + Class mDynamoClass; + try { + mDynamoClass = Class.forName("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(this)){ + return true; + } + } + } + catch (ClassNotFoundException e) {} + return false; + } + + @Override + public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (LoadedMods.TecTech){ + if (isThisHatchMultiDynamo()) { + addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); + } + + } + return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java index eb7b1eb712..a6b3944a06 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java @@ -6,12 +6,12 @@ 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.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; @@ -22,7 +22,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -public class GregtechMetaTileEntityGeneratorArray extends GT_MetaTileEntity_MultiBlockBase { +public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase { GT_Recipe mLastRecipe; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java index a163215459..54365f63d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; import java.util.concurrent.TimeUnit; import gregtech.api.GregTech_API; @@ -8,12 +9,14 @@ 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.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Config; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; @@ -34,6 +37,9 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe protected long mTotalEnergyConsumed = 0; protected long mTotalEnergyLost = 0; protected long mTotalRunTime = 0; + + //TecTech Support + public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList(); public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -246,14 +252,30 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } } } + + /** + * TecTech Support, this allows adding Multi-Amp dynamos. + */ + if (this.mDynamoHatches.size() > 0){ + for (GT_MetaTileEntity_Hatch_Dynamo o : this.mDynamoHatches){ + mAllDynamoHatches.add(o); + } + } + if (LoadedMods.TecTech && this.mMultiDynamoHatches.size() > 0){ + for (GT_MetaTileEntity_Hatch o : this.mMultiDynamoHatches){ + mAllDynamoHatches.add(o); + } + } + + if ((this.mChargeHatches.size() < 1) || (this.mDischargeHatches.size() < 1) || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1) - || (this.mDynamoHatches.size() < 1)) { + || (this.mAllDynamoHatches.size() < 1)) { Utils.LOG_MACHINE_INFO("Returned False 3"); Utils.LOG_MACHINE_INFO("Charge Buses: "+this.mChargeHatches.size()+" | expected: 1 | "+(this.mChargeHatches.size() != 1)); Utils.LOG_MACHINE_INFO("Discharge Buses: "+this.mDischargeHatches.size()+" | expected: 1 | "+(this.mDischargeHatches.size() != 1)); Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() < 1)); - Utils.LOG_MACHINE_INFO("Dynamo Hatches: "+this.mDynamoHatches.size()+" | expected: >= 1 | "+(this.mDynamoHatches.size() < 1)); + Utils.LOG_MACHINE_INFO("Dynamo Hatches: "+this.mAllDynamoHatches.size()+" | expected: >= 1 | "+(this.mAllDynamoHatches.size() < 1)); Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1)); return false; } @@ -265,7 +287,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe tempAvg += re.getInputTier(); hatchCount++; } - for (GT_MetaTileEntity_Hatch_Dynamo re : this.mDynamoHatches){ + for (GT_MetaTileEntity_Hatch re : this.mAllDynamoHatches){ tempAvg += re.getOutputTier(); hatchCount++; } @@ -493,7 +515,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } hatchCount++; } - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { + for (GT_MetaTileEntity_Hatch tHatch : this.mAllDynamoHatches) { //Utils.LOG_INFO("Storing Power in a Dynamo Hatch"); if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.getOutputTier()*2, false))) { this.setEUVar(this.getEUVar()-(tHatch.getOutputTier()*2)); |