aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java563
2 files changed, 335 insertions, 230 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
index 8bd32d7d8b..5b4571b057 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
@@ -49,7 +49,7 @@ public class CasingTextureHandler {
return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
//Multitank Exterior Casing
case 11:
- return Textures.BlockIcons.MACHINE_CASING_GRATE.getIcon();
+ return TexturesGtBlock.Casing_Material_Grisium.getIcon();
//Reactor Casing I
case 12:
return TexturesGtBlock.Casing_Material_Stellite.getIcon();
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 32759c4024..069652f40d 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
@@ -5,14 +5,18 @@ 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_Input;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.array.Pair;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import java.util.ArrayList;
+import java.util.Arrays;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
@@ -22,263 +26,364 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_MultiTank
- extends GregtechMeta_MultiBlockBase {
- public GregtechMetaTileEntity_MultiTank(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
+extends GregtechMeta_MultiBlockBase {
+ public GregtechMetaTileEntity_MultiTank(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
- private long fluidStored = 0;
- private short multiblockCasingCount = 0;
- private short storageMultiplier = getStorageMultiplier();
- private long maximumFluidStorage = getMaximumTankStorage();
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("mEUt", mEUt);
- aNBT.setInteger("mProgresstime", mProgresstime);
- aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
- aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
- aNBT.setInteger("mEfficiency", mEfficiency);
- aNBT.setInteger("mPollution", mPollution);
- aNBT.setInteger("mRuntime", mRuntime);
- aNBT.setLong("mFluidStored", fluidStored);
- aNBT.setShort("mStorageMultiplier", storageMultiplier);
- aNBT.setLong("mMaxFluidStored", maximumFluidStorage);
- aNBT.setShort("mCasingCount", multiblockCasingCount);
+ private long fluidStored = 0;
+ private short multiblockCasingCount = 0;
+ private short storageMultiplier = getStorageMultiplier();
+ private long maximumFluidStorage = getMaximumTankStorage();
+ private FluidStack internalStorageTank = null;
- if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++)
- if (mOutputItems[i] != null) {
- NBTTagCompound tNBT = new NBTTagCompound();
- 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);
- }
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mEUt", mEUt);
+ aNBT.setInteger("mProgresstime", mProgresstime);
+ aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
+ aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
+ aNBT.setInteger("mEfficiency", mEfficiency);
+ aNBT.setInteger("mPollution", mPollution);
+ aNBT.setInteger("mRuntime", mRuntime);
+ aNBT.setLong("mFluidStored", fluidStored);
+ aNBT.setShort("mStorageMultiplier", storageMultiplier);
+ aNBT.setLong("mMaxFluidStored", maximumFluidStorage);
+ aNBT.setShort("mCasingCount", multiblockCasingCount);
- aNBT.setBoolean("mWrench", mWrench);
- aNBT.setBoolean("mScrewdriver", mScrewdriver);
- aNBT.setBoolean("mSoftHammer", mSoftHammer);
- aNBT.setBoolean("mHardHammer", mHardHammer);
- aNBT.setBoolean("mSolderingTool", mSolderingTool);
- aNBT.setBoolean("mCrowbar", mCrowbar);
- }
-
- private short getStorageMultiplier(){
- int tempstorageMultiplier = (1*multiblockCasingCount);
- if (tempstorageMultiplier <= 0){
- return 1;
- }
- return (short) tempstorageMultiplier;
- }
+ if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++)
+ if (mOutputItems[i] != null) {
+ NBTTagCompound tNBT = new NBTTagCompound();
+ 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);
+ }
- private long getMaximumTankStorage(){
- int multiplier = getStorageMultiplier();
- Utils.LOG_WARNING("x = "+multiplier+" * 96000");
- long tempTankStorageMax = (96000*multiplier);
- Utils.LOG_WARNING("x = "+tempTankStorageMax);
- if (tempTankStorageMax <= 0){
- return 96000;
- }
- return tempTankStorageMax;
- }
+ aNBT.setBoolean("mWrench", mWrench);
+ aNBT.setBoolean("mScrewdriver", mScrewdriver);
+ aNBT.setBoolean("mSoftHammer", mSoftHammer);
+ aNBT.setBoolean("mHardHammer", mHardHammer);
+ aNBT.setBoolean("mSolderingTool", mSolderingTool);
+ aNBT.setBoolean("mCrowbar", mCrowbar);
+ }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- 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");
- fluidStored = aNBT.getLong("mFluidStored");
- storageMultiplier = aNBT.getShort("mStorageMultiplier");
- maximumFluidStorage = aNBT.getLong("mMaxFluidStored");
- multiblockCasingCount = aNBT.getShort("mCasingCount");
- mOutputItems = new ItemStack[getAmountOfOutputs()];
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
- 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");
- mSolderingTool = aNBT.getBoolean("mSolderingTool");
- mCrowbar = aNBT.getBoolean("mCrowbar");
- }
-
- public GregtechMetaTileEntity_MultiTank(String aName) {
- super(aName);
- }
+ private short getStorageMultiplier(){
+ int tempstorageMultiplier = (1*multiblockCasingCount);
+ if (tempstorageMultiplier <= 0){
+ return 1;
+ }
+ return (short) tempstorageMultiplier;
+ }
- @Override
+ private long getMaximumTankStorage(){
+ int multiplier = getStorageMultiplier();
+ Utils.LOG_WARNING("x = "+multiplier+" * 96000");
+ long tempTankStorageMax = (96000*multiplier);
+ Utils.LOG_WARNING("x = "+tempTankStorageMax);
+ if (tempTankStorageMax <= 0){
+ return 96000;
+ }
+ return tempTankStorageMax;
+ }
+
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ 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");
+ fluidStored = aNBT.getLong("mFluidStored");
+ storageMultiplier = aNBT.getShort("mStorageMultiplier");
+ maximumFluidStorage = aNBT.getLong("mMaxFluidStored");
+ multiblockCasingCount = aNBT.getShort("mCasingCount");
+ mOutputItems = new ItemStack[getAmountOfOutputs()];
+ for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
+ 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");
+ mSolderingTool = aNBT.getBoolean("mSolderingTool");
+ mCrowbar = aNBT.getBoolean("mCrowbar");
+ }
+
+ public GregtechMetaTileEntity_MultiTank(String aName) {
+ super(aName);
+ }
+
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_MultiTank(this.mName);
- }
+ return new GregtechMetaTileEntity_MultiTank(this.mName);
+ }
- @Override
+ @Override
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Multitank",
- "Size: 3xHx3 (Block behind controller must be air)",
- "Structure must be at least 4 blocks tall, maximum 20.",
- "Each casing within the structure adds 96000L storage.",
- "Controller (front centered)",
- "1x Input hatch (anywhere)",
- "1x Output hatch (anywhere)",
- "1x Energy Hatch (anywhere)",
- "1x Maintenance Hatch (anywhere)",
- "Multitank Exterior Casings for the rest (16 at least!)",
- "Stored Fluid: "+fluidStored};
- }
+ return new String[]{
+ "Controller Block for the Multitank",
+ "Size: 3xHx3 (Block behind controller must be air)",
+ "Structure must be at least 4 blocks tall, maximum 20.",
+ "Each casing within the structure adds 96000L storage.",
+ "Controller (front centered)",
+ "1x Input hatch (anywhere)",
+ "1x Output hatch (anywhere)",
+ "1x Energy Hatch (anywhere)",
+ "1x Maintenance Hatch (anywhere)",
+ "Multitank Exterior Casings for the rest (16 at least!)",
+ "Stored Fluid: "+fluidStored};
+ }
- @Override
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR)};
- }
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68]};
- }
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Screen_Logo : TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68]};
+ }
- @Override
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png");
- }
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png");
+ }
- @Override
+ @Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return GT_Recipe.GT_Recipe_Map.sVacuumRecipes;
- }
-
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
+ return aFacing > 1;
+ }
- @Override
+ @Override
public boolean checkRecipe(ItemStack aStack) {
- ArrayList<ItemStack> tInputList = getStoredInputs();
- for (ItemStack tInput : tInputList) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ 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++) {
+ if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
+ if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
+ tInputList.remove(j--);
+ } else {
+ tInputList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput});
- if (tRecipe != null) {
- if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- if (tRecipe.mEUt <= 16) {
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
- } else {
- this.mEUt = tRecipe.mEUt;
- this.mMaxProgresstime = tRecipe.mDuration;
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
- updateSlots();
- return true;
- }
- }
- }
- return false;
- }
+ ArrayList<FluidStack> 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;
+ }
+ }
+ }
+ }
+ 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) {
+ boolean containsFluid = false;
+ if (isValidMetaTileEntity(tHatch)) {
+ slotInputCount++;
+ for (int i=0; i<tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.canTankBeEmptied()){containsFluid=true;}
+ }
+ rList.add(new Pair<GT_MetaTileEntity_Hatch_Input, Boolean>(tHatch, containsFluid));
+ }
+ }
+ if (tFluids.length <= 0 || slotInputCount > 1){
+ Utils.LOG_INFO("Bad");
+ return false;
+ }
+
+ Utils.LOG_INFO("Okay - 2");
+ if (internalStorageTank == null){
+ 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;
+ 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;
+ }
+ Utils.LOG_INFO("No Fluid in hatch.");
+ return false;
+ }
+ 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;
+ }
+ 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;
+ }
+ Utils.LOG_INFO("Tank");
+ return true;
+ }
+ 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;
+ }
+ else if (tempCurrentStored >= 5000){
+ tempOutputFluid.amount = tempCurrentStored;
+ tempSubtract = tempOutputFluid.amount;
+ tempResult = tempCurrentStored - tempSubtract;
+ mOutputHatches.get(0).mFluid = tempOutputFluid;
+ internalStorageTank.amount = tempResult;
+ }
+ Utils.LOG_INFO("Tank");
+ return true;
+ }
+ Utils.LOG_INFO("Tank");
+ return true;
+ }
+ else {
+ Utils.LOG_INFO("Tank Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+".");
+ }
+ //this.getBaseMetaTileEntity().(tFluids[0].amount, true);
+ Utils.LOG_INFO("Tank");
+ return false;
+ }
- @Override
+ @Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
- Utils.LOG_WARNING("Must be hollow.");
- return false;
- }
- int tAmount = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- for (int h = -1; h < 19; h++) {
- if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- if (h < 3){
- Utils.LOG_WARNING("Casing Expected.");
- return false;
- }
- else if (h >= 3){
- //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
- }
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 11) {
- if (h < 3){
- Utils.LOG_WARNING("Wrong Meta.");
- return false;
- }
- else if (h >= 3){
- //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
- }
- }
- if (h < 3){
- tAmount++;
- }
- else if (h >= 3){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){
- Utils.LOG_WARNING("Found air");
- }
- else {
- Utils.LOG_WARNING("Layer "+(h+2)+" is complete. Adding "+(64000*9)+"L storage to the tank.");
- tAmount++;
- }
- }
- }
- }
- }
- }
- }
- multiblockCasingCount = (short) tAmount;
- Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
- Utils.LOG_INFO("Casings Count: "+tAmount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+getMaximumTankStorage()+"L");
- return tAmount >= 16;
- }
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ Utils.LOG_INFO("Must be hollow.");
+ return false;
+ }
+ int tAmount = 0;
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int h = -1; h < 19; h++) {
+ if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
+ if ((!addMaintenanceToMachineList(tTileEntity, 68)) && (!addInputToMachineList(tTileEntity, 68)) && (!addOutputToMachineList(tTileEntity, 68)) && (!addEnergyInputToMachineList(tTileEntity, 68))) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
+ if (h < 3){
+ Utils.LOG_INFO("Casing Expected.");
+ return false;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 11) {
+ if (h < 3){
+ Utils.LOG_INFO("Wrong Meta.");
+ return false;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (h < 3){
+ tAmount++;
+ }
+ else if (h >= 3){
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){
+ Utils.LOG_INFO("Found air");
+ }
+ else {
+ Utils.LOG_INFO("Layer "+(h+2)+" is complete. Adding "+(64000*9)+"L storage to the tank.");
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ multiblockCasingCount = (short) tAmount;
+ Utils.LOG_INFO("Your Multitank can be 20 blocks tall.");
+ Utils.LOG_INFO("Casings Count: "+tAmount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+getMaximumTankStorage()+"L");
+ return tAmount >= 16;
+ }
- @Override
+ @Override
public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
+ return 10000;
+ }
- @Override
+ @Override
public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
+ return 0;
+ }
- @Override
+ @Override
public int getAmountOfOutputs() {
- return 1;
- }
+ return 1;
+ }
- @Override
+ @Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
+ return false;
+ }
}