Minecraft Pi_ Introduction to Python

In almost all programming languages, there is a way to leave messages that do not get processed by the computer. These messages are called comments or commented out. In Python, you can comment out a line by adding a hash mark (#) at the beginning of the line.

Let's comment out the mc.setBlocks line by adding a hash mark at the beginning:

#mc.setBlocks(x+1, y+1, z+1, x+11, y+11, z+11, stone) Add this line below:

mc.setBlock(x + 1, y, z, 46)

Now, hit the block and destroy it. Nothing happens. The reason why is that Minecraft has values that change the characteristics of blocks. There are a set number of blocks that can have these characteristics changed. Try this instead:

mc.setBlock(x+1, y, z, 46, 1)

Return to top