add option for more conservative server tick time calculation, include ping in server tick time calculation
All checks were successful
/ Build BaseBand (push) Successful in 3m2s

This commit is contained in:
Daniella / Tove 2024-10-04 22:40:44 +02:00
parent bebe8f82ad
commit 98999bfd97
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 7 additions and 1 deletions

View file

@ -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)

View file

@ -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));
}
}