• Software
  • Cookbook
  • Software
  • Cookbook
  • Home
  • Rand
    • Minecraft Sucks
  • Docs
    • SPA Deployments in AWS
    • Minecraft Server Administration
    • Test Harness for Postgres Integrations
    • Enterprise REST API
  • Cookbook
    • Cookies
    • Muffins
    • Pasta

Minecraft Sucks

tl;dr

I die a lot in Minecraft and lack the patience to recollect my belongings. So I checkpoint the world directory, and am able to do so with bash because - btw - I run a local server on Linux.

My gaming rig was recently repurposed into a Home Lab, and is now dishing out tasty morsels to my home network via Fedora Server.

And so, in order to continue playing this wretched and boring game, I decided that I would just run Java Minecraft's server.jar on top of my beefy, GPU-laden tower, and connect to it from a more lightweight, more foldable machine. It actually works really well, my laptop runs cool while in-world, and my Home Lab doesn't care too much about the workload. Who could have predicted that two computers would run Minecraft better than one? /s

Anyway, I have a 45-ish-minute attention span for this boring and wretched game. I am also addicted. I am also, also, not very good at it. I find myself chasing the dragon of what was at one point an awesome experience. I rememember - in detail - my first time navigating to a Woodland Mansion, and after figuring out that you could simply put Librarians in boxes and roll the job block until you got Mending, I spent hours trapping and caging villagers to do my bidding.

But now? I don't know. My capacity and patience for the game seems to be inversely proportional to its percieved newness. And the game demands patience.

Speedrunning aside, to beat the game on a random seed requires you to travel, usually very far. You can forego some of this travel by looking up content-rich spawns on your favourite search engine, but my opinion is that that diminishes the game's magic.

With the added detriment of being not-great at the game, I tend to die a lot. If I'm two hours into a world, in what is likely my third session, and I die in the nether 800 blocks from my portal at level 25? I'm never opening the world again. I'd rather start a new game, hand-mine four logs, work my way to a set of cobblestone tools, and alt-f4 the voxels into oblivion.

So the loop perpetuates.

A couple fun facts about me are that I happen to be solution-oriented, loss-averse, and - frankly - really in need of a hit of the good stuff - a new world with imprisoned villagers and cows packed so tightly into a 1xN grid that they start self-selecting into beef patties due to collisions.

I've long since accepted that Mojang has no interest in solving this for me, but by happenstance of a local Minecraft server, the solution is actually pretty simple.

I'll note that this solution doesn't at all require you to be running a server, the same files are created somewhere in your %appdata% folder. I happen to be comfortable on Unix systems so the solution only occurred to me once the game no longer required me to think about PowerShell.

It's basically just two bash scripts that assume default values in server.properties (primarily world name "world"). A checkpoint script to save. These scripts assume you have the server enabled as a service.

checkpoint
#! /bin/bash

sudo systemctl stop minecraft.service
rm -r ~/minecraft/world_checkpoint
cp -r ~/minecraft/world ~/minecraft/world_checkpoint
sudo systemctl start minecraft.service

This stop/start of the server means that you'll get disconnected if you don't do so proactively. Remove those lines if you would rather just leave it running. Apparently it still works, but I really hate losing progress so I don't even risk it.

And a restore_checkpoint script to reset the game when you die.

restore_checkpoint
#! /bin/bash

sudo systemctl stop minecraft.service
mv ~/minecraft/world ~/minecraft/world_backup
cp -r ~/minecraft/world_checkpoint ~/minecraft/world
rm -r ~/minecraft/world_backup
sudo systemctl start minecraft.service

This script does require that you disconnect as you'll be overwriting the game in which you're currently dead.

I currently run checkpoint manually at points in the game when my confidence is low - caving, night time, and like, every 100 blocks in the nether - but you could easily enough implement the Factorio mechanic with cron.

Here's the service file if you want it. Replace $USER with your nonroot username.

service
# /etc/systemd/system/minecraft.service

[Unit]
Description=Minecraft Server
After=network.target

[Service]
WorkingDirectory=/home/$USER/minecraft
User=$USER
Group=$USER
Type=simple
Restart=on-failure
ExecStart=/home/$USER/minecraft/start.sh

[Install]
WantedBy=multi-user.target

Which relies on start.sh.

start.sh
#!/bin/bash
/usr/bin/java -Xmx8G -Xms4G -jar /home/sigh/minecraft/server.jar nogui

So ya, Minecraft is way better when you can die and just go back to the start of the Bastion/mouth of the cave. I'm also conveniently getting a lot better at those things and starting to die less. I'm sure modders have found way better ways to go about this, but for me this is fine.