Loading an entire Minecraft structure using structure blocks
I've experimented a bit with structure blocks in the past and I know how to load single structures using them. For example, if I wanted to load in an End Ship or Fossil I would just select the corresponding structure file in the block GUI and click load. However, what if I wanted to spawn an entire structure using only structure blocks (no mods or editors)? Like a full End City, Nether Fortress, etc.? I can't find any tutorials online for how to do that. Any answers would be much appreciated.
First let's start with fundamentals:
- Powering up (providing a redstone pulse) a structure block activates its current primary function (load or save). This allows for automation of loading structures.
- The structure saved by a structure block can contain other structure blocks (or even itself - which is the endless source of confusion for new players, "why does my LOAD block incessantly convert to SAVE block?" - because it's inside the structure, and at the moment you saved the structure, it was a SAVE block, so you recovered it to the prior state.)
Warning: including a LOAD block in its own structure (saving it under the same name with a separate SAVE block) combined with the subsequent trick is extremely dangerous. It's a mighty powerful technique but incredibly easy to go run-away, and then there are dire consequences. This technique will not be required for what we want to achieve, but it's still easy to do accidentally so always double-check that you don't recurse your chain infinitely.
- Observers that are parts of a structure fire immediately after the structure containing them is loaded. That means an observer which is pointed into a structure block, as part of a structure, will immediately activate that structure block.
...and the newly-loaded structure can contain other structure blocks with their own observers, and so on - you can see where it's going? This is already the set of tools necessary to save and restore any static build of arbitrary size - by segmenting it into separate structures and loading them all from the 'root'.
- Alternate Realities.
The above has one disadvantage - leaves structure blocks and observers scattered everywhere. How do we deal with it? By having two versions of the 'reality' saved.
Here we have two structures - a sandstone one and a planks one. The structure blocks have been placed in such a way that there's an overlap between the two. The left structure block will be our 'root' from which the whole thing spawns, starting with the sandstone part. The right one is outside the plank structure, and used to save a "pristine" version of it - no structure blocks, no observers.
Then after saving it, we alter the reality - add a LOAD structure block to within its own structure volume, and an observer - separated by an extra solid block so that we don't trigger both structure blocks at once. We don't touch the SAVE block of the plank structure - it already holds a 'clean' version we want as final. Instead, we use the SAVE block of the sandstone structure.
Now if we load the 'root' sandstone structure, it also loads the LOAD block for the planks piece, alongside with its observer. The observer fires, and a variant of the planks piece is loaded without the structure block and observer - overwriting, deleting them.
Chaining structures like that you can spawn an arbitrarily big build from one structure block -and- erase the 'construction' parts.
Worth adding: if you don't want to erase terrain around your structures, learn to love the structure void block - the structures save and restore minecraft:air
like any other block, while structure void is a special sort of air that doesn't replace whatever was there before.
In case you want to randomize the generation - just a brief description of the concept: It's possible using a set of tricks very much like the above - but instead of inevitably loading the one fixed structure block included in the parent structure, we include a line of structure blocks containing a range of 'alternative' structures; save and later spawn a special 'technical' structure containing a redstone randomizer which selects one of the alternatives from the array included in the 'parent' (and then promptly erases itself by loading in a structure consisting of only air in its own place) and so, spawns a randomly selected 'continuation' which may itself be a 'leaf' of the tree structure (end of branch generation), branch (more variants at the end) or a fork (multiple sets of arrays of structures branching in different directions). It's essential to balance the number of 'leaves' and 'forks' or your structure will go runaway spreading infinitely. It's also possible to add a special 'terminus' structure that will stop the entire generation if ever spawned - instead of more LOAD blocks loading more branches, loads a replacement for the randomizer which only ever selects leaf structures (say, "#1" alternative is always a "leaf" and this one only ever activates alternative#1 instead of a random one), then auto-trigger a SAVE block that saves the replacement under the same name as the randomizer structure, making any subsequent attempts to spawn a randomizer by other branches, spawn the replacement that terminates them.