Added new info to batbuffer sensor card (nuclear control panel) - average input and output.

Also fixed bug in average input/output calculation.
This commit is contained in:
Dimach 2017-07-30 04:09:59 +03:00
parent da2e748e8a
commit 2a672556e6
2 changed files with 16 additions and 7 deletions

View file

@ -53,7 +53,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
protected long mStoredEnergy = 0, mStoredSteam = 0;
protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0;
protected boolean mReleaseEnergy = false;
protected int[] mAverageEUInput = new int[]{0, 0, 0, 0, 0}, mAverageEUOutput = new int[]{0, 0, 0, 0, 0};
protected int[] mAverageEUInput = new int[11], mAverageEUOutput = new int[11];
private boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false}, mActiveEUOutputs = new boolean[]{false, false, false, false, false, false};
private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15};
private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
@ -1574,15 +1574,21 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
@Override
public long getAverageElectricInput() {
int rEU = 0;
for (int tEU : mAverageEUInput) rEU += tEU;
return rEU / mAverageEUInput.length;
for (int i = 0; i < mAverageEUInput.length; i++) {
if (i != mAverageEUInputIndex)
rEU += mAverageEUInput[i];
}
return rEU / (mAverageEUInput.length - 1);
}
@Override
public long getAverageElectricOutput() {
int rEU = 0;
for (int tEU : mAverageEUOutput) rEU += tEU;
return rEU / mAverageEUOutput.length;
for (int i = 0; i < mAverageEUOutput.length; i++) {
if (i != mAverageEUOutputIndex)
rEU += mAverageEUOutput[i];
}
return rEU / (mAverageEUOutput.length - 1);
}
@Override

View file

@ -314,12 +314,15 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
mStored = tmp[0];
mMax = tmp[1];
}
return new String[]{
getLocalName(),
"Stored Items:",
GT_Utility.formatNumbers(mStored) + " EU /",
GT_Utility.formatNumbers(mMax) + " EU"};
GT_Utility.formatNumbers(mMax) + " EU",
"Average input:",
getBaseMetaTileEntity().getAverageElectricInput()+"",
"Average output:",
getBaseMetaTileEntity().getAverageElectricOutput()+""};
}
@Override