diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-23 23:33:45 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-23 23:33:45 +1000 |
commit | 52d804488c1495de914f66d805efe79845816a5f (patch) | |
tree | be2716a25caf69578eac565ed37572ae773c0589 /src | |
parent | ae8a4b14a0de47c081d518681647d14122163f8e (diff) | |
download | GT5-Unofficial-52d804488c1495de914f66d805efe79845816a5f.tar.gz GT5-Unofficial-52d804488c1495de914f66d805efe79845816a5f.tar.bz2 GT5-Unofficial-52d804488c1495de914f66d805efe79845816a5f.zip |
+ More work on the Large Multi-Tank.
> Other than it's ability to keep the output hatches filled, it works perfectly.
- Removed LOTS of logging which was generated due to Blast Furnace recipe creation.
Diffstat (limited to 'src')
2 files changed, 141 insertions, 77 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java index 069652f40d..4d13ef9d04 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java @@ -1,10 +1,12 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; 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_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; @@ -12,6 +14,7 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.Pair; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -23,6 +26,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_MultiTank @@ -38,6 +42,35 @@ extends GregtechMeta_MultiBlockBase { private FluidStack internalStorageTank = null; @Override + public String[] getInfoData() { + ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches; + if (!mTier.isEmpty()){ + int temp = mTier.get(0).mTier; + if (internalStorageTank == null) { + return new String[]{ + GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", + "Stored Fluid:", + "No Fluid", + Integer.toString(0) + "L", + Integer.toString(getCapacity()) + "L"}; + } + return new String[]{ + GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", + "Stored Fluid:", + internalStorageTank.getLocalizedName(), + Integer.toString(internalStorageTank.amount) + "L", + Integer.toString((int) fluidStored) + "L - fluidStored var", + Integer.toString(getCapacity()) + "L"}; + } + return new String[]{ + "Voltage Tier not set -" +" Large Fluid Tank", + "Stored Fluid:", + "No Fluid", + Integer.toString(0) + "L", + Integer.toString(getCapacity()) + "L"}; + } + + @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("mEUt", mEUt); aNBT.setInteger("mProgresstime", mProgresstime); @@ -169,10 +202,10 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(ItemStack aStack) { - Utils.LOG_INFO("Okay"); - - - + //Utils.LOG_INFO("Okay"); + + + ArrayList<ItemStack> tInputList = getStoredInputs(); for (int i = 0; i < tInputList.size() - 1; i++) { for (int j = i + 1; j < tInputList.size(); j++) { @@ -202,12 +235,12 @@ extends GregtechMeta_MultiBlockBase { } } FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1); - + if (tFluids.length >= 2){ Utils.LOG_INFO("Bad"); return false; } - + ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>>(); int slotInputCount = 0; for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { @@ -224,13 +257,16 @@ extends GregtechMeta_MultiBlockBase { Utils.LOG_INFO("Bad"); return false; } - + Utils.LOG_INFO("Okay - 2"); if (internalStorageTank == null){ + Utils.LOG_INFO("Okay - 3"); if (rList.get(0).getKey().mFluid != null && rList.get(0).getKey().mFluid.amount > 0){ - Utils.LOG_INFO("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+internalStorageTank.amount); - internalStorageTank = rList.get(0).getKey().mFluid; - internalStorageTank.amount = rList.get(0).getKey().mFluid.amount; + Utils.LOG_INFO("Okay - 4"); + Utils.LOG_INFO("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount /*+" internalStorageTank:"+internalStorageTank.amount*/); + FluidStack tempFluidStack = rList.get(0).getKey().mFluid; + Fluid tempFluid = tempFluidStack.getFluid(); + internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount); rList.get(0).getKey().mFluid.amount = 0; Utils.LOG_INFO("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+internalStorageTank.amount); return true; @@ -241,70 +277,98 @@ extends GregtechMeta_MultiBlockBase { else if (internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){ Utils.LOG_INFO("Storing "+rList.get(0).getKey().mFluid.amount+"L"); Utils.LOG_INFO("Contains "+internalStorageTank.amount+"L"); - + + int tempAdd = 0; tempAdd = rList.get(0).getKey().getFluidAmount(); rList.get(0).getKey().mFluid = null; Utils.LOG_INFO("adding "+tempAdd); internalStorageTank.amount = internalStorageTank.amount + tempAdd; Utils.LOG_INFO("Tank now Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); - - if (mOutputHatches.get(0).mFluid == null || mOutputHatches.isEmpty()){ - Utils.LOG_INFO("Okay - 3"); - int tempCurrentStored = internalStorageTank.amount; - int tempSubtract = 0; - int tempResult = 0; - int tempHatchSize = mOutputHatches.get(0).getCapacity(); - FluidStack tempOutputFluid = internalStorageTank; - if (tempHatchSize > tempCurrentStored){ - Utils.LOG_INFO("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored:"+tempCurrentStored); - tempOutputFluid.amount = tempHatchSize; - tempSubtract = tempHatchSize; - tempResult = tempCurrentStored - tempSubtract; - Utils.LOG_INFO("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored:"+tempCurrentStored); - mOutputHatches.get(0).mFluid = tempOutputFluid; - internalStorageTank.amount = tempResult; + + + //Utils.LOG_INFO("Tank"); + return true; + } + else { + FluidStack superTempFluidStack = rList.get(0).getKey().mFluid; + Utils.LOG_INFO("is input fluid equal to stored fluid? "+(internalStorageTank.isFluidEqual(superTempFluidStack))); + if (superTempFluidStack != null) + Utils.LOG_INFO("Input hatch[0] Contains "+superTempFluidStack.amount+"L of "+superTempFluidStack.getFluid().getName()+"."); + Utils.LOG_INFO("Large Multi-Tank Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + + if (mOutputHatches.get(0).mFluid == null || mOutputHatches.isEmpty()){ + Utils.LOG_INFO("Okay - 3"); + int tempCurrentStored = internalStorageTank.amount; + int tempResult = 0; + int tempHatchSize = mOutputHatches.get(0).getCapacity(); + int tempHatchCurrentHolding = mOutputHatches.get(0).getFluidAmount(); + int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; + FluidStack tempOutputFluid = internalStorageTank; + Utils.LOG_INFO("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored:"+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + + if (tempHatchSize >= tempHatchRemainingSpace){ + Utils.LOG_INFO("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored:"+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + + int adder; + + if (tempCurrentStored > 0 && tempCurrentStored <= tempHatchSize){ + adder = tempCurrentStored; } - else if (tempCurrentStored >= 5000){ - Utils.LOG_INFO("Okay - 3.2"); - tempOutputFluid.amount = tempCurrentStored; - tempSubtract = tempOutputFluid.amount; - tempResult = tempCurrentStored - tempSubtract; - mOutputHatches.get(0).mFluid = tempOutputFluid; - internalStorageTank.amount = tempResult; + else { + adder = 0; } - Utils.LOG_INFO("Tank"); - return true; + + tempResult = tempHatchCurrentHolding + adder; + tempOutputFluid.amount = tempResult; + Utils.LOG_INFO("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored:"+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName()); + mOutputHatches.get(0).mFluid = tempOutputFluid; + internalStorageTank.amount = (tempCurrentStored-tempResult); + Utils.LOG_INFO("Okay - 3.1.3"+" internalTankStorage: "+internalStorageTank.amount +"L | output hatch contains:"+mOutputHatches.get(0).mFluid.amount+"L of "+mOutputHatches.get(0).mFluid.getFluid().getName()); + /*if (internalStorageTank.amount <= 0) + internalStorageTank = null;*/ } - else if (mOutputHatches.get(0).mFluid.isFluidEqual(internalStorageTank)){ - Utils.LOG_INFO("Okay - 4"); - int tempCurrentStored = internalStorageTank.amount; - int tempSubtract = 0; - int tempResult = 0; - int tempHatchSize = mOutputHatches.get(0).getCapacity(); - FluidStack tempOutputFluid = internalStorageTank; - if (tempHatchSize > tempCurrentStored){ - tempOutputFluid.amount = tempHatchSize; - tempSubtract = tempOutputFluid.amount; - tempResult = tempCurrentStored - tempSubtract; - mOutputHatches.get(0).mFluid = tempOutputFluid; - internalStorageTank.amount = tempResult; + Utils.LOG_INFO("Tank"); + return true; + } + else if (mOutputHatches.get(0).mFluid.isFluidEqual(internalStorageTank)){ + if (internalStorageTank.amount <= 0) + return false; + Utils.LOG_INFO("Okay - 4"); + int tempCurrentStored = internalStorageTank.amount; + int tempResult = 0; + int tempHatchSize = mOutputHatches.get(0).getCapacity(); + int tempHatchCurrentHolding = mOutputHatches.get(0).getFluidAmount(); + int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; + FluidStack tempOutputFluid = internalStorageTank; + Utils.LOG_INFO("Okay - 4.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored:"+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + + if (tempHatchSize >= tempHatchRemainingSpace){ + Utils.LOG_INFO("Okay - 4.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored:"+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + + int adder; + + if (tempCurrentStored > 0 && tempCurrentStored <= tempHatchSize){ + adder = tempCurrentStored; } - else if (tempCurrentStored >= 5000){ - tempOutputFluid.amount = tempCurrentStored; - tempSubtract = tempOutputFluid.amount; - tempResult = tempCurrentStored - tempSubtract; - mOutputHatches.get(0).mFluid = tempOutputFluid; - internalStorageTank.amount = tempResult; + else { + adder = 0; } - Utils.LOG_INFO("Tank"); - return true; - } + + tempResult = tempHatchCurrentHolding + adder; + + tempOutputFluid.amount = tempResult; + Utils.LOG_INFO("Okay - 4.1.2"+" result: "+tempResult +" tempCurrentStored:"+tempCurrentStored); + mOutputHatches.get(0).mFluid = tempOutputFluid; + internalStorageTank.amount = (tempCurrentStored-tempResult); + /* if (internalStorageTank.amount <= 0) + internalStorageTank = null;*/ + } + Utils.LOG_INFO("Tank"); - return true; - } - else { - Utils.LOG_INFO("Tank Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + return true; + } + } //this.getBaseMetaTileEntity().(tFluids[0].amount, true); Utils.LOG_INFO("Tank"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index 42f3829045..8da9699c8e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -87,18 +87,18 @@ public class RecipeGen_BlastSmelter implements Runnable{ if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, 240)){ Utils.LOG_WARNING("Success."); if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration, 120)){ - Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid solidifier recipe."); if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration, 120)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1), null, M.getFluid(16), 100, duration/9, 120)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/4, 120)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } } } @@ -111,21 +111,21 @@ public class RecipeGen_BlastSmelter implements Runnable{ if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, 120)){ Utils.LOG_WARNING("Success."); if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration/2, 60)){ - Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid solidifier recipe."); if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration/2, 60)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } ItemStack tempitem = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1); if (tempitem != null){ if (GT_Values.RA.addFluidExtractionRecipe(tempitem, null, M.getFluid(16), 100, duration/2/9, 60)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } } if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/2/4, 60)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/2/9, 60)){ - Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } } } @@ -186,20 +186,20 @@ public class RecipeGen_BlastSmelter implements Runnable{ components[fr] = components_NoCircuit[fr-1]; } } - Utils.LOG_INFO("Should have added a circuit. mMaterialListSize: "+mMaterialListSize+" | circuit: "+components[0].getDisplayName()); + Utils.LOG_WARNING("Should have added a circuit. mMaterialListSize: "+mMaterialListSize+" | circuit: "+components[0].getDisplayName()); } else { - Utils.LOG_INFO("Did not add a circuit. mMaterialListSize: "+mMaterialListSize); + Utils.LOG_WARNING("Did not add a circuit. mMaterialListSize: "+mMaterialListSize); } //Set Fluid output fluidAmount = 144*inputStackCount; - Utils.LOG_INFO("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); - Utils.LOG_INFO("tMaterial.length: "+components.length+"."); + Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); + Utils.LOG_WARNING("tMaterial.length: "+components.length+"."); for (int das=0;das<components.length;das++){ if (components[das] != null) - Utils.LOG_INFO("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); + Utils.LOG_WARNING("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); } //Adds Recipe |