From 6d9c73a70a6374f3619e0ba9648ec64f6bdd784e Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sat, 3 Oct 2015 15:23:52 +0200 Subject: Update version 5.08.30 --- main/java/gregtech/GT_Mod.java | 5 +- main/java/gregtech/api/enums/Materials.java | 2 +- .../GT_MetaTileEntity_MultiBlockBase.java | 12 +- main/java/gregtech/api/util/GT_Utility.java | 15 + main/java/gregtech/common/GT_Proxy.java | 1 + .../common/covers/GT_Cover_SolarPanel.java | 2 +- .../automation/GT_MetaTileEntity_TypeFilter.java | 55 +- .../GT_MetaTileEntity_MagicalEnergyAbsorber.java | 7 +- .../basic/GT_MetaTileEntity_Boxinator.java | 6 +- .../multi/GT_MetaTileEntity_FusionComputer.java | 746 +++++++++++---------- .../multi/GT_MetaTileEntity_LargeTurbine.java | 3 +- .../GT_MetaTileEntity_LargeTurbine_HPSteam.java | 6 + .../GT_MetaTileEntity_LargeTurbine_Plasma.java | 6 +- .../GT_MetaTileEntity_LargeTurbine_Steam.java | 7 + .../multi/GT_MetaTileEntity_ProcessingArray.java | 7 + .../gregtech/loaders/misc/GT_Achievements.java | 2 + .../loaders/oreprocessing/ProcessingNugget.java | 7 + .../loaders/oreprocessing/ProcessingWire01.java | 9 + .../loaders/oreprocessing/ProcessingWire02.java | 8 + .../loaders/oreprocessing/ProcessingWire04.java | 8 + .../loaders/oreprocessing/ProcessingWire08.java | 8 + .../loaders/oreprocessing/ProcessingWire12.java | 10 +- .../loaders/oreprocessing/ProcessingWire16.java | 7 + .../loaders/postload/GT_CraftingRecipeLoader.java | 9 +- .../loaders/postload/GT_MachineRecipeLoader.java | 51 +- .../preload/GT_Loader_Item_Block_And_Fluid.java | 4 +- 26 files changed, 592 insertions(+), 411 deletions(-) (limited to 'main/java') diff --git a/main/java/gregtech/GT_Mod.java b/main/java/gregtech/GT_Mod.java index ecf34dedc3..9dca7996fc 100644 --- a/main/java/gregtech/GT_Mod.java +++ b/main/java/gregtech/GT_Mod.java @@ -306,8 +306,9 @@ public class GT_Mod gregtechproxy.mNerfedWoodPlank = tMainConfig.get("general", "WoodNeedsSawForCrafting", true).getBoolean(true); gregtechproxy.mNerfedVanillaTools = tMainConfig.get("general", "smallerVanillaToolDurability", true).getBoolean(true); gregtechproxy.mSortToTheEnd = tMainConfig.get("general", "EnsureToBeLoadedLast", true).getBoolean(true); - gregtechproxy.mDisableIC2Cables = tMainConfig.get("general", "DisableIC2Cables", false).getBoolean(false); - gregtechproxy.mAchievements = tMainConfig.get("general", "EnableAchievements", true).getBoolean(true); + gregtechproxy.mDisableIC2Cables = tMainConfig.get("general", "DisableIC2Cables", false).getBoolean(false); + gregtechproxy.mAchievements = tMainConfig.get("general", "EnableAchievements", true).getBoolean(true); + gregtechproxy.mAE2Integration = tMainConfig.get("general", "EnableAE2Integration", Loader.isModLoaded("appliedenergistics2")).getBoolean(Loader.isModLoaded("appliedenergistics2")); GregTech_API.mOutputRF =GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", false); diff --git a/main/java/gregtech/api/enums/Materials.java b/main/java/gregtech/api/enums/Materials.java index c38728b8c7..9b6caca1f7 100644 --- a/main/java/gregtech/api/enums/Materials.java +++ b/main/java/gregtech/api/enums/Materials.java @@ -166,7 +166,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { PhasedIron ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Phased Iron" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), PhasedGold ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Phased Gold" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), Soularium ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Soularium" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), - Endium ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Endium" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), + Endium ( 770, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 |8 , 165, 220, 250, 0, "Endium" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes.dyeYellow ), Prismarine ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |4 , 255, 255, 255, 0, "Prismarine" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), GraveyardDirt ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Graveyard Dirt" , 0, 0, -1, 0, F, F, 3, 1, 1, Dyes._NULL ), DarkSteel ( 364, TextureSet.SET_DULL , 8.0F, 512, 3, 1|2 |8 |64 , 80, 70, 80, 0, "Dark Steel" , 0, 0, 1811, 0, F, F, 5, 1, 1, Dyes.dyePurple ), diff --git a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 3bf171f434..77fc590ce1 100644 --- a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -30,7 +30,7 @@ import net.minecraftforge.fluids.FluidStack; public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false; + public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; public ItemStack[] mOutputItems = null; public FluidStack[] mOutputFluids = null; @@ -83,6 +83,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mOutputItems[i].writeToNBT(tNBT); aNBT.setTag("mOutputItem"+i, tNBT); } + if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) if (mOutputFluids[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids"+i, tNBT); + } aNBT.setBoolean("mWrench", mWrench); aNBT.setBoolean("mScrewdriver", mScrewdriver); @@ -97,13 +102,16 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mEUt = aNBT.getInteger("mEUt"); mProgresstime = aNBT.getInteger("mProgresstime"); mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + if(mMaxProgresstime>0)mRunningOnLoad=true; mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); mEfficiency = aNBT.getInteger("mEfficiency"); mPollution = aNBT.getInteger("mPollution"); mRuntime = aNBT.getInteger("mRuntime"); mOutputItems = new ItemStack[getAmountOfOutputs()]; for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mWrench = aNBT.getBoolean("mWrench"); + mOutputFluids = new FluidStack[getAmountOfOutputs()]; + for (int i = 0; i < mOutputFluids.length; i++) mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + mWrench = aNBT.getBoolean("mWrench"); mScrewdriver = aNBT.getBoolean("mScrewdriver"); mSoftHammer = aNBT.getBoolean("mSoftHammer"); mHardHammer = aNBT.getBoolean("mHardHammer"); diff --git a/main/java/gregtech/api/util/GT_Utility.java b/main/java/gregtech/api/util/GT_Utility.java index fea00321ab..0ae3da3909 100644 --- a/main/java/gregtech/api/util/GT_Utility.java +++ b/main/java/gregtech/api/util/GT_Utility.java @@ -1408,6 +1408,13 @@ public class GT_Utility { return loadItem(aNBT.getCompoundTag(aTagName)); } + /** + * Loads an ItemStack properly. + */ + public static FluidStack loadFluid(NBTTagCompound aNBT, String aTagName) { + return loadFluid(aNBT.getCompoundTag(aTagName)); + } + /** * Loads an ItemStack properly. */ @@ -1424,6 +1431,14 @@ public class GT_Utility { return GT_OreDictUnificator.get(T, rStack); } + /** + * Loads an ItemStack properly. + */ + public static FluidStack loadFluid(NBTTagCompound aNBT) { + if (aNBT == null) return null; + return FluidStack.loadFluidStackFromNBT(aNBT); + } + public static E selectItemInList(int aIndex, E aReplacement, List aList) { if (aList == null || aList.isEmpty()) return aReplacement; if (aList.size() <= aIndex) return aList.get(aList.size() - 1); diff --git a/main/java/gregtech/common/GT_Proxy.java b/main/java/gregtech/common/GT_Proxy.java index 8698d53189..5e6e2498c5 100644 --- a/main/java/gregtech/common/GT_Proxy.java +++ b/main/java/gregtech/common/GT_Proxy.java @@ -151,6 +151,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public boolean mIgnoreTcon = true; public boolean mDisableIC2Cables = false; public boolean mAchievements = true; + public boolean mAE2Integration = true; public int mSkeletonsShootGTArrows = 16; public int mMaxEqualEntitiesAtOneSpot = 3; public int mFlintChance = 30; diff --git a/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java b/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java index 308df2f129..8ad8359708 100644 --- a/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java +++ b/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java @@ -25,7 +25,7 @@ public class GT_Cover_SolarPanel else { boolean bRain = (aTileEntity.getWorld().isRaining()) && (aTileEntity.getBiome().rainfall > 0.0F); - aCoverVariable = ((!bRain) || (aTileEntity.getWorld().skylightSubtracted < 4)) && (aTileEntity.getSkyAtSide(aSide)) ? 1 : (bRain) || (!aTileEntity.getWorld().isDaytime()) ? 2 : 0; + aCoverVariable = bRain && aTileEntity.getWorld().skylightSubtracted >= 4 || !aTileEntity.getSkyAtSide(aSide) ? 0 : ((int) (!bRain && aTileEntity.getWorld().isDaytime() ? 1 : 2)); } } if ((aCoverVariable == 1) || ((aCoverVariable == 2) && (aTimer % 8L == 0L))) { diff --git a/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index fd2a31fd1d..90acb38dd4 100644 --- a/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.automation; +import gregtech.api.enums.OreDictNames; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; @@ -8,6 +9,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_TypeFilter; import gregtech.common.gui.GT_GUIContainer_TypeFilter; @@ -71,17 +74,22 @@ public class GT_MetaTileEntity_TypeFilter { if (aRightClick) { + do{ i--; if (i < 0) { i = OrePrefixes.values().length - 1; } + }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty()); + } else { + do{ i++; if (i >= OrePrefixes.values().length) { i = 0; } + }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty()); } if(!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i]) mPrefix = OrePrefixes.values()[i]; @@ -94,21 +102,21 @@ public class GT_MetaTileEntity_TypeFilter public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) { - if (this.mPrefix.mPrefixedItems.isEmpty()) - { - this.mInventory[9] = null; - } - else - { - Object[] tmp63_60 = new Object[1]; int tmp90_89 = ((this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size());this.mRotationIndex = tmp90_89;tmp63_60[0] = this.mPrefix.mPrefixedItems.get(tmp90_89);this.mInventory[9] = GT_Utility.copyAmount(1L, tmp63_60); - if (this.mInventory[9].getItemDamage() == 32767) { - this.mInventory[9].setItemDamage(0); - } - this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); - } - } + super.onPreTick(aBaseMetaTileEntity, aTick); + if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) { + if (this.mPrefix.mPrefixedItems.isEmpty()) + { + this.mInventory[9] = null; + } + else + { + this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[] { this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()) }); + if (this.mInventory[9].getItemDamage() == 32767) { + this.mInventory[9].setItemDamage(0); + } + this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); + } + } } public void saveNBTData(NBTTagCompound aNBT) @@ -129,7 +137,22 @@ public class GT_MetaTileEntity_TypeFilter public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (this.mPrefix.contains(aStack) != this.bInvertFilter); + boolean tAllowPrefix = this.mPrefix.contains(aStack); + if(this.mPrefix==OrePrefixes.ore){ + OrePrefixes tFix = GT_OreDictUnificator.getItemData(aStack).mPrefix; + if(tFix==OrePrefixes.oreBlackgranite|| + tFix==OrePrefixes.oreDense|| + tFix==OrePrefixes.oreEnd|| + tFix==OrePrefixes.oreEndstone|| + tFix==OrePrefixes.oreNether|| + tFix==OrePrefixes.oreNetherrack|| + tFix==OrePrefixes.oreNormal|| + tFix==OrePrefixes.orePoor|| + tFix==OrePrefixes.oreRedgranite|| + tFix==OrePrefixes.oreRich|| + tFix==OrePrefixes.oreSmall)tAllowPrefix=true; + } + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter); } } diff --git a/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 5791e7605b..18add4535b 100644 --- a/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -101,7 +101,12 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B if ((mActiveSiphon == null) || (mActiveSiphon.getBaseMetaTileEntity() == null) || (mActiveSiphon.getBaseMetaTileEntity().isInvalidTileEntity()) || (!mActiveSiphon.hasEgg())) { mActiveSiphon = this; } else { - getBaseMetaTileEntity().doExplosion(Integer.MAX_VALUE); + Block tEgg = mActiveSiphon.getBaseMetaTileEntity().getBlockOffset(0, 1, 0); + if(!getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(mActiveSiphon.getBaseMetaTileEntity().getXCoord(), mActiveSiphon.getBaseMetaTileEntity().getZCoord()).isChunkLoaded&&(tEgg==Blocks.dragon_egg||tEgg.getUnlocalizedName().equals("tile.dragonEgg"))) + {getBaseMetaTileEntity().doExplosion(Integer.MAX_VALUE);}else{ + mActiveSiphon=this; + } + } } } diff --git a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index c56f03e38e..23b9d74fb7 100644 --- a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -14,6 +14,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine @@ -97,7 +98,10 @@ public class GT_MetaTileEntity_Boxinator if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) || (ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) || (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)))) { - return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[this.mTier], null, new ItemStack[] { GT_Utility.copyAmount(64L, new Object[] { aStack }), getInputAt(1) }) != null; + if(GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[this.mTier], null, new ItemStack[] { GT_Utility.copyAmount(64L, new Object[] { aStack }), getInputAt(1) }) != null){return true;} + if(ItemList.Schematic_1by1.isStackEqual(getInputAt(1))&>_ModHandler.getRecipeOutput(new ItemStack[] { aStack })!=null)return true; + if(ItemList.Schematic_2by2.isStackEqual(getInputAt(1))&>_ModHandler.getRecipeOutput(new ItemStack[] { aStack, aStack, null, aStack, aStack })!=null){return true;} + if(ItemList.Schematic_3by3.isStackEqual(getInputAt(1))&&(GT_ModHandler.getRecipeOutput(new ItemStack[] { aStack,aStack,aStack,aStack,aStack,aStack,aStack,aStack,aStack })!=null)){return true;} }else{return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);} } return false; diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index f402e730db..9a835e625f 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -6,6 +6,7 @@ import java.util.Arrays; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -24,415 +25,422 @@ import gregtech.api.util.GT_Utility; import gregtech.api.metatileentity.implementations.*; import gregtech.common.gui.GT_GUIContainer_FusionReactor; import net.minecraft.block.Block; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -public abstract class GT_MetaTileEntity_FusionComputer - extends GT_MetaTileEntity_MultiBlockBase -{ - - public GT_Recipe mLastRecipe; - public int mEUStore; - public GT_MetaTileEntity_FusionComputer(int aID, String aName, String aNameRegional, int tier) - { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_FusionComputer(String aName) - { - super(aName); - } - public abstract int tier(); - - public abstract long maxEUStore(); - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } +public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_MultiBlockBase { + + public GT_Recipe mLastRecipe; + public int mEUStore; + + public GT_MetaTileEntity_FusionComputer(int aID, String aName, String aNameRegional, int tier) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_FusionComputer(String aName) { + super(aName); + } + + public abstract int tier(); + + public abstract long maxEUStore(); + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_FusionReactor(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "FusionComputer.png"); + } + + public abstract MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); + + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + + return aSide != getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_FusionReactor(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "FusionComputer.png"); + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xCenter = getBaseMetaTileEntity().getXCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX * 5; + int yCenter = getBaseMetaTileEntity().getYCoord(); + int zCenter = getBaseMetaTileEntity().getZCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ * 5; + if (((isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter)) || (xCenter + 5 == getBaseMetaTileEntity().getXCoord())) + && ((isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter)) || (xCenter - 5 == getBaseMetaTileEntity().getXCoord())) + && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter + 5)) || (zCenter + 5 == getBaseMetaTileEntity().getZCoord())) + && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter - 5)) || (zCenter - 5 == getBaseMetaTileEntity().getZCoord())) && (checkCoils(xCenter, yCenter, zCenter)) + && (checkHulls(xCenter, yCenter, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter + 1, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter - 1, zCenter)) + && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 3, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 5, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 3, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 5, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter + 4, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter + 4, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter - 4, aBaseMetaTileEntity)) + && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter - 4, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter + 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 5, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter - 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 5, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter + 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 7, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter - 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 7, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter + 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 5, yCenter, zCenter + 1, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter - 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 5, yCenter, zCenter + 1, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter + 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 7, yCenter, zCenter + 1, aBaseMetaTileEntity)) + && (addIfExtractor(xCenter - 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 7, yCenter, zCenter + 1, aBaseMetaTileEntity)) + && (addIfInjector(xCenter + 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity)) + && (addIfInjector(xCenter + 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity)) + && (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) + && (this.mEnergyHatches.size() >= 1) && (this.mOutputHatches.size() >= 1) && (this.mInputHatches.size() >= 2)) { + if (this.mEnergyHatches != null) { + for (int i = 0; i < this.mEnergyHatches.size(); i++) { + if (this.mEnergyHatches.get(i).mTier < tier()) + return false; } - - public abstract MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); - - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) - { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); + } + if (this.mOutputHatches != null) { + for (int i = 0; i < this.mOutputHatches.size(); i++) { + if (this.mOutputHatches.get(i).mTier < tier()) + return false; } - - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); + } + if (this.mInputHatches != null) { + for (int i = 0; i < this.mInputHatches.size(); i++) { + if (this.mInputHatches.get(i).mTier < tier()) + return false; } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity,ItemStack aStack) { - int xCenter = getBaseMetaTileEntity().getXCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX * 5;int yCenter = getBaseMetaTileEntity().getYCoord();int zCenter = getBaseMetaTileEntity().getZCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ * 5; - if (((isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter)) || (xCenter + 5 == getBaseMetaTileEntity().getXCoord())) && - ((isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter)) || (xCenter - 5 == getBaseMetaTileEntity().getXCoord())) && - ((isAdvancedMachineCasing(xCenter, yCenter, zCenter + 5)) || (zCenter + 5 == getBaseMetaTileEntity().getZCoord())) && - ((isAdvancedMachineCasing(xCenter, yCenter, zCenter - 5)) || (zCenter - 5 == getBaseMetaTileEntity().getZCoord())) && - (checkCoils(xCenter, yCenter, zCenter)) && - (checkHulls(xCenter, yCenter, zCenter)) && - (checkUpperOrLowerHulls(xCenter, yCenter + 1, zCenter)) && - (checkUpperOrLowerHulls(xCenter, yCenter - 1, zCenter)) && - (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 3,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 3,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 5,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 5,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 3,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 3,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 5,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 5,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 3, yCenter, zCenter + 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 3, yCenter, zCenter + 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 5, yCenter, zCenter + 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 5, yCenter, zCenter + 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 3, yCenter, zCenter - 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 3, yCenter, zCenter - 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter + 5, yCenter, zCenter - 4,aBaseMetaTileEntity)) && - (addIfEnergyInjector(xCenter - 5, yCenter, zCenter - 4,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 1, yCenter, zCenter - 5,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 1, yCenter, zCenter + 5,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 1, yCenter, zCenter - 5,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 1, yCenter, zCenter + 5,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 1, yCenter, zCenter - 7,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 1, yCenter, zCenter + 7,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 1, yCenter, zCenter - 7,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 1, yCenter, zCenter + 7,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 5, yCenter, zCenter - 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 5, yCenter, zCenter + 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 5, yCenter, zCenter - 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 5, yCenter, zCenter + 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 7, yCenter, zCenter - 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter + 7, yCenter, zCenter + 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 7, yCenter, zCenter - 1,aBaseMetaTileEntity)) && - (addIfExtractor(xCenter - 7, yCenter, zCenter + 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 1, yCenter + 1, zCenter - 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 1, yCenter + 1, zCenter + 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 1, yCenter + 1, zCenter - 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 1, yCenter + 1, zCenter + 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 6, yCenter + 1, zCenter + 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 6, yCenter + 1, zCenter + 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 6, yCenter + 1, zCenter - 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 6, yCenter + 1, zCenter - 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 1, yCenter - 1, zCenter - 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 1, yCenter - 1, zCenter + 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 1, yCenter - 1, zCenter - 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 1, yCenter - 1, zCenter + 6,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 6, yCenter - 1, zCenter + 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 6, yCenter - 1, zCenter + 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1,aBaseMetaTileEntity)) && - (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1,aBaseMetaTileEntity)) && - (this.mEnergyHatches.size()>=1)&& - (this.mOutputHatches.size()>=1)&& - (this.mInputHatches.size()>=2)) { - if(this.mEnergyHatches!=null){ - for(int i = 0;i < this.mEnergyHatches.size();i++){ - if(this.mEnergyHatches.get(i).mTier list){ - if(list!=null){ - for(int i = 0;i < list.size();i++){ - if(list.get(i).mTier=this.mLastRecipe.mFluidInputs[0].amount){ - for(GT_MetaTileEntity_Hatch_Input tInput2 : this.mInputHatches){ - if(tInput2.mFluid!=null&& tInput2.mFluid!=null&&tInput2.mFluid.getFluid().getID()==this.mLastRecipe.mFluidInputs[1].getFluid().getID()&&tInput2.mFluid.amount>=this.mLastRecipe.mFluidInputs[1].amount&&getMaxInputVoltage()>=this.mLastRecipe.mEUt){ - tInput.drain(this.mLastRecipe.mFluidInputs[0].amount, true); - tInput2.drain(this.mLastRecipe.mFluidInputs[1].amount, true); - this.mEUt = (this.mLastRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); - this.mMaxProgresstime = this.mLastRecipe.mDuration/overclock(this.mLastRecipe.mEUt); - this.mEfficiencyIncrease = 10000; - this.mOutputFluids = this.mLastRecipe.mFluidOutputs; - turnCasingActive(true); - return true; - } + + private boolean checkTier(byte tier, ArrayList list) { + if (list != null) { + for (int i = 0; i < list.size(); i++) { + if (list.get(i).mTier < tier) { + return false; } } } + return true; } - this.mLastRecipe=null; - turnCasingActive(false); - for (GT_Recipe tRecipe : GT_Recipe.GT_Recipe_Map.sFusionRecipes.mRecipeList){ - FluidStack tFluid = tRecipe.mFluidInputs[0]; - if(tFluid!=null){ - for(GT_MetaTileEntity_Hatch_Input tInput : this.mInputHatches){ - if(tFluid.getFluid() !=null&& tInput.getFluid()!=null && tFluid.getFluid().getID()==tInput.getFluid().getFluid().getID()&&tFluid.amount<=tInput.getFluid().amount){ - FluidStack tFluid2 = tRecipe.mFluidInputs[1]; - if(tFluid2!=null){ - for(GT_MetaTileEntity_Hatch_Input tInput2 : this.mInputHatches){ - if(tFluid2.getFluid() !=null&& tInput2.getFluid()!=null&&tFluid2.getFluid().getID()==tInput2.getFluid().getFluid().getID()&&tFluid2.amount<=tInput2.getFluid().amount&&getMaxInputVoltage()>=tRecipe.mEUt&&this.mEUStore>=tRecipe.mSpecialValue){ - tInput.drain(tFluid.amount, true); - tInput2.drain(tFluid2.amount, true); - this.mLastRecipe=tRecipe; - - this.mEUt = (tRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); - this.mMaxProgresstime = tRecipe.mDuration/overclock(this.mLastRecipe.mEUt); - - this.mEfficiencyIncrease = 10000; - this.mOutputFluids = tRecipe.mFluidOutputs; - turnCasingActive(true); - return true; - } - } + + private boolean checkCoils(int aX, int aY, int aZ) { + return (isFusionCoil(aX + 6, aY, aZ - 1)) && (isFusionCoil(aX + 6, aY, aZ)) && (isFusionCoil(aX + 6, aY, aZ + 1)) && (isFusionCoil(aX + 5, aY, aZ - 3)) && (isFusionCoil(aX + 5, aY, aZ - 2)) + && (isFusionCoil(aX + 5, aY, aZ + 2)) && (isFusionCoil(aX + 5, aY, aZ + 3)) && (isFusionCoil(aX + 4, aY, aZ - 4)) && (isFusionCoil(aX + 4, aY, aZ + 4)) + && (isFusionCoil(aX + 3, aY, aZ - 5)) && (isFusionCoil(aX + 3, aY, aZ + 5)) && (isFusionCoil(aX + 2, aY, aZ - 5)) && (isFusionCoil(aX + 2, aY, aZ + 5)) + && (isFusionCoil(aX + 1, aY, aZ - 6)) && (isFusionCoil(aX + 1, aY, aZ + 6)) && (isFusionCoil(aX, aY, aZ - 6)) && (isFusionCoil(aX, aY, aZ + 6)) && (isFusionCoil(aX - 1, aY, aZ - 6)) + && (isFusionCoil(aX - 1, aY, aZ + 6)) && (isFusionCoil(aX - 2, aY, aZ - 5)) && (isFusionCoil(aX - 2, aY, aZ + 5)) && (isFusionCoil(aX - 3, aY, aZ - 5)) + && (isFusionCoil(aX - 3, aY, aZ + 5)) && (isFusionCoil(aX - 4, aY, aZ - 4)) && (isFusionCoil(aX - 4, aY, aZ + 4)) && (isFusionCoil(aX - 5, aY, aZ - 3)) + && (isFusionCoil(aX - 5, aY, aZ - 2)) && (isFusionCoil(aX - 5, aY, aZ + 2)) && (isFusionCoil(aX - 5, aY, aZ + 3)) && (isFusionCoil(aX - 6, aY, aZ - 1)) + && (isFusionCoil(aX - 6, aY, aZ)) && (isFusionCoil(aX - 6, aY, aZ + 1)); + } + + private boolean checkUpperOrLowerHulls(int aX, int aY, int aZ) { + return (isAdvancedMachineCasing(aX + 6, aY, aZ)) && (isAdvancedMachineCasing(aX + 5, aY, aZ - 3)) && (isAdvancedMachineCasing(aX + 5, aY, aZ - 2)) + && (isAdvancedMachineCasing(aX + 5, aY, aZ + 2)) && (isAdvancedMachineCasing(aX + 5, aY, aZ + 3)) && (isAdvancedMachineCasing(aX + 4, aY, aZ - 4)) + && (isAdvancedMachineCasing(aX + 4, aY, aZ + 4)) && (isAdvancedMachineCasing(aX + 3, aY, aZ - 5)) && (isAdvancedMachineCasing(aX + 3, aY, aZ + 5)) + && (isAdvancedMachineCasing(aX + 2, aY, aZ - 5)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 5)) && (isAdvancedMachineCasing(aX, aY, aZ - 6)) + && (isAdvancedMachineCasing(aX, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 5)) && (isAdvancedMachineCasing(aX - 2, aY, aZ + 5)) + && (isAdvancedMachineCasing(aX - 3, aY, aZ - 5)) && (isAdvancedMachineCasing(aX - 3, aY, aZ + 5)) && (isAdvancedMachineCasing(aX - 4, aY, aZ - 4)) + && (isAdvancedMachineCasing(aX - 4, aY, aZ + 4)) && (isAdvancedMachineCasing(aX - 5, aY, aZ - 3)) && (isAdvancedMachineCasing(aX - 5, aY, aZ - 2)) + && (isAdvancedMachineCasing(aX - 5, aY, aZ + 2)) && (isAdvancedMachineCasing(aX - 5, aY, aZ + 3)) && (isAdvancedMachineCasing(aX - 6, aY, aZ)); + } + + private boolean checkHulls(int aX, int aY, int aZ) { + return (isAdvancedMachineCasing(aX + 6, aY, aZ - 3)) && (isAdvancedMachineCasing(aX + 6, aY, aZ - 2)) && (isAdvancedMachineCasing(aX + 6, aY, aZ + 2)) + && (isAdvancedMachineCasing(aX + 6, aY, aZ + 3)) && (isAdvancedMachineCasing(aX + 3, aY, aZ - 6)) && (isAdvancedMachineCasing(aX + 3, aY, aZ + 6)) + && (isAdvancedMachineCasing(aX + 2, aY, aZ - 6)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 6)) + && (isAdvancedMachineCasing(aX - 2, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 3, aY, aZ - 6)) && (isAdvancedMachineCasing(aX - 3, aY, aZ + 6)) + && (isAdvancedMachineCasing(aX - 7, aY, aZ)) && (isAdvancedMachineCasing(aX + 7, aY, aZ)) && (isAdvancedMachineCasing(aX, aY, aZ - 7)) && (isAdvancedMachineCasing(aX, aY, aZ + 7)) + && (isAdvancedMachineCasing(aX - 6, aY, aZ - 3)) && (isAdvancedMachineCasing(aX - 6, aY, aZ - 2)) && (isAdvancedMachineCasing(aX - 6, aY, aZ + 2)) + && (isAdvancedMachineCasing(aX - 6, aY, aZ + 3)) && (isAdvancedMachineCasing(aX - 4, aY, aZ - 2)) && (isAdvancedMachineCasing(aX - 4, aY, aZ + 2)) + && (isAdvancedMachineCasing(aX + 4, aY, aZ - 2)) && (isAdvancedMachineCasing(aX + 4, aY, aZ + 2)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 4)) + && (isAdvancedMachineCasing(aX - 2, aY, aZ + 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ - 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 4)); + } + + private boolean addIfEnergyInjector(int aX, int aY, int aZ, IGregTechTileEntity aBaseMetaTileEntity) { + if (addEnergyInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) { + return true; + } + return isAdvancedMachineCasing(aX, aY, aZ); + } + + private boolean addIfInjector(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) { + if (addInputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) { + return true; + } + return isAdvancedMachineCasing(aX, aY, aZ); + } + + private boolean addIfExtractor(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) { + if (addOutputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) { + return true; + } + return isAdvancedMachineCasing(aX, aY, aZ); + } + + private boolean isAdvancedMachineCasing(int aX, int aY, int aZ) { + return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasing()) && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()); + } + + public abstract Block getCasing(); + + public abstract int getCasingMeta(); + + private boolean isFusionCoil(int aX, int aY, int aZ) { + return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getFusionCoil() && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getFusionCoilMeta())); + } + + public abstract Block getFusionCoil(); + + public abstract int getFusionCoilMeta(); + + public abstract String[] getDescription(); + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + ITexture[] sTexture; + if (aSide == aFacing) { + sTexture = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)), new GT_RenderedTexture(getIconOverlay()) }; + } else { + if (!aActive) { + sTexture = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; + } else { + sTexture = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; + } + } + return sTexture; + } + + public abstract IIconContainer getIconOverlay(); + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public int overclock(int mStartEnergy) { + if (tierOverclock() == 1) { + return 1; + } + if (tierOverclock() == 2) { + return mStartEnergy < 160000000 ? 2 : 1; + } + return mStartEnergy < 160000000 ? 4 : mStartEnergy > 320000000 ? 2 : 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; } } } } + if (tFluidList.size() > 1) { + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[8], tFluids, new ItemStack[] {}); + if (tRecipe == null&&!mRunningOnLoad) { + turnCasingActive(false); + this.mLastRecipe = null; + return false; + } + if (mRunningOnLoad||tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) { + if(mRunningOnLoad)System.out.println("First Recipe!"); + this.mLastRecipe = tRecipe; + this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue)); + this.mMaxProgresstime = this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue); + this.mEfficiencyIncrease = 10000; + this.mOutputFluids = this.mLastRecipe.mFluidOutputs; + turnCasingActive(true); + mRunningOnLoad=false; + return true; + } + } + return false; } - return false; -} -public abstract int tierOverclock(); + public abstract int tierOverclock(); -public boolean turnCasingActive(boolean status){ - if(this.mEnergyHatches!=null){ - for(GT_MetaTileEntity_Hatch_Energy hatch: this.mEnergyHatches){ - hatch.mMachineBlock = status?(byte) 52:(byte) 53; + public boolean turnCasingActive(boolean status) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { + hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; + } } - }if(this.mOutputHatches!=null){ - for(GT_MetaTileEntity_Hatch_Output hatch: this.mOutputHatches){ - hatch.mMachineBlock = status?(byte) 52:(byte) 53; + if (this.mOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; + } } - }if(this.mInputHatches!=null){ - for(GT_MetaTileEntity_Hatch_Input hatch: this.mInputHatches){ - hatch.mMachineBlock = status?(byte) 52:(byte) 53; + if (this.mInputHatches != null) { + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; + } } + return true; } - return true; -} -@Override -public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) mEfficiency = 0; - if (--mUpdate==0 || --mStartUpCheck==0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - } - if (mStartUpCheck < 0) { - if (mMachine) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.mWrench) mWrench = true; - if (tHatch.mScrewdriver) mScrewdriver = true; - if (tHatch.mSoftHammer) mSoftHammer = true; - if (tHatch.mHardHammer) mHardHammer = true; - if (tHatch.mSolderingTool) mSolderingTool = true; - if (tHatch.mCrowbar) mCrowbar = true; - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (mEfficiency < 0) + mEfficiency = 0; + if(mRunningOnLoad&&checkMachine(aBaseMetaTileEntity, mInventory[1])){ + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + checkRecipe(mInventory[1]);} + if (--mUpdate == 0 || --mStartUpCheck == 0) { + mInputHatches.clear(); + mInputBusses.clear(); + mOutputHatches.clear(); + mOutputBusses.clear(); + mDynamoHatches.clear(); + mEnergyHatches.clear(); + mMufflerHatches.clear(); + mMaintenanceHatches.clear(); + mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); + } + if (mStartUpCheck < 0) { + if (mMachine) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048 * tierOverclock(), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true); + } + } } - } - if(this.mEnergyHatches!=null){ - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { - if (aBaseMetaTileEntity.getStoredEU()+(2048*tierOverclock()) 0) { + stopMachine(); + } + if (getRepairStatus() > 0) { + if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { + this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { + if (mOutputItems != null)for (ItemStack tStack : mOutputItems )if (tStack != null)addOutput(tStack); + if (mOutputFluids != null)for (FluidStack tStack : mOutputFluids)if (tStack != null)addOutput(tStack); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mOutputItems = null; + mProgresstime = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + if (mOutputFluids != null && mOutputFluids.length > 0) { + GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]); + } + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + if (aBaseMetaTileEntity.isAllowedToWork()) + checkRecipe(mInventory[1]); + } + } else { + if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + turnCasingActive(mMaxProgresstime > 0); + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + if (checkRecipe(mInventory[1]) && aBaseMetaTileEntity.getStoredEU() >= this.mLastRecipe.mSpecialValue) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true); + } + } + if (mMaxProgresstime <= 0) + mEfficiency = Math.max(0, mEfficiency - 1000); + } } + } else { + this.mLastRecipe = null; + stopMachine(); } - } - if(this.mEUStore<=0&&mMaxProgresstime>0){ - stopMachine(); - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { - this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); - if (mMaxProgresstime > 0 && ++mProgresstime>=mMaxProgresstime) { - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); - if (mOutputFluids != null) for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if(mOutputFluids!=null&&mOutputFluids.length>0){ - GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]);} - this.mEUStore=(int) aBaseMetaTileEntity.getStoredEU(); - if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - turnCasingActive(mMaxProgresstime>0); - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.mEUStore=(int) aBaseMetaTileEntity.getStoredEU(); - if(checkRecipe(mInventory[1])&&aBaseMetaTileEntity.getStoredEU()>=this.mLastRecipe.mSpecialValue){ - aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true); - } - } - if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); - } - } } else { - this.mLastRecipe=null; + turnCasingActive(false); + this.mLastRecipe = null; stopMachine(); } - } else { - turnCasingActive(false); - this.mLastRecipe=null; - stopMachine(); } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) + | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID()&~127)|(mWrench?0:1)|(mScrewdriver?0:2)|(mSoftHammer?0:4)|(mHardHammer?0:8)|(mSolderingTool?0:16)|(mCrowbar?0:32)|(mMachine?0:64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime>0); } -} -@Override -public boolean onRunningTick(ItemStack aStack) { - if (mEUt < 0) { - if (!drainEnergyInput(((long)-mEUt * 10000) / Math.max(1000, mEfficiency))) { - this.mLastRecipe=null; + @Override + public boolean onRunningTick(ItemStack aStack) { + if (mEUt < 0) { + if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { + this.mLastRecipe = null; + stopMachine(); + return false; + } + } + if (this.mEUStore <= 0) { + this.mLastRecipe = null; stopMachine(); return false; } + return true; + } + + public boolean drainEnergyInput(long aEU) { + return false; } - if(this.mEUStore<=0){ - this.mLastRecipe=null; - stopMachine(); + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } - return true; -} - -public boolean drainEnergyInput(long aEU) { -// if (aEU <= this.mEUStore) { -// this.mEUStore-=aEU; -// return true;} - return false; -} - -@Override -public int getMaxEfficiency(ItemStack aStack) { - return 10000;} -@Override -public int getPollutionPerTick(ItemStack aStack) {return 0;} -@Override -public int getDamageToComponent(ItemStack aStack) {return 0;} -@Override -public int getAmountOfOutputs() {return 0;} -@Override -public boolean explodesOnComponentBreak(ItemStack aStack) {return false;} } \ No newline at end of file +} \ No newline at end of file diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index b0da650175..d8b765c82a 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -156,7 +156,8 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M if (mEUt <= 0) { - this.mEfficiencyIncrease = (-10); +// this.mEfficiencyIncrease = (-10); + this.mEfficiency = 0; //stopMachine(); return false; } else { diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index cc881a19ce..d57aa52db8 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -55,6 +56,7 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La public int getPollutionPerTick(ItemSt