fix timer locking behaviour, add ping jitter (it looks nice)

This commit is contained in:
Jess H 2024-06-07 03:19:55 +01:00
parent fd43b29b1d
commit 0a8a3cd02a
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
2 changed files with 19 additions and 8 deletions

View file

@ -42,6 +42,11 @@ public class Speed extends Feature {
wasInWater = false;
}
public void onDisable() {
Features.getFeature(Timer.class).timerLock = false;
Features.getFeature(Timer.class).multiplierLock = 20f;
}
public void onMove(MoveEvent event) {
if (!collideInhibit && (isInLiquid() || isOnWater(true) || mc.player.isOnLadder() || mc.player.isEntityInsideOpaqueBlock())) {
playerSpeed = 0.0;
@ -52,13 +57,6 @@ public class Speed extends Feature {
if (mc.player.moveForward == 0.0f && mc.player.moveStrafing == 0.0f) {
return;
}
if (useTimer) {
Features.getFeature(Timer.class).timerLock = true;
Features.getFeature(Timer.class).multiplierLock = 20f * 1.088f;
} else {
Features.getFeature(Timer.class).timerLock = false;
Features.getFeature(Timer.class).multiplierLock = 20f;
}
if (strafePhase == 1) {
playerSpeed = 1.35 * MotionUtil.applySpeed(0.2873) - 0.01;
} else if (strafePhase == 2) {
@ -133,6 +131,8 @@ public class Speed extends Feature {
if(enabled && !notIngame()) {
text = this + "§7 [" + String.format("%.2f", getSpeed()) + " km/h]";
} else {
Features.getFeature(Timer.class).timerLock = false;
Features.getFeature(Timer.class).multiplierLock = 20f;
text = toString();
}
}

View file

@ -98,6 +98,17 @@ public class HUD extends Feature {
@Gate(1)
public boolean showPing = true;
@Config("Server Ping Jitter")
@Description("Makes your ping jitter up and down to make it seem more responsive.")
@Gate(1)
@Marker(3)
public boolean pingJitter = true;
@Config("Server Ping Jitter Amount")
@Description("See the above setting.")
@Gate(3)
public int pingJitterAmount;
@Config("Show server TPS")
@Description("Shows the server TPS count on the HUD.")
@Gate(1)
@ -179,7 +190,7 @@ public class HUD extends Feature {
if (showTPS && showPing)
infoString += " | ";
if (showPing)
infoString += "Ping: " + ServerDataManager.ping + " | Players: " + ServerDataManager.players + "/" + ServerDataManager.maxPlayers;
infoString += "Ping: " + ServerDataManager.ping + (pingJitter ? (int) (Math.random() * pingJitterAmount) : 0) + " | Players: " + ServerDataManager.players + "/" + ServerDataManager.maxPlayers;
if(infoString.endsWith("\n")) infoString = infoString.substring(0, infoString.length() - 1);
}