aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
authorBlueWeabo <ilia.iliev2005@gmail.com>2023-07-24 15:04:15 +0300
committerGitHub <noreply@github.com>2023-07-24 14:04:15 +0200
commit1d7e1b39f20378c0a84d9740b6f314f99c713f98 (patch)
treef9a0263cde1f136b95b7a5bb38113901a20e23a0 /src/main/java/gregtech/api/metatileentity/implementations
parent0d66f68954187f58125ca35fc7c8feba656afbc2 (diff)
downloadGT5-Unofficial-1d7e1b39f20378c0a84d9740b6f314f99c713f98.tar.gz
GT5-Unofficial-1d7e1b39f20378c0a84d9740b6f314f99c713f98.tar.bz2
GT5-Unofficial-1d7e1b39f20378c0a84d9740b6f314f99c713f98.zip
Add a config to enable seeing average ns per tick in waila (#2173)
* add averageNS * add ns to line * add lang and space on unit
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 8d57eb9e13..f80cec6dfe 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -1691,7 +1691,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
currentTip.add(
GT_Waila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress")));
-
+ // Show ns on the tooltip
+ if (GT_Mod.gregtechproxy.wailaAverageNS) {
+ int tAverageTime = tag.getInteger("averageNS");
+ currentTip.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime) + " ns");
+ }
super.getWailaBody(itemStack, currentTip, accessor, config);
}
@@ -1715,6 +1719,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
tag.setLong("energyTier", getInputVoltageTier());
}
}
+
+ int tAverageTime = 0;
+ for (int tTime : this.getBaseMetaTileEntity()
+ .getTimeStatistics()) {
+ tAverageTime += tTime;
+ }
+
+ tag.setInteger(
+ "averageNS",
+ tAverageTime / this.getBaseMetaTileEntity()
+ .getTimeStatistics().length);
}
@Override