From e24d63c9719d3473e1efb192f12bbb7ceca5f6f1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 5 Jul 2026 09:46:44 -0400 Subject: [PATCH] Fixed #12293 --- core/src/mindustry/core/NetServer.java | 29 ++++++++++------------- core/src/mindustry/net/NetConnection.java | 2 -- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 33712b3482..31cf3665df 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -610,25 +610,25 @@ public class NetServer implements ApplicationListener{ (player.isAdded() ? 4 : 0) | (player.con.hasBegunConnecting ? 8 : 0); - Call.debugStatusClient(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent); - Call.debugStatusClientUnreliable(player.con, flags, player.con.lastReceivedClientSnapshot, player.con.snapshotsSent); + Call.debugStatusClient(player.con, flags, player.con.lastReceivedClientSnapshot); + Call.debugStatusClientUnreliable(player.con, flags, player.con.lastReceivedClientSnapshot); } @Remote(variants = Variant.both, priority = PacketPriority.high) - public static void debugStatusClient(int value, int lastClientSnapshot, int snapshotsSent){ - logClientStatus(true, value, lastClientSnapshot, snapshotsSent); + public static void debugStatusClient(int value, int lastClientSnapshot){ + logClientStatus(true, value, lastClientSnapshot); } @Remote(variants = Variant.both, priority = PacketPriority.high, unreliable = true) - public static void debugStatusClientUnreliable(int value, int lastClientSnapshot, int snapshotsSent){ - logClientStatus(false, value, lastClientSnapshot, snapshotsSent); + public static void debugStatusClientUnreliable(int value, int lastClientSnapshot){ + logClientStatus(false, value, lastClientSnapshot); } - static void logClientStatus(boolean reliable, int value, int lastClientSnapshot, int snapshotsSent){ - Log.info("@ Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @ lastClientSnapshot = @, snapshotsSent = @", + static void logClientStatus(boolean reliable, int value, int lastClientSnapshot){ + Log.info("@ Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @ lastClientSnapshot = @", reliable ? "[RELIABLE]" : "[UNRELIABLE]", (value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0, - lastClientSnapshot, snapshotsSent + lastClientSnapshot ); } @@ -1136,11 +1136,9 @@ public class NetServer implements ApplicationListener{ Call.entitySnapshot((short)sent, syncStream.toByteArray()); } - - Groups.player.each(p -> p.con.snapshotsSent++); } - /** Checks isSyncHidden for only one player per team. Called if FoW is enabled but there is no custom syncHidden. */ + /** Checks isSyncHidden for only one player per team. Called if FoW is enabled. */ public void writeEntitySnapshotsTeam(Team team, Seq players) throws IOException{ syncStream.reset(); @@ -1151,7 +1149,6 @@ public class NetServer implements ApplicationListener{ for(Player player : players){ //player.con must not be null here (the players seq must ONLY contain non-local connected clients) tempConnections.add(player.con); - player.con.snapshotsSent ++; } for(Syncc entity : Groups.sync){ @@ -1218,10 +1215,10 @@ public class NetServer implements ApplicationListener{ } protected void writeEntity(Syncc entity, DataOutputStream dataStream) throws IOException{ - dataStream.writeInt(entity.id()); //write id - dataStream.writeByte(entity.classId() & 0xFF); //write type ID + dataStream.writeInt(entity.id()); + dataStream.writeByte(entity.classId() & 0xFF); entity.beforeWrite(); - entity.writeSync(dataStreamWrites); //write entity itself + entity.writeSync(dataStreamWrites); } public String fixName(String name){ diff --git a/core/src/mindustry/net/NetConnection.java b/core/src/mindustry/net/NetConnection.java index d622e5fa1a..5a0794a37f 100644 --- a/core/src/mindustry/net/NetConnection.java +++ b/core/src/mindustry/net/NetConnection.java @@ -21,8 +21,6 @@ public abstract class NetConnection{ public long connectTime = Time.millis(); /** ID of last received client snapshot. */ public int lastReceivedClientSnapshot = -1; - /** Count of snapshots sent from server. */ - public int snapshotsSent; /** Timestamp of last received snapshot. */ public long lastReceivedClientTime; /** Build requests that have been recently rejected. This is cleared every snapshot. */