Evan Pratten
Evan Pratten
Software Developer

As I talked about in my post about Minecraft modpack development, I got back in to playing Minecraft earlier this year. I primairly play on a server full of friends, where the server owner has dynmap installed. Dynmap is a handy tool that provides a near-real-time overview of the minecraft world in the form of a webapp. I always keep Dynmap open on my laptop so I can chat with whoever is online, and see whats being worked on.

While dynmap has a built-in chat log, and the ability to send chats, the incoming chat messages do not persist, and the outgoing chat messages don't always show your in-game username (but instead, your public IP address). Since I always have an IRC client open, I figured that making use of my IRC client to generate a persistent chat log in the background would be a good solution. Unfortunately, I could not find anyone who has ever built a Minecraft <-> IRC bridge. Thus my project, chatster, was born.

The most basic IRC server consists of a TCP socket, and only 7 message handlers:

Message TypeDescription
NICKHandles a user setting their nickname
USERHandles a user setting their identity / username
PASSHandles a user authenticating with the server
PINGA simple ping-pong system
JOINHandles a user joining a channel
QUITHandles a user leaving a channel
PRIVMSGHandles a user sending a message

On the Minecraft side, the following subset of the in-game protocol must be implemented (I just used the pyCraft library for this):

The whole idea of chatster is that a user connects to the IRC server using their Mojang account email and password at their IRC nickname, and server password. The server temporarily stores these values in memory.

Connecting to a server is done via specific IRC channel names. If you wanted to connect to mc.example.com on port 12345, you would issue the following IRC command:

/JOIN #mc.example.com:12345

Upon channel join, the server opens a socket to the specified Minecraft server, and relays chat messages (along with their sender) to both Minecraft and IRC. This means that ingame users show up in your IRC user list, and you can send commands and chats to the game.