Walking around the Minecraft world is great fun, but water and lava can cause real problems! Wouldn’t it be great if you could walk anywhere you like, without having to fly! Well you can, just create a glass floor below you.
The aim of the challenge is to write a python program that builds a glass bridge under your player
Wherever you walk in MineCraft world. You can make the bridge as wide as you like, and you don’t have to make it out of glass if you don’t want to!
- Try making the floor out of Gravel/Water blocks instead of glass. What happens?
- Can you make a glass staircase instead?
- How about a rainbow coloured bridge?
Step 1. Find out where you are and put a glass block under your player.
The first thing we need to do is find out where we are on the map, using mc.player.getTilePos().
We should store the returned result in 3 variables myX, myY, myZ.
Then we need to place a glass block underneath us, using the mc.setBlock(x, y, z, block) function.
Step 2. Change your program to make a 3×3 square underneath you.
We now need to change the code to add a 3×3 square of glass blocks below us. We can do this in a number of different ways (such as using for loops or while loops) but in this example we will use the mc.setBlocks() function.
This is the easiest and most efficient way to complete the challenge.
Using the top down view of your player above see if you can replace the ??? in code below to complete the glass floor below your feet.
This should now create a glass floor below your feet!
Put the code in a loop
All that is left to do now is to put all your code inside a while loop and add a time delay between each loop. We need to add a time delay otherwise the python program will eat up all of your CPU power and make the program run really slowly
The Completed Code