Connecting to a Minecraft server over IRC

For server administration, or just chatting with friends

2020-11-21 minecraft project irc

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 Type Description
NICK Handles a user setting their nickname
USER Handles a user setting their identity / username
PASS Handles a user authenticating with the server
PING A simple ping-pong system
JOIN Handles a user joining a channel
QUIT Handles a user leaving a channel
PRIVMSG Handles 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.



Thank you for reading this post. If you enjoyed the content, and want to let me know, or want to ask any questions, please contact me via one of the methods listed here. If you would like to be notified about future posts, feel free to load my rss feed into your favorite feed reader, or follow me on Twitter for notifications about my work and future posts.

If you have the time to read some more, I recommend checking out one of the following posts:

My first mechanical keyboard: The Vortex Core
I recently purchased my first mechanical keyboard, and decided to go "all in" with a 40% layout.
Using Bazel to create Minecraft modpacks
I decided to modernize my system for producing builds of my personal Minecraft modpack using the Bazel buildsystem.
Mounting Google Drive accounts as network drives
I can never get the Google Drive webapp to load quickly when I need it to. My solution: use some command-line magic to mount my drives directly to my laptop's filesystem.


Made with ♥ by Evan Pratten | RSS | API Status