This post is about the software I created for the L1T Minecraft Server. This is in no way anything official. AFAIK there is no official dynmap.
I’ve noticed that the L1T server has no dynmap available. So I set out to fix that!
How you might ask? The unix way
Of course I don’t have access to the server, where dynmap plugins usually reside. But my client can render a ingame-map just fine, using mods like Xaero’s World Map. I’ve noticed that it even has a export-png function. And that’s all we’ll need!
In the github repo, there are a bunch of scripts.
It works like this:
Ingame, you press the +
key to open the options for the world map, then press Export PNG
. This writes the exported world map data to ~/.minecraft/map exports/
.
The watch.sh
script watches that directory using inotifywait
, and calls update.sh
when the files inside that directory have changed.
update.sh
gets the latest image from the exports directory, and upscales it to the various versions. It also creates a tarball of the current directory.
The dynmap is now mostly updated. You can use it now, and if you’ve used the start.sh
script to start this setup, the busybox httpd should now serve the dynmap at http://0.0.0.0:8080/
.
For my setup though, another step is necessary, because my host computer isn’t always available. I’ve added a simple script to download the tar archive created in update.sh
(also served via the httpd), and extract it on my server periodically, so the dynmap stays online, even if the computer I play Minecraft on doesn’t.
The rest of the magic happens in the browser. I’m using a Javascript to render the actual map. Don’t look at the code to long, or it might catch on fire. I’m not using any libraries at all, just straight DOM.
Basically, the map is the background image of a div, and the background image position is used to scroll the map. Essentially, the map works by manipulating CSS variables via Javascript!
One thing to note is that the exported .png doesn’t have any position information; Getting the “block position” based on a click requires manual calibration(In offsets.js
, along with the default scroll position). This is why the reported block positions might be (slightly) off sometimes…
Also the map is only as accurate as the creator’s exploration - if something changes, and I’m not close, the map will not reflect that change. Please tell me what(where) I should map!
I’m also currently implementing markers for the map.
If you want to add a marker for anything(your house, a shop, public nether portals etc.), please the block position and a short display name below! Preferably also your IGN. This could also be useful just as a list of POI’s. Maybe also create a list at spawn soon? Just a thought…
As for other features - the map is of course limited by the way it’s created, so I don’t think it will ever have player positions etc.
My Server hosts the dynmap here. Again, not official, definitely running on my cheap german VPS.