How it works – the MACHINE!

View this post on imgur here:


Another shot of our Minecraft generated map of Hyrule. Just so we all know what we’re dealing with here. Check out our last post ( if you haven’t seen it in all it’s 3D blocky goodness!

The Lab
The lab is a giant floating 17×17 chunk cube (well… rectangular prism really), separated far away from the map, encompassing all of the spawn chunk volume for the world. Since spawn chunks are never unloaded from memory, and get the VIP treatment, this is where all of the machines must go.

The Lab Floors
The Lab has 16 floors, with chunk boundaries each marked off by sea lanterns. This has some practical concerns when worrying about the pathological effects of redstone crossing between chunks. But really Mojang’s fixed pretty much all of the problems I’ve seen in that regard. At this point I think it just looks cool 🙂

The Elevator
At the center of the lab is a beacon used as an elevator between floors. No the beacon doesn’t actually do anything silly. It can’t do anything like that. It’s just a stupid beacon. But we’ve got some command blocks which give it its elevatoriness qualities.

The Machine
This is the heart of all the command blocks and redstone for the map. It’s responsible for delegating work and activating different modules appropriately. It can also do your taxes.

The Main Clock
This is the only clock in the game which is always running. It’s a single fill/replace clock, active only within the 16x14x16 block volume containing it. Many previous failed attempts have demonstrated the importance of minimizing the amount of commands used here to prevent lag. The skull shaped command block structure in the bottom right is responsible for tracking. There are 11 command blocks which are scanning East and West Hyrule, as well as the 9 dungeons, for players. When a player is found in one of these 11 areas, it activates one of the region scanners which scan individual screens within 6 different regions.
tl;dr Less command blocks = Less lag (who knew!?)

The Map
An 8×48 glass display which indicates where players are within the world. The first third shows Hyrule, and the second two thirds show the dungeons. While this map isn’t really necessary for any of the gameplay mechanics, why not have a badass map in your badass lab?

The Regions
As mentioned earlier, there are 6 region scanners. These break up the 48 column map into groups of 8 columns a piece. They are marked off by the 6 gold blocks seen on top. When one of these region scanners is activated, it will scan all 64 screens within a particular region. This is all for the sake of preventing the system from always scanning all 384 screens. After trying a few different sized regions, 6 seemed to be a pretty good balance point for this approach. There might have been a more optimal number, but I tell ya, it’s a bitch to reprogram this thing!

The Columns Module
Behind the map, there is a repeated array of screen scanners, each matched up to the column it’s directly behind. Each one tracking when a player has entered or exited a particular screen. In response to transitioning screens, each one of these trackers activates a command block pillar.

The Pillars
These pillars house the command blocks which do the actual work for each screen. They are colored to match the map, but also to match the type of block used for the primary construction within that screen. They’re mostly empty now, since there’s still lots of coding to be done, but the setup is there.

The Three Pillar Types
There are three different types of pillars (color coded from above with green, blue, and red glass), and so the full map is repeated three times for each type of pillar. The green pillars contain the commands which execute once when the player enters a screen. The blue pillars are clocks, which are continuously activating commands while the player is still in that screen. And the red pillars contain commands which are executed once when the player exits a screen. The green pillars are also responsible for starting the blue pillars, whereas the red ones are responsible for stopping them.
tl;dr Different colors do different stuffs because colors are fun!

A Close Up of the Pillars
Here is a close up view of some of the pillars from above, showing how they correspond to the map. In this case, a view of the first 6 dungeons.

The Teleporter
Fitting all of the dungeons underground just didn’t seem worth it. We wanted the ground to be at a reasonable height, so that clouds would look normal. Not to mention, there’s also plenty of caves underground. So between these two considerations, there wasn’t much room left for the dungeons, which are huge. So the player teleports to/from them when they go through the entrances/exits. This machine here is activated by the main clock, whenever the player is detected to be in an entrance/exit, and will teleport them accordingly. We’ve also got buttons on the front for the lazy, to teleport a user from the lab. Why I’ve gone and decided to stick it in between the map and the region scanner is beyond me. It seemed like a good idea at the time, but it’s much less show-off-able now.
tl;dr Fancy looking boot piano thing boots your ass all over the place.

The Server Wrapper
Programming command blocks is a pain in the ass. Seriously. I’ve been programming for years, and this shit has been the most painful experience of any “language” I’ve worked in. It’s like programming highly parallel assembly code. You have to repeat yourself all the damn time. So much for the DRY principle. So what’s a coder to do? A side project of course! Introducing my server wrapper, with support for multiple servers and ad hoc plugins. Now I can write macros in Java which the server will execute, so that I don’t mess up one of the tediously coded command blocks, which only differs from its neighbors by a coordinate.
tl;dr I reinvented the wheel.

A Sample Plugin
Here’s a sample of a plugin I made which creates ellipsoids! Excuse its kludginess. It’s mainly meant to be throw away code which just helps me not have to do repetitive tasks anyway.

Putting it all Together!
Here’s a demo showing it all in action! The bottom right shows a simple run-through. The top right shows the map lighting up in response. The bottom left shows the clock pillars firing up as well. And the top left requires a magnifying glass, but it shows the overall machine responding as a whole. By the way, trans-coding and synchronizing simultaneous screen captures of multiple perspectives into a spliced gif sucks ass! I think I’d rather just go back to my stupidly parallel assembly code.