Off-by-one desync

This commit is contained in:
Jozufozu 2021-11-01 12:27:59 -07:00
parent fd1990f732
commit b3cf7a6f90

View file

@ -68,7 +68,10 @@ public class ServerSpeedProvider {
} }
float target = ((float) getSyncInterval()) / Math.max(clientTimer, 1); float target = ((float) getSyncInterval()) / Math.max(clientTimer, 1);
modifier.target(Math.min(target, 1)); modifier.target(Math.min(target, 1));
clientTimer = 0; // Set this to -1 because packets are processed before ticks.
// ServerSpeedProvider#clientTick will increment it to 0 at the end of this tick.
// Setting it to 0 causes consistent desync, as the client ends up counting too many ticks.
clientTimer = -1;
}); });
context.get() context.get()