Move update ticking state

This commit is contained in:
Ethan 2024-07-13 18:04:00 +08:00
parent f83e2fb093
commit 4fd9cbe249

View file

@ -1076,12 +1076,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
downstream.connect(false, loginEvent.transferring());
}
public void updateTickingState(float tickRate, boolean frozen) {
tickThread.cancel(true);
this.tickingFrozen = frozen;
tickThread = eventLoop.scheduleAtFixedRate(this::tick, Math.round(1000 / tickRate), Math.round(1000 / tickRate), TimeUnit.MILLISECONDS);
}
public void disconnect(String reason) {
if (!closed) {
loggedIn = false;
@ -1170,6 +1164,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
}, duration, timeUnit);
}
public void updateTickingState(float tickRate, boolean frozen) {
tickThread.cancel(true);
this.tickingFrozen = frozen;
tickThread = eventLoop.scheduleAtFixedRate(this::tick, Math.round(1000 / tickRate), Math.round(1000 / tickRate), TimeUnit.MILLISECONDS);
}
/**
* Called every Minecraft tick - 1000/tickRate milliseconds.
*/