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!

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

  • 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

Facts

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

Authors