diff --git a/common/src/main/java/xyz/jpenilla/tabtps/common/display/task/BossBarDisplayTask.java b/common/src/main/java/xyz/jpenilla/tabtps/common/display/task/BossBarDisplayTask.java index ede732ba..df07f844 100644 --- a/common/src/main/java/xyz/jpenilla/tabtps/common/display/task/BossBarDisplayTask.java +++ b/common/src/main/java/xyz/jpenilla/tabtps/common/display/task/BossBarDisplayTask.java @@ -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) { @@ -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) { diff --git a/common/src/main/java/xyz/jpenilla/tabtps/common/module/TPSModule.java b/common/src/main/java/xyz/jpenilla/tabtps/common/module/TPSModule.java index 77e17017..8bca6931 100644 --- a/common/src/main/java/xyz/jpenilla/tabtps/common/module/TPSModule.java +++ b/common/src/main/java/xyz/jpenilla/tabtps/common/module/TPSModule.java @@ -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()); } } diff --git a/common/src/main/java/xyz/jpenilla/tabtps/common/service/TickTimeService.java b/common/src/main/java/xyz/jpenilla/tabtps/common/service/TickTimeService.java index c3d637cb..c63265a4 100644 --- a/common/src/main/java/xyz/jpenilla/tabtps/common/service/TickTimeService.java +++ b/common/src/main/java/xyz/jpenilla/tabtps/common/service/TickTimeService.java @@ -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]; + } }