Want to try to program with the new Minecraft Pi API but don't have a Raspberry Pi yet?
RaspberryJuice implements a subset of the Minecraft Pi modding API for Bukkit servers.
The plugin listens on port 4711, and accept most of the Minecraft Pi commands, which are documented at http://wiki.vg/Minecraft_Pi_Protocol .
The plugin supports the majority of the api's supplied with the Pi edition and most examples will work.
Currently implemented commands:
The origin (0,0,0) is defined as the spawn location of the first loaded world. The player methods from the protocol acts on the only player on the server.
getBlocks(x1,y1,z1,x2,y2,z2) has been implemented
- name added as an option parameter to player.# calls
- modded minecraft.py in python api library so player "name" can be passed on Minecraft.create(ip, port, name)
- this change does not stop standard python api library being used
^ to use the extra features an modded version of the java and python libraries that were originally supplied by Mojang with the Pi is required, https:github.com/zhuowei/RaspberryJuice/tree/master/src/main/resources/mcpi. You only need the modded libraries to use the extra features, the original libraries still work, you just wont be able to use the extra features
This Python script builds a rainbow near the spawn. Place this example in the api/python directory of the Minecraft Pi prerelease, start the server on the same computer, and run python name.py to run, replacing name.py with the actual name of the script.
import mcpi.minecraft as minecraft import mcpi.block as block from math import * colors = [14, 1, 4, 5, 3, 11, 10] mc = minecraft.Minecraft.create() height = 60 mc.setBlocks(-64,0,0,64,height + len(colors),0,0) for x in range(0, 128): for colourindex in range(0, len(colors)): y = sin((x / 128.0) * pi) * height + colourindex mc.setBlock(x - 64, y, 0, block.WOOL.id, colors[len(colors) - 1 - colourindex])
Further examples can be found at http:www.stuffaboutcode.com/p/minecraft.html
- 8 comments
- Date created
- Jan 08, 2013
- Last update
- Mar 27, 2014
- Development stage
- Apache License version 2.0
- Curse link
- Recent files