Minecraft is a sandbox-style game made by the game company Mojang. Because it is a sandbox, there is no right or wrong way to play it. The concept behind the game is that you explore and build using different kinds of blocks in a randomly created world. It has been compared to a virtual LEGO set. If you can think it, you can build it in Minecraft.
It was originally developed for the Windows PC, but has since been ported to OS X, iOS, Android, and various game consoles. Mojang developed and released a port to the Raspberry Pi as a free download.
If you are running the latest version of Raspbian, Minecraft is now included by default. If you are running an older version of Raspbian, you can install Minecraft using apt-get
, as follows:
sudo apt-get update
.sudo apt-get install minecraft-pi
.minecraft-pi
and press Enter.To create a new Minecraft world, perform the following actions:
Now that you have created your Minecraft world, you can explore, fight creepers, create your own castle, and whatever else your mind can think of. The Raspberry Pi Edition includes something extra—a programming interface. You can use the Python programming language to hook into Minecraft and edit the game world with lines of code.
To use the Minecraft API, perform the following actions:
python
on the terminal.>>>
, which is where you will enter the Python commands.from mcpi import minecraft from mcpi import block mc = minecraft.Minecraft.create() mc.postToChat("I am using the API!")
I am using the API
message appear in your Minecraft window.player = mc.player.getPos() player
Vec3(46.0,1.0,-14.0)
should appear.mc.setBlock(player.x +1, player.y, player.z, block.GOLD_BLOCK)
There are many more things you can do with both Python and the Minecraft API. From creating functions that will build a fortress to using loops to stack tons of TNT blocks, you can program the entire world.
For more API documentation, visit:
http://www.stuffaboutcode.com/p/minecraft-api-reference.html
3.146.255.249