Minecraft Builder Code

This post will examine a code library that you can import, modify and run to quickly build complex structures in Minecraft E:E. This library may change over time as more features are added. Please be careful when making modifications as there is quite a bit of code now and you may accidentally break something. If that happens you can always start again by re-importing the code.

Most of the commands will require you to have the operator permission in the world. This is due to the powerful nature of the builder to create large ‘world changing’ structures. The builder is different to the agent as it is invisible and has more powerful commands. To position the builder using the tpb (teleport builder) and bt (builder turn) commands which are described below. When using these commands to build structures they are always built in a forward and right direction. While building a structure the builder will move but should always return to the starting point.

Structure Builder Commands

NameParametersDescription & Example
help(none)Displays a list of all the available command in the chat window.
clrx, y, zClears all blocks in a rectangular prism in the forward and left direction. E.g. ‘clr 10 5 8’ will clear a space that is 10 blocks wide, 5 blocks high and 8 blocks long.
rex, y, zCreates a rectangular prism (filled) with the current block. E.g. ‘re 5 3 7’ will create a rectangular block that is 5 blocks wide, 3 blocks high and 7 blocks long.
wallsx, y, zCreates 4 walls using the current block. E.g. ‘walls 6 4 3’ will build a rectangular set of 4 walls that are 6 blocks long, 4 blocks high and 3 blocks wide.
beacon1-5Creates a beacon of different sizes. The number is the width of the beacons in the middle. E.g. beacon 3 will create a beacon that is 3 x 3 blocks on an iron block base that is 5 x 5.
block0-NSelects the current block from the block list. E.g. ‘block 2’ will set all the current block to bricks.
blocks(none)Displays a list of blocks numbers that can be used by the ‘block’ command.
blockr(none)Randomises the current blocks to any blocks in the block list. Use the ‘block 0’ command to reset the blocks.
blocku0-3, 1-N
pyrx, zCreates a pyramid (roof) like structure of x width using the current block. E.g. ‘pyr 20’ will create a pyramid that is 20 blocks wide at the base. This can also do rectangular based pyramids like a house roof.
housex, y, zCreates a house of length x, height y and width z. Uses blocks from the block list (base, walls, window, roof). E.g. ‘house 8 3’ will create a house that is 8 blocks wide (on the outside) and 3 blocks high (not including the roof) with windows on opposite walls and a doorway. Now also contains a bed and torches.
boxx, y, zCreates an empty rectangular structure using the current block and no base and lighting strips in the roof. E.g. ‘box 10 7’ will create a box like structure that is 10 x 10 blocks wide and 7 blocks high.
tpb(none)Teleports builder to current location. This will place blocks to indicate the location and direction the builder is facing. Red is where the builder is positioned and green is the direction it is facing. Default direction is east.
bmx, y, zMoves builder blocks forward (x), up (y) and left (z). Numbers may be negative for the opposite directions.
bt(0, 1, -1)Turns the builder to right (1) or left (-1). If you enter 0 or any other number it will place the position indicators so you can see where the builder is located and the direction it is facing.
stairsUpx, y, zCreates a series of rectangular steps (x, z) that is y blocks high. Also clears space above each step so you can use it underground.
stairsDnx, y, zSame as stairs up but goes downward instead.
tunx, y, zCreates a tunnel by clearing blocks and placing a lighting strip on the roof
tubex, y, zCreates a tunnels with walls, floor and ceiling with lighting strips
cpx, y, zCopies blocks relative to builder location into memory. Use the paste command to clone to new location.
psNPaste (clone) blocks copied using cp command to builder location
labx, zTeleport to the lab in current territory (x and z should have values 0-15). E.g. Lab 10 10. You must be close by go to a lab. Use the where command to identify the area you are in. Use the tparea command to teleport to a different area. The lab coordinates are the same as the area coordinates that it is located within.
tpareax, zTeleport to specified area in current region (x and z should have values 0-3). Each area is a 64 block wide square
where(none)Shows current area, region and territory coordinates
houseu1-3, 1-NChanges specific items in the block usage list used by the code and rebuilds the house. 1-floor, 2-wall, 3-roof
houser1-3Selects a random item from the block list to replace the component and rebuilds the house: 1-floor, 2-wall, 3-roof

Structure Builder Code URLs

VersionURLNotes
2.29https://makecode.com/_hRrgX9CJCWd8I’ve split this code library into 2 parts now. The lab functions have been removed (see section below). House command updated to include bed and torches. New command to update a house part (houseu) and also to randomise a part and rebuild the house (houser). Removed blockshow, compass, roof, tpbst, tpreg, tpterr and wall commands. tpb command now places a structure block where the builder is located.
2.27https://makecode.com/_YPybHvALmA06Some more bug fixes and message additions.
2.25https://makecode.com/_UAJD6EXp6FUjAdded copy list so you can copy multiple structures and paste them. Labs now have compass directions on the walls and chunk numbers written in the ground. Added pslc (paste lab chunk).
2.24https://makecode.com/_3Ph43j3FEb2cAdded blockshow and blocku commands. Renamed a few others and internal cleanup. Over 1000 lines now. Others can now safely customise blocks using published block names and data values.
2.23https://makecode.com/_J8jACWcd4c5vAdding commands to copy and paste lab chunks (15×15). Labs have chunk corner indicators using glowstone. Also double walls to prevent water entry. Nearly 1000 lines of code!
2.22https://makecode.com/_Js8Dkd2zE1zMAdded default values for commands and more helpful error messages. Added tpbs command to teleport builder and place structure block at the same location. Changed makelab. Added roof and agent (tp agent) command.
2.21https://makecode.com/_15sfzkJUvhF1House command now supports width – no more square houses. Roof uses stair block and so do stairs.
2.20https://makecode.com/_20XXVLcCj8r2Added over 40 blocks to the block list (78 now).
2.19https://makecode.com/_F4yLAqVcMdpXAdded blockadd to add blocks from the agent inventory into the block list and replace commands to replace blocks in a region.
2.18https://makecode.com/_X7MiiuJKY2MjFixed bug with diamonds. Changed blockr to randomly select materials for floor, walls and roof. Using the block command sets the floor walls and roof to the same block (not the windows).
2.17https://makecode.com/_gJVTpu4r7bUqAdded blockr command to randomise the build block
2.16https://makecode.com/_PJM3i86JqWcxAdded commands and blocks to build with: builder move (bm), tp to lab (lab), beacon, tp to area (tpa), tp to territory (tpt). House now uses current block if it has been changed.
2.15https://makecode.com/_dgDXzFgHvH1JAdded labcopy and labpaste commands to duplicate a whole lab.
2.14https://makecode.com/_UhRetbaf40HmChanged build direction to be forward and to the right. Default builder direction is east.
2.13https://makecode.com/_V6HJFoM7uD6jAdded blocks command to list all blocks that can be selected by the block command
2.12https://makecode.com/_R8i7guXMP1YEChanged stairs command to stairsUp and stairsDn (down)
2.11https://makecode.com/_YtdeCu0hjCbMAdded makelab command to create a lab in a specific area of the current region. Removed scaff and clrarea commands.
2.10https://makecode.com/_MywbrAHYFH4qAdded lab command to teleport to specific lab in current region. Removed unnecessary use of global variables and compacted code.
2.9https://makecode.com/_ck2WUybHa45XImproved clear code to handle larger volumes. Added clrarea command to clear the current area between 2 Y values. This will be used for creating labs.
2.8https://makecode.com/_dAphMygUL7rMTube, tun and box all use lighting strips in the roof. 1 new block added to blocklist – sea lantern.
2.7https://makecode.com/_KYLeud2XyTdJAdded tube command.
2.6https://makecode.com/_i1qWTiUUwdsjAdded tunnel (tun) and box commands. Modified stairs to clear blocks above each step for use underground. tpb command now uses stained glass blocks instead of carpet.
2.5https://makecode.com/_M8fYAX4DUahKCode comments and changed marka to markr to mark every area in region. Help command to show list of commands and parameters. 3 new blocks in blocklist.
2.4https://makecode.com/_E4Vfs0agaeyDJavascript version. Bug fixes and clean up.
2.3https://makecode.com/_Wz2UpFiMHgXvFixed a few bugs
2.2https://makecode.com/_ekr5hq8HTCDoAdded ‘where’, ‘marka’ and extra teleport commands: atp, rtp and ttp

Territories, Regions, Areas and Labs

The code library introduces a few concepts designed to make collaboration with others simpler. I’ve defined 4 spaces:

  • Territory: These are 1024 blocks wide and long. You can navigate between territories using the ‘tpterr’ command and providing 2 numbers which are the coordinates relative to (x=0, z=0) in the world. The coordinates can be negative. E.g. tpterr 0 -1
  • Region: Within each territory is 16 regions that are 256 blocks wide and long. You can navigate between regions using the ‘tpreg’ command and providing 2 numbers which are the coordinates relative to NW corner of the territory. These coordinates are always positive numbers from (0 – 3). E.g. tpreg 0 3
  • Area: Within each territory is 256 areas that are 64 blocks wide and long (16 per region). You can navigate between areas using the ‘tparea’ command and providing 2 numbers which are the coordinates relative to the NW corner of the territory. These coordinates are always positive numbers from (0 – 15). E.g. tparea 3 3
  • Lab: A lab is an underground workspace that is the same size and location as each area. So if you are in area (3, 3) then the lab (3, 3) will be directly below that area (y=11). You can navigate to a lab using the ‘lab’ command and providing 2 numbers which are the same as the area (e.g. lab 3 3). You must create a lab before you can teleport there with the command ‘makelab’ (e.g. makelab 3 3).

Lab Builder Commands

NameParametersDescription
blocks(none)
blocku0-3
bmx y zMoves builder blocks forward (x), up (y) and left (z). Numbers may be negative for the opposite directions.
bt(0, 1, -1)Turns the builder to right (1) or left (-1). If you enter 0 or any other number it will place the position indicators so you can see where the builder is located and the direction it is facing.
cpx y zCopies blocks relative to builder location into memory. Use the paste command to clone to new location. Use the structure block for accuracy.
cplcx z cCopy lab chunk. X and Z are the lab coordinates and C is the chunk number which is from 0 – 15.
help(none)Displays a list of all the available command in the chat window.
labx zTeleport to the lab in current territory (x and z should have values 0-15). You may need to teleport to the area first using ‘tparea’ if you are too far away to detect the lab.
labcopyx zCopy the contents of the lab into memory. Lab must not be too far away. To paste you must use the labpaste with the same x, z.
labpastex zPaste contents from lab (x, z) into the lab you are in which must be empty (i.e. no blocks on top of the centre block – glowstone).
makelabx zCreate the lab in a specified area of the current territory. Use lab to teleport (x and z should have values 0-15). Each lab is 64 x 64 x 20 blocks.
psNPaste (clone) blocks copied using cp command to builder location.
pslcNThis pastes a lab chunk from the list. N is the index number.
tpb(none)Teleports builder to current location. This will place blocks to indicate the location and direction the builder is facing. Structure block is where the builder is positioned and green is the direction it is facing. Default direction is east. Use ‘bt 0’ to redisplay markers.
tpregx zTeleport to a specified region in the current territory (x and z should have values 0-3). Each region is a 256 block wide square.
tpterrx zTeleport to a specified territory. Each territory is a 1024 block wide square.

Lab Builder Code URLs

VersionURLNotes
1.3https://makecode.com/_WRsFoaPWxEPWRemoved unnecessary code to make it more compact. Also made commands consistent with the structure builder code library.
1.0https://makecode.com/_R40MWwWzkJECFirst version

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *