From 98999bfd9734525a5cf24e2fa898f469fd48652f Mon Sep 17 00:00:00 2001 From: TudbuT Date: Fri, 4 Oct 2024 22:40:44 +0200 Subject: [PATCH] add option for more conservative server tick time calculation, include ping in server tick time calculation --- .../de/com/baseband/client/feature/modules/client/Client.java | 4 ++++ .../com/baseband/client/util/interact/ServerDataManager.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/client/Client.java b/Client/src/main/java/de/com/baseband/client/feature/modules/client/Client.java index 9f0ff98..49112bc 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/client/Client.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/client/Client.java @@ -58,6 +58,10 @@ public class Client extends Feature { @Config("Theme") public GuiTheme.Theme theme = GuiTheme.Theme.TTC; + @Config("Conservative tick time") + @Description("Assume server ticks to be more inconsistent. (Makes some features slightly slower.)") + public boolean tickTimeConservative = false; + private static final String C_CONFIG = "Config"; @Section(C_CONFIG) diff --git a/Client/src/main/java/de/com/baseband/client/util/interact/ServerDataManager.java b/Client/src/main/java/de/com/baseband/client/util/interact/ServerDataManager.java index 7ddf434..95cc449 100644 --- a/Client/src/main/java/de/com/baseband/client/util/interact/ServerDataManager.java +++ b/Client/src/main/java/de/com/baseband/client/util/interact/ServerDataManager.java @@ -2,6 +2,8 @@ package de.com.baseband.client.util.interact; import de.com.baseband.client.BaseBand; import de.com.baseband.client.Setup; +import de.com.baseband.client.feature.Features; +import de.com.baseband.client.feature.modules.client.Client; import de.com.baseband.client.util.adapt.ServerPing; import de.tudbut.tools.Lock; import net.minecraft.client.network.NetworkPlayerInfo; @@ -85,6 +87,6 @@ public class ServerDataManager { } public static int timeToSurelyTicked() { - return (int) Math.ceil((20f / tps) * 3f); // 20 => 3, 10 => 6, etc + return (int) Math.ceil(((20f / tps) + (ping / 100f)) * (Features.getFeature(Client.class).tickTimeConservative ? 3f : 2f)); } }