Magic Bridge

This week we built magic bridges in Minecraft using Python

The version of Minecraft we used is the Minecraft Pi edition for Raspberry Pi computers

The whole idea of this program is to create glass blocks under our feet in Minecraft if we fall off a cliff or land in water

The first thing we do in our program is import the MCPI libraries. mcpi is a Python library that allows you to interact with Minecraft: Pi Edition, a version of Minecraft specifically designed for the Raspberry Pi platform.

This library provides a set of Python functions to programmatically modify the Minecraft world around the player. With mcpi, you can create and alter blocks, track player location, respond to player actions, and more.

We got introduced to making functions. A function is a reusable piece of code that performs a specific task, in this case building our bridge. Functions often take input, perform a computation or action, and then return an output.

We also got introduced to If Statements. An if statement is a conditional statement that runs or skips a section of code based on whether a condition is true or false. In our program we check if the block under our feet is air or water, if so we change it to glass

Have a look at the code below in my Github account

Previous
Previous

Space Shooter

Next
Next

Tomogatchi Pet