Step 1

Program setup


In the last project, we learned how to place a single block wih Python code. Now we’re going to build on that and have our program place multiple blocks at once!

By the end of this lesson, your program will be able to create a snow golem when you run it, and maybe even an iron golem!

Open up your mc.py code/file and add the following code.

The comments are all optional and are meant more to help remind us what is going on here, but feel free to copy them in as well. It’s always good to add comments in your code!

Coding a snow block


Next, add the following code.

Remember, to place a block we need to know which block to place and where to place it. Here we get the position of the player and place the block there. 80 is a snow block.

Running the code


Next, let’s run our current code to make sure it works.

Remember to run your code, select Run -> Run Without Debugging

You should see a snow block appear in your game if it works! If not, go back and double check your code.