From cb923fbb67f69403917b9fb6d1669357a40061a1 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 4 Jan 2023 20:21:51 +0100 Subject: [PATCH] Minor changes and fixes around tick warping When warping and frozen the game will now run at 20 (frozen) TPS instead of as fast as possible around a loop Frozen ticks will no longer count towards tick warping TPS logger will now display `TPS: 0.0` when the game is frozen --- src/main/java/carpet/helpers/TickSpeed.java | 20 +++++++++---------- .../java/carpet/logging/HUDController.java | 3 +++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/carpet/helpers/TickSpeed.java b/src/main/java/carpet/helpers/TickSpeed.java index 879535d3..ff79d47f 100644 --- a/src/main/java/carpet/helpers/TickSpeed.java +++ b/src/main/java/carpet/helpers/TickSpeed.java @@ -176,6 +176,8 @@ public class TickSpeed public static boolean continueWarp() { + if (!process_entities) + return false; if (time_bias > 0) { if (time_bias == time_warp_scheduled_ticks) //first call after previous tick, adjust start time @@ -194,25 +196,21 @@ public class TickSpeed public static void tick() { - process_entities = true; if (player_active_timeout > 0) { player_active_timeout--; } if (is_paused) { - if (player_active_timeout < PLAYER_GRACE) - { - process_entities = false; - } + process_entities = player_active_timeout < PLAYER_GRACE; } else if (is_superHot) { - if (player_active_timeout <= 0) - { - process_entities = false; - - } + process_entities = player_active_timeout <= 0; + } + else + { + process_entities = true; } } //unused - mod compat reasons @@ -227,7 +225,7 @@ public class TickSpeed tickrate = 1000.0f; } - TickSpeed.mspt = (float)mspt; + TickSpeed.mspt = mspt; if (update) notifyTickrateListeners("carpet"); } diff --git a/src/main/java/carpet/logging/HUDController.java b/src/main/java/carpet/logging/HUDController.java index 61f5c9b2..ff29e255 100644 --- a/src/main/java/carpet/logging/HUDController.java +++ b/src/main/java/carpet/logging/HUDController.java @@ -128,6 +128,9 @@ public class HUDController { double MSPT = Mth.average(server.tickTimes) * 1.0E-6D; double TPS = 1000.0D / Math.max((TickSpeed.time_warp_start_time != 0)?0.0:TickSpeed.mspt, MSPT); + if (TickSpeed.isPaused()) { + TPS = 0; + } String color = Messenger.heatmap_color(MSPT,TickSpeed.mspt); return new Component[]{Messenger.c( "g TPS: ", String.format(Locale.US, "%s %.1f",color, TPS),