RaspberryJuice

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.

Minecraft Forums thread

Currently implemented commands:
world.getBlock
world.getBlockWithData
world.setBlock
world.setBlocks
world.getPlayerIds
chat.post
events.clear
events.block.hits
player.getTile
player.setTile
player.getPos
player.setPos
world.getHeight
entity.getTile
entity.setTile
entity.getPos
entity.setPos

Protocol details:

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.

Extra features(^):

getBlocks(x1,y1,z1,x2,y2,z2) has been implemented
multiplayer support
- 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
the default tcp port can be changed in config.yml

^ 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

Example:

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])

Result: http://i.imgur.com/3SFrE.png

Further examples can be found at http:www.stuffaboutcode.com/p/minecraft.html

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of AvonVII AvonVII Sep 25, 2014 at 09:19 UTC - 0 likes

    @DavePottsUK: Go

    Many thanks Dave, much appreciated, will give that a whirl.

    Avon

  • Avatar of DavePottsUK DavePottsUK Sep 24, 2014 at 21:11 UTC - 0 likes

    @AvonVII: Go

    You are right that it doesn't necessarily match. Raspberry Juice takes (0,0,0) to be the world spawn point. If you want the coordinates to match up then go over to the CraftBukkit server console and type

    setworldspawn 0 0 0
    
  • Avatar of AvonVII AvonVII Sep 24, 2014 at 20:47 UTC - 0 likes

    Perhaps I'm missing something obvious, but if I use player.getTilePos() the values returned don't match the Minecraft X,Y,Z coordinates like the do on the Pi.

    For example, Minecraft reports x:866,y:67,z:608, but mc.player.getTilePos() returns 18,2,-2

    I've got some code that scans an area and writes out a CSV of the blocks, on the Pi it's fine, but with the running it using the Raspberry juice plugin it is scanning the wrong place. :-(

    Thanks,

    Avon

  • Avatar of murilopolese murilopolese Sep 16, 2014 at 20:36 UTC - 0 likes

    Hey! Awesome work! I owe you guys a beer!

    I am working with some friends for Kids Hack Day and one of our programs is to teach kids how to program with Minecraft. We are using right now Raspberry Pi but it's quite frustrating for them to go home and not being able to practice what they learned.

    We will run a Game Development program inside Minecraft from middle of October to December and definitely we'll user your plugin to enable the littles to keep programming after the classes.

    One thing we are working right now is an abstraction (almost a game engine) to build mini-games inside Minecraft. Hide and seek, capture the flag, sokoban, treasure hunt and many other examples are on our scope.

    I noticed that you only exposed one type of events, even Bukkit expose more than that, are you guys planning to expose them entirely? Would be possible to us to contribute on your roadmap by developing or suggesting features?

    Since now, thank you very much for your work, it's really inspirational!

  • Avatar of LetHopeItsSnowing LetHopeItsSnowing Sep 16, 2014 at 06:14 UTC - 0 likes

    @XMrPotatoX: Go

    Fixed the issue with getentities in v1.4

  • Avatar of LetHopeItsSnowing LetHopeItsSnowing Sep 16, 2014 at 06:13 UTC - 0 likes

    1.4 has been released...

    Its mainly bug fixes but it does include the ability to change the TCP port by modding the config.yml.

  • Avatar of LetHopeItsSnowing LetHopeItsSnowing Aug 19, 2014 at 09:58 UTC - 0 likes

    @XMrPotatoX: Go

    I have raised an issue in the github repository for the getting player ids:

    https://github.com/zhuowei/RaspberryJuice/issues/13

    If you have any more info about the issues you having could you add them to the issue?

    What commands did you want to add? It would need a change to the plugin, but if you have any ideas it would good to hear them.

  • Avatar of XMrPotatoX XMrPotatoX Aug 18, 2014 at 04:11 UTC - 0 likes

    So I've just now discovered this and it is awesome. I'm using it on 1.7.10 and it works fine. I seem to be having issues getting player IDs but thats fine. I was just wondering if there's any way to add my own commands? I'm sure that its possible, I'm just too new at this to figure it out...

  • Avatar of LetHopeItsSnowing LetHopeItsSnowing Mar 28, 2014 at 14:40 UTC - 0 likes

    @TechnicolorDalek: Go

    Yes it does. Tested extensively with 1.6.4, but there is no reason why it shouldn't work with 1.7.x

  • Avatar of TechnicolorDalek TechnicolorDalek Aug 11, 2013 at 19:27 UTC - 0 likes

    Does this work with any version past 1.4.7? And if not, any chance of updating it? I love using the Pi version of MC and'd love to have this on my server.

Facts

Date created
Jan 08, 2013
Categories
Last update
Nov 25, 2014
Development stage
Release
License
Apache License version 2.0
Curse link
RaspberryJuice
Downloads
3,179
Recent files

Authors