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

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

^ 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!

  • 10 comments
  • 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.

  • Avatar of Wouto1997 Wouto1997 Mar 26, 2013 at 22:28 UTC - 0 likes

    Thanks to you awesome sir, I've been able to make self-building structures:

    (Video of self building house)

    And gifs that animate in minecraft:

    (Video of not 100% sfw gif, definitely 12+ sfw though)

  • Avatar of swimmingfrog swimmingfrog Mar 09, 2013 at 06:15 UTC - 0 likes
    Very cool. I have it installed and working. I have a question: how do I get/set position of a player when there is more than 1 player on the server?

    I got a player id from getPlayerEntityIds() (by the way, I had to fix the getPlayerEntityIds with a [:-1] at the end since my unsplit ids variable had a "|" at the end of the string) and tried:
    mc.entity.getPos(3010442)
    but that failed with the following messages:
      File "<stdin>", line 1, in <module>
      File "mcpi/minecraft.py", line 32, in getPos
        s = self.conn.sendReceive(self.pkg + ".getPos", id)
      File "mcpi/connection.py", line 50, in sendReceive
        return self.receive()
      File "mcpi/connection.py", line 44, in receive
        raise RequestError("%s failed"%self.lastSent.strip())
    mcpi.connection.RequestError: entity.getPos(3010442) failed
    
    Last edited Mar 09, 2013 by swimmingfrog
  • Avatar of HTTP500 HTTP500 Feb 22, 2013 at 16:53 UTC - 0 likes

    @n0trub: Go

    No, you can't send console commands through chat, as it would pose a security risk.

    This plugin implements the Minecraft Pi protocol, so you can use the Minecraft Pi apis to connect to it: see http://pi.minecraft.net for details.

    BFAK:zhuowei,98590,17fdfb4baea676427103b0ed8f9d68cbefee292b9704f814b7c86600d1f517e1

  • Avatar of mid_kid mid_kid Feb 15, 2013 at 12:41 UTC - 0 likes

    Oh god you stole my idea :P

  • Avatar of n0trub n0trub Feb 14, 2013 at 07:12 UTC - 0 likes

    This works so easily, what an awesome plugin!

    I have it working through a raw Putty connection, but how do I send commands by script, like your example posted above? Also, is it possible to issue server commands through the chat.post()? Because that would make this plugin OP.

    Thanks for your work!

    Last edited Feb 14, 2013 by n0trub
  • Avatar of Bananas970 Bananas970 Jan 09, 2013 at 04:33 UTC - 0 likes

    me want

  • 10 comments

Facts

Date created
Jan 08, 2013
Categories
Last update
Mar 27, 2014
Development stage
Release
License
Apache License version 2.0
Curse link
RaspberryJuice
Downloads
2,916
Recent files

Authors