Local Minecraft proxy with a small GUI for poking at how a server handles container packets: closing a GUI on one side only, holding clicks back, replaying an old screen, sending clicks the client never made. It's the feature set of the UI Utils client mod, rewritten from scratch in Rust as a proxy, so you don't need a mod and you don't need to restart the game
The point is dupe hunting on servers you run or are allowed to test. Plugins that use inventories as menus (shops, auction houses, crates) tend to trust that client and server agree on which container is open, and this tool makes them disagree on purpose
Minecraft --> 127.0.0.1:25599 (ghostslot) --> server
Works from 1.19.2 up to 26.3 (protocols 760 to 777), the version comes from the handshake
cargo run --release
cargo run --release -- --target play.example.net --port 25599 --autostart
you need a JDK on the PATH (javac and jar) because build.rs compiles the Java agent
and embeds it into the binary. Windows build from Linux:
cargo build --release --target x86_64-pc-windows-gnu # needs mingw64-gcc
Then:
- set the target server (
hostorhost:port, without a port it tries the SRV record) - pick an account if the server is in online mode and press Start proxy
- in Minecraft join
127.0.0.1:25599
--autostart starts the proxy right away and, if it finds a running Fabric client, moves it
into the proxy by itself (see below). --no-join turns that off, --verbose copies the
log to stderr
Tests:
cargo test
cargo test -- --ignored # loads the agent into a real JVM, needs a JDK
| Feature | What happens |
|---|---|
| Close without packet | the client closes the GUI, the server keeps it open |
| De-sync | the server closes the container, the client keeps showing it |
| Send packets (off) | the client's container_click and container_button_click are dropped |
| Delay packets (on) | the same packets wait in a queue instead of going out |
| Send / Discard queue | release or throw away what's held |
| Disconnect and send packets | flush the queue and cut the connection right after |
| Save GUI / Load GUI | replay the last open_screen and its contents to the client |
| Unload chunks | the client forgets every loaded chunk, the server still thinks they're loaded |
| Fabricate | send container_click (window, revision, slot, button, mode, repeat) or container_button_click, now or into the queue |
The top of the panel always shows the client screen, the server container and the current revision (stateId), and turns red when client and server disagree. The log shows container packets, tick all to see everything else too
With --stdin the same things can be scripted, handy for repeating a sequence:
close | desync | save | load | unload | send on|off | delay on|off
flush | discard | disconnect | status
click <win|-> <rev|-> <slot> <btn> <MODE> [times] [queue]
button <win|-> <id> [times] [queue]
- means the current value
Proxy. It listens on 127.0.0.1 only and takes one player at a time. It parses frames in both directions, tracks login, configuration and play state separately for each direction (they switch at different moments since 1.20.2) and only decodes the handful of packets it cares about, everything else goes through byte for byte. Compression is handled with the threshold the server sets, injected packets are compressed the same way
Online mode. The client talks to the proxy unencrypted, and the proxy does the real
login: it answers the server's encryption request, calls sessionserver.mojang.com/join
with the account's token and switches to AES/CFB8 towards the server. The token comes from
two places:
- the command line of the running game, if the launcher passes
--accessToken(CurseForge and the vanilla launcher do) - Prism Launcher's
accounts.jsonotherwise. Prism refreshes it on game start and it lasts around 24h
the token stays in memory and never goes anywhere other than the session server
Packet ids. data/protocols.json has the ids of the packets used, per protocol. It's
generated by tools/gen_protocols.py: from 1.21 on out of the vanilla data reports
(java -DbundlerMainClass=net.minecraft.data.Main -jar server.jar --reports), before that
from PrismarineJS minecraft-data. A new version is one more folder and a rerun
Auto join. On Linux it talks to HotSpot's attach socket directly, the same thing jcmd
does: create .attach_pid<pid>, send SIGQUIT, wait for /tmp/.java_pid<pid> and ask it to
load instrument the agent jar. On Windows there's no socket, so a tiny helper runs the
official Attach API through java.exe. Inside the game the agent disconnects from the
current server and calls ConnectScreen.connect on the proxy, all by reflection with Fabric
intermediary names
- a running JVM keeps the first version of an agent class it loaded, so a rebuilt agent
did nothing until the game restarted.
Loadernow loads the real agent from a fresh class loader on every attach, and every build of the jar gets its own file name - some modpacks ship wireguard-tunnel, which pushes every connection through Cloudflare
WARP,
localhostincluded, so the client never reached the proxy. The agent flips its flag in memory only and it's back after a restart. Note that with WARP off the server sees your real IP - the empty carried item at the end of
container_clickchanged format three times (bool, count 0, absent HashedStack) but luckily all three are a single zero byte forget_level_chunkswapped x and z in 1.20.2- GUI titles went from JSON strings to network NBT in 1.20.3. There's no NBT parser
here, it just pulls the
textandtranslatestrings out, which is enough to tell GUIs apart - the runtime bundled with launchers on Windows has no
jdk.attachmodule, so auto join there needs a real JDK 17+ installed orJAVA_HOMEset
- auto join is Fabric only and was checked on 1.19.2. Forge and vanilla clients can still
join
127.0.0.1:25599by hand - it won't move a client out of a singleplayer world, leave the world first
- tested end to end on offline vanilla servers with a mineflayer bot on 1.19.2, 1.20.4, 1.21.1, 1.21.4, 1.21.8, 1.21.11 and 26.1. A real online-mode login hasn't been tried yet
- servers with an anticheat will very likely notice fabricated clicks with a stale revision, that's kind of the point of testing it
MIT, see LICENSE. UI Utils is a separate project under its own license, no code from it
is used here, only the ideas behind its buttons
Paolo ti amo, if you got this far you read the whole thing and I owe you a beer