kuwa 182d76f391 Introduce uid.dat (offline PlayerUIDs), fix multiplayer save data persistence (#536)
* fix: fix multiplayer player data mix between different players bug

Fixes a Win64 multiplayer issue where player data (`players/*.dat`) could be mismatched because identity was effectively tied to connection-order `smallId` XUIDs.
Introduces a deterministic username-derived persistent XUID and integrates it into the existing XUID-based save pipeline.

- Added `Windows64_NameXuid` for deterministic `name -> persistent xuid` resolution
- On Win64 login (`PlayerList`), set `ServerPlayer::xuid` from username-based resolver
- Aligned local player `xuid` assignment (`Minecraft`) for create/init/respawn paths to use the same resolver
- Added Win64 local-self guard in `ClientConnection::handleAddPlayer` using name match to avoid duplicate local remote-player creation
- Kept `IQNet::GetPlayerByXuid` compatibility fallback behavior, while extending lookup to also resolve username-based XUIDs
- Moved implementation to `Minecraft.Client/Windows64/Windows64_NameXuid.h`; kept legacy `Win64NameXuid.h` as compatibility include

Rename migration is intentionally out of scope (same-name identity only).

* fix: preserve legacy host xuid (base xuid + 0) for existing world compatibility

- Add legacy embedded host XUID helper (base + 0).
- When Minecraft.Client is hosting, force only the first host player to use legacy host XUID.
- Keep name-based XUID for non-host players.
- Prevent old singleplayer/hosted worlds from losing/mismatching host player data.

* update: migrate Win64 player uid to `uid.dat`-backed XUID and add XUID based duplicate login guards

- Replace Win64 username-derived XUID resolution with persistent `uid.dat`-backed identity (`Windows64_Xuid` / `Win64Xuid`).
- Persist a per-client XUID next to the executable, with first-run generation, read/write, and process-local caching.
- Keep legacy host compatibility by pinning host self to legacy embedded `base + 0` XUID for existing world/playerdata continuity.
- Propagate packet-authoritative XUIDs into QNet player slots via `m_resolvedXuid`, and use it for `GetXuid`/`GetPlayerByXuid` with legacy fallback.
- Update Win64 profile/network paths to use persistent XUID for non-host clients and clear resolved identity on disconnect.
- Add login-time duplicate checks: reject connections when the same XUID is already connected (in addition to existing duplicate-name checks on Win64).
- Add inline compatibility comments around legacy/new identity coexistence paths for easier future maintenance.

* update: ensure uid.dat exists at startup in client mode for multiplayer
2026-03-06 00:01:36 -06:00
2026-03-05 15:33:38 -06:00
2026-03-01 12:16:08 +08:00

MinecraftConsoles

Discord

Tutorial World

Introduction

This project contains the source code of Minecraft Legacy Console Edition v1.6.0560.0 (TU19) from https://archive.org/details/minecraft-legacy-console-edition-source-code, with some fixes and improvements applied.

Nightly Build

Platform Support

  • Windows: Supported for building and running the project
  • macOS / Linux: The Windows nightly build may run through Wine or CrossOver based on community reports, but this is unofficial and not currently tested by the maintainers

Features

  • Fixed compilation and execution in both Debug and Release mode on Windows using Visual Studio 2022
  • Added support for keyboard and mouse input
  • Added fullscreen mode support (toggle using F11)
  • (WIP) Disabled V-Sync for better performance
  • Added a high-resolution timer path on Windows for smoother high-FPS gameplay timing
  • Device's screen resolution will be used as the game resolution instead of using a fixed resolution (1920x1080)
  • LAN Multiplayer & Discovery
  • Added persistent username system via "username.txt"

Multiplayer

Basic LAN multiplayer is available on the Windows build

  • Hosting a multiplayer world automatically advertises it on the local network
  • Other players on the same LAN can discover the session from the in-game Join Game menu
  • Game connections use TCP port 25565 by default
  • LAN discovery uses UDP port 25566

This feature is based on LCEMP

Launch Arguments

Argument Description
-name <username> Sets your in-game username.
-server Launches a headless server instead of the client.
-ip <address> Client mode: manually connect to an IP. Server mode: override the bind IP from server.properties.
-port <port> Client mode: override the join port. Server mode: override the listen port from server.properties.

Example:

Minecraft.Client.exe -name Steve -ip 192.168.0.25 -port 25565

Headless server example:

Minecraft.Client.exe -server -ip 0.0.0.0 -port 25565

The headless server also reads and writes server.properties in the working directory. If -ip / -port are omitted in -server mode, it falls back to server-ip / server-port from that file. Dedicated-server host options such as trust-players, pvp, fire-spreads, tnt, difficulty, gamemode, spawn-animals, and spawn-npcs are persisted there as well.

Controls (Keyboard & Mouse)

  • Movement: W A S D
  • Jump / Fly (Up): Space
  • Sneak / Fly (Down): Shift (Hold)
  • Sprint: Ctrl (Hold) or Double-tap W
  • Inventory: E
  • Drop Item: Q
  • Crafting: C Use Q and E to move through tabs (cycles Left/Right)
  • Toggle View (FPS/TPS): F5
  • Fullscreen: F11
  • Pause Menu: Esc
  • Attack / Destroy: Left Click
  • Use / Place: Right Click
  • Select Item: Mouse Wheel or keys 1 to 9
  • Accept or Decline Tutorial hints: Enter to accept and B to decline
  • Game Info (Player list and Host Options): TAB
  • Toggle HUD: F1
  • Toggle Debug Info: F3
  • Open Debug Overlay: F4
  • Toggle Debug Console: F6

Build & Run

  1. Install Visual Studio 2022.
  2. Clone the repository.
  3. Open the project by double-clicking MinecraftConsoles.sln.
  4. Make sure Minecraft.Client is set as the Startup Project.
  5. Set the build configuration to Debug (Release is also OK but has some bugs) and the target platform to Windows64, then build and run.

CMake (Windows x64)

cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Debug --target MinecraftClient

For more information, see COMPILE.md.

Known Issues

  • Native builds for platforms other than Windows have not been tested and are most likely non-functional. The Windows nightly build may still run on macOS and Linux through Wine or CrossOver, but that path is unofficial and not currently supported

Contributors

Would you like to contribute to this project? Please read our Contributor's Guide before doing so! This document includes our current goals, standards for inclusions, rules, and more.

Star History

Star History Chart

Description
A certain block game
Readme 3.1 GiB
Languages
Arc 66.5%
PLSQL 18.1%
C++ 13.3%
Self 1.2%
C 0.9%