Skip to content

Instantly share code, notes, and snippets.

@mdashlw
Created November 1, 2020 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdashlw/d27c0da375084f384732034c93926a84 to your computer and use it in GitHub Desktop.
Save mdashlw/d27c0da375084f384732034c93926a84 to your computer and use it in GitHub Desktop.
// sending keep alive
if (this.networkTickCount - this.lastSentPingPacket > 40L)
{
this.lastSentPingPacket = (long)this.networkTickCount;
this.lastPingTime = this.currentTimeMillis();
this.field_147378_h = (int)this.lastPingTime;
this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
}
// processing keep alive
int i = (int)(this.currentTimeMillis() - this.lastPingTime);
this.playerEntity.ping = (this.playerEntity.ping * 3 + i) / 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment