Home›Java›Mods›Datapack TCP
Datapack TCP
ModsJava

Datapack TCP

Java mod listed for Minecraft 26.x. Downloads from the MC Java Mods app on Android.

by facetorched · on Modrinth

⬇ Download on Modrinth

Datapack TCP is a mod that connects Minecraft to external programs. It opens a TCP socket that streams game information such as scoreboards and chat messages outwards and commands inwards, allowing internal datapacks and external programs to work together.

Usage

The mod runs a TCP server alongside your Minecraft server (default is localhost: 127.0.0.1, default port: 25566).

Communication is handled via JSON Lines. Every payload sent to or from the server must be a single-line, valid JSON object, terminated by a newline character (\n). Any number of clients (such as Python scripts) can connect to receive/send payloads.


Client -> Server Protocol

command

Executes a Minecraft command as the server console.

Example:

{"type": "command", "command": "summon zombie ~ ~ ~", "id": "spawn_zombie_1", "tick": 2333}

Server -> Client Protocol

command_result

When a client sends a command, the server executes it and sends the result back to the client that requested it.

Example (success):

{"type": "command_result", "command": "summon zombie ~ ~ ~", "success": true, "result": 1, "id": "spawn_zombie_1", "tick": 2333}

Example (failure):

{"type": "command_result", "command": "summon zombi ~ ~ ~", "success": false, "error": "Can't find element 'minecraft:zombi' of type 'minecraft:entity_type' at position 12: ...mmon zombi<--[HERE]", "id": "spawn_zombie_1", "tick": 2333}

scoreboard

Sent when a client first connects, providing the current state of all scoreboards.

Example:

{"type": "scoreboard", "tick": 24000, "scoreboard": {"kills": {"Player1": 5,"Player2": 12}, "round": {"#current": 3}}}

scoreboard_change

Sent when one or more scores are changed, and contains only those changes.

Example (after Player1 gets a kill):

{"type": "scoreboard_change", "tick": 24025, "scoreboard": {"kills": {"Player1": 6}}}

chat_message

Sent when a player sends a normal chat message.

Example:

{"type": "chat_message", "tick": 24050, "sender": "Player1", "message": "Hello world!"}

command_message

Sent when a command broadcasts a message to chat (e.g., /me, /say).

Example:

{"type": "command_message", "tick": 24055, "source": "Server", "message": "Server restarting in 5 minutes"}

game_message

Sent when the game posts a message, such as player join/leave events or death messages.

Example:

{"type": "game_message", "tick": 24060, "overlay": false, "message": "Player2 fell from a high place"}

Configuration

Option Default Description
port 25566 The TCP port to use.
host "127.0.0.1" The IP address to use. Default is localhost.
streamScoreboard true Enables sending the scoreboard.
scoreboardChanges true Enables sending only scoreboard changes. Otherwise send full scoreboard every tick.
streamChatMessages true Enables sending player chat messages.
streamCommandMessages true Enables sending command message events (e.g., /me, /say).
streamGameMessages true Enables sending game message events (e.g., join/leave, death messages).
acceptCommands true Allows clients to send commands for the server to run.
returnCommandResults true Enables sending command results back to clients.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

File checked by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more