Step 1: Start the Code Builder

From the normal Minecraft game screen (not the settings) press ‘C’ on the keyboard to start the code builder. If it’s the first time you’ve used it you will see the window displayed. Select the first option indicated by the red arrow in the image.


Step 2: Click the Import button

This time we will import some code that I’ve already prepared for you. You will still need to some coding, but it will be to use and experiment with the code I’ve written to see what you can do with it.


Step 3: Click Import URL…

Right-click the ‘Code’ button below and select ‘Copy link address’ in the pop-up menu. Then click the ‘Import URL…’ option in Minecraft (as pictured).

Code

Step 4: Paste the address in the box

Click in the white text box and then press Ctrl-V (paste) to paste in the address from the code button in the previous step. You can also right click the text box and choose ‘Paste’.


Step 5: Go ahead!

Click the green ‘Go ahead!’ button to complete the import process. It should look like the picture here. If it doesn’t – did you forget to copy or paste in the address?


Step 6: Examine the code

Ok, let’s look at the code you’ve just imported. There is 1 chat command called ‘make’ and 2 functions:

  • make chat command – read more about this below.
  • rectangleOutline – this places blocks in an empty rectangular shape according to the width and length you specify.
  • rectangleFilled – this creates a filled rectangle shape according to the dimensions you specify.

Chat Command – make

The ‘make’ chat command first moves the agent to the player location, then forward and up. It then calls both functions to first create a filled 6×9 rectangle and then an outlined 4×6 rectangle using the blocks it has in slot 1.

Calling a Function

Both numbers in the call block (e.g. 4 and 6) are called parameters. The 4 becomes the value of the ‘width’ variable and the 6 becomes the value of the ‘leng’ variable. Both of these variables are used in the code to create the rectangle outline (the red coloured, rounded rectangle blocks).


Step 7: Experiment with the code

Ok, now it’s time to see what the code does and change it. You should only change the code in the ‘make’ command. Change the numbers to make different sized rectangles. Add more rectangles by making more calls to either of the functions. You need to click on the dark grey ‘Advanced’ menu then the dark blue ‘Functions’ menu to find the function call blocks. You could also right click on the call block and select ‘duplicate’.

You should test at least 2 different variations before attempting the challenges. 


Challenge 1: Make a 3x3x3 solid cube

The first challenge is to build a 3x3x3 solid cube. You should be able to do this with just 4 code blocks (not including the initial 3 red blocks to position the agent). The first of them should be a repeat loop and inside you will call the rectangleFilled function plus 2 other move blocks. Can you figure it out? Here are some pictures of the recommended steps (plus some extra hints).

This should be your first step – create a 3×3 square (hint: use the rectangleFilled function) – this should only require 1 function call block (after the initial 3 blocks to teleport and move the agent). Next you need to move the agent to the starting position and up one block (2 blocks).

Finally, you can add your loop to make 3 layers (1 repeat block).


Challenge 2: Make a 5x6x3 house with a roof

Ok, now see if you can build a rectangular house that is 5×6 and 3 blocks high with a flat roof that is also 5×6. This will also only require 4 blocks including 1 repeat block, 1 move and 2 function calls. Can you do it? Here are more pictures of the suggested steps and hints.

The first step should only require 1 function call to build the first layer of the house. Notice how the agent ends up in the starting position. Next we need to move the agent up and create 3 layers.

It’s starting to rain. Quick! We need a roof. It should only take 1 more function call to build a roof with the same dimensions as the house and the agent is in perfect position.

Ok, it’s a pretty basic house and there’s not even a way to get in yet, but it’s a good start.

Challenge 3: Make a multi storey house!

If you can build a one storey house then a double shouldn’t be much harder. You should only need 3 blocks and they are almost identical to the 2 steps in challenge 1! The first 2 blocks move the agent into position to build the 2nd level and the last repeats almost all of your code twice (one for each storey).

I added in the windows and doors manually so you could clearly see the 1st and 2nd floors. Now you have the code to make a single or multi storey house by changing just one number.