Skip to content

Commit

Permalink
Use 1m TPS instead of 5s TPS for default display value on Fabric/NeoF…
Browse files Browse the repository at this point in the history
…orge/Sponge for parity with Paper

5s counter is still shown in /tickinfo
  • Loading branch information
jpenilla committed Jan 5, 2025
1 parent dd39fa3 commit 495c5f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private float msptProgress() {
}

private float tpsProgress() {
return ensureInRange(this.tabTPS.platform().tickTimeService().recentTps()[0] / 20.0f);
return ensureInRange(this.tabTPS.platform().tickTimeService().displayTps() / 20.0f);
}

private static float ensureInRange(final double value) {
Expand All @@ -103,7 +103,7 @@ private static float ensureInRange(final double value) {
}
case REVERSE_TPS:
case TPS:
final double tps = this.tabTPS.platform().tickTimeService().recentTps()[0];
final double tps = this.tabTPS.platform().tickTimeService().displayTps();
if (tps > 18.50D) {
return this.settings.colors().goodPerformance();
} else if (tps > 15.00D) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public TPSModule(

@Override
public @NonNull Component display() {
return TPSUtil.coloredTps(this.tabTPS.platform().tickTimeService().recentTps()[0], this.theme.colorScheme());
return TPSUtil.coloredTps(this.tabTPS.platform().tickTimeService().displayTps(), this.theme.colorScheme());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ public interface TickTimeService {
double averageMspt();

double @NonNull [] recentTps();

default double displayTps() {
final double[] recentTps = this.recentTps();
if (recentTps.length == 3) {
return recentTps[0];
}
return recentTps[1];
}
}

0 comments on commit 495c5f8

Please sign in to comment.