←  Command Programs

ComputerCraft | Programmable Computers for Minecraft

»

mapArt

Bomb Bloke's Photo Bomb Bloke 02 Aug 2017

pastebin get gHPs67vj mapArt

Posted Image


So for a while I'd been thinking about making a terminal object which draws directly to Minecraft maps. It would've been neat, but it turns out that's not viable - there's no way to write map data directly from in-game. Short of using external software tools, the only way to modify a map's content is for a player to actually view that map near its associated terrain.

Hence this Command Computer script, which instead generates single terrain "images" according to whatever GIFs you feed it, using what's dubbed "the staircase method".

On first run, the script will offer to "prepare" the build area. Doing so moves the computer and player to the middle of the mapping zone, and re-running the script from that location will trigger the option to actually construct your images.

Each individual map holds 128x128 pixels (regardless of its zoom level). Images are scaled accordingly, but you can opt to spread them out over multiple maps if you want higher resolutions (in which case each section is generated in order from left to right, top to bottom). The script automatically gives you a new map to store the art in as each build completes - simply open it to record that section of image data, and then move it away from your hotbar before telling the script to continue.

Builds are performed at the nearest suitable location to your computer, and are heavily destructive to any pre-existing terrain there. Server time slows to a crawl while the script is active, and it may take a minute or so for the clock to "catch up" after a build.

Once a map is complete, you can safely fill the area back in (or build a new map in that same area) so long as you do not view your old maps in that area again. Perform your builds somewhere remote, and then take your maps back to your home base for display in item frames.

Later versions of Minecraft have better colour depth, but the script should be able to automatically figure out what's available in whatever version you have installed.

Version History

Edited by Bomb Bloke, 10 August 2017 - 12:38 AM.
Quote

Dave-ee Jones's Photo Dave-ee Jones 02 Aug 2017

So it generates the picture onto actual MC terrain, making the map use the terrain as the picture? So does that mean if you flew up really high you could see the picture on the terrain too? :P

Pretty clever workaround, but it makes sense.
Quote

Bomb Bloke's Photo Bomb Bloke 03 Aug 2017

You'd need to fly up pretty high, but yes.

The idea is that there're a limited number of blocks that appear with unique colours on a map, but you can adjust their shade by messing with their height relative to whatever's to their direct north. This means that images are made up of "wavy tendrils" - they're pretty hard to make out unless you use a map.
Quote

Lyqyd's Photo Lyqyd 04 Aug 2017

Would it be sensible to provide an option in the script to teleport the user to the appropriate map-starting location and then wait for a signal from the user (chat message?) before teleporting them around throughout the area in order to gather the map data? Seems like a way to streamline the production of the actual map once the build is complete.
Quote

Bomb Bloke's Photo Bomb Bloke 06 Aug 2017

I eventually realised that I could simply stick both the computer and the player slap bang in the middle of the building area, so long as I leave them near bedrock level. From there you can fully record any maps without having to move any further at all, and it also resolves any potential chunk-loading issues. So on first run the script now offers a "prepare" button which performs this move, and the "fill" button also moves the computer + player back up to the surface.

I've furthermore added an option to select which map number to start building from (handy for resuming larger builds), and cleaned out a couple of bugs.
Quote

LoganDark2's Photo LoganDark2 20 Jan 2018

Why would you waste such an awesome program by using it to draw anime images?
Quote

Bomb Bloke's Photo Bomb Bloke 23 Jan 2018

Colour depth. There isn't enough for photos to come out well, but more simplistic drawings would undersell it.
Quote