aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ServerConnection.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/ServerConnection.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/ServerConnection.h')
-rw-r--r--Minecraft.Client/ServerConnection.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/Minecraft.Client/ServerConnection.h b/Minecraft.Client/ServerConnection.h
new file mode 100644
index 00000000..56c5d39e
--- /dev/null
+++ b/Minecraft.Client/ServerConnection.h
@@ -0,0 +1,49 @@
+#pragma once
+class PendingConnection;
+class PlayerConnection;
+class MinecraftServer;
+class Socket;
+class ServerSettingsChangedPacket;
+
+using namespace std;
+
+class ServerConnection
+{
+// public static Logger logger = Logger.getLogger("Minecraft");
+
+private:
+// ServerSocket serverSocket;
+// private Thread listenThread;
+public:
+ volatile bool running;
+private:
+ int connectionCounter;
+private:
+ CRITICAL_SECTION pending_cs; // 4J added
+ vector< shared_ptr<PendingConnection> > pending;
+ vector< shared_ptr<PlayerConnection> > players;
+
+ // 4J - When the server requests a texture, it should add it to here while we are waiting for it
+ vector<wstring> m_pendingTextureRequests;
+public:
+ MinecraftServer *server;
+
+public:
+ ServerConnection(MinecraftServer *server); // 4J - removed params InetAddress address, int port);
+ ~ServerConnection();
+ void NewIncomingSocket(Socket *socket); // 4J - added
+
+ void removeSpamProtection(Socket *socket) { }// 4J Stu - Not implemented as not required
+ void addPlayerConnection(shared_ptr<PlayerConnection> uc);
+private:
+ void handleConnection(shared_ptr<PendingConnection> uc);
+public:
+ void stop();
+ void tick();
+
+ // 4J Added
+ bool addPendingTextureRequest(const wstring &textureName);
+ void handleTextureReceived(const wstring &textureName);
+ void handleTextureAndGeometryReceived(const wstring &textureName);
+ void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet);
+};