Fixed Display overflow
This commit is contained in:
parent
8659c9573c
commit
8722e0e2f2
1 changed files with 9 additions and 1 deletions
|
@ -262,8 +262,11 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
|
||||||
}
|
}
|
||||||
|
|
||||||
public long[] getStoredEnergy() {
|
public long[] getStoredEnergy() {
|
||||||
|
boolean scaleOverflow =false;
|
||||||
|
boolean storedOverflow = false;
|
||||||
long tScale = getBaseMetaTileEntity().getEUCapacity();
|
long tScale = getBaseMetaTileEntity().getEUCapacity();
|
||||||
long tStored = getBaseMetaTileEntity().getStoredEU();
|
long tStored = getBaseMetaTileEntity().getStoredEU();
|
||||||
|
long tStep = 0;
|
||||||
if (mInventory != null) {
|
if (mInventory != null) {
|
||||||
for (ItemStack aStack : mInventory) {
|
for (ItemStack aStack : mInventory) {
|
||||||
if (GT_ModHandler.isElectricItem(aStack)) {
|
if (GT_ModHandler.isElectricItem(aStack)) {
|
||||||
|
@ -271,8 +274,11 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
|
||||||
if (aStack.getItem() instanceof GT_MetaBase_Item) {
|
if (aStack.getItem() instanceof GT_MetaBase_Item) {
|
||||||
Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack);
|
Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack);
|
||||||
if (stats != null) {
|
if (stats != null) {
|
||||||
|
if(stats[0]>Long.MAX_VALUE/2){scaleOverflow=true;}
|
||||||
tScale = tScale + stats[0];
|
tScale = tScale + stats[0];
|
||||||
tStored = tStored + ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack);
|
tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack);
|
||||||
|
if(tStep > Long.MAX_VALUE/2){storedOverflow=true;}
|
||||||
|
tStored = tStored + tStep;
|
||||||
}
|
}
|
||||||
} else if (aStack.getItem() instanceof IElectricItem) {
|
} else if (aStack.getItem() instanceof IElectricItem) {
|
||||||
tStored = tStored + (long) ic2.api.item.ElectricItem.manager.getCharge(aStack);
|
tStored = tStored + (long) ic2.api.item.ElectricItem.manager.getCharge(aStack);
|
||||||
|
@ -282,6 +288,8 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(scaleOverflow){tScale=Long.MAX_VALUE;}
|
||||||
|
if(storedOverflow){tStored=Long.MAX_VALUE;}
|
||||||
return new long[]{tStored, tScale};
|
return new long[]{tStored, tScale};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue