Believe it or not Bukkit is not the only Minecraft server that supports plugins!
I have been maintaining a Bukkit plugin called RaspberryJuice for a little while, which allows you to run the same programs you developed for Minecraft on the Raspberry Pi on the full version of Minecraft.
So to give people a choice and to ensure the longevity of the RaspberryJuice plugin I have migrated it to Canarymod. Canarymod is another Minecraft server, with an open source API which allows you to interface directly with the server. This is what RaspberryJuice does, it listens for the command which would normally be sent to the Pi edition of Minecraft and makes the same things happen in Minecraft.
You can get the RaspberryJuice source code plugin for Canarymod from https://github.com/martinohanlon/canaryraspberryjuice.
None of this could have been possible without the work of zhuowei who originally create the RaspberryJuice Bukkit plugin.
I will keep them both versions of the RaspberryJuice plugin's up to date for as long as its viable.
If you want to create your own Canarymod server with RaspberryJuice plugin follow these steps:
Download and install Canarymod
- Create a folder for Canarymod, anywhere it doesn't matter
- Head over to http://canarymod.net/releases and download the latest version of Canarymod and save the .jar file to the folder.
- Rename the downloaded .jar file from canarymod-#.#.#-#.#.#.jar to canarymod.jar
- Open Notepad, insert the following text:
java -jar CanaryMod.jar
pause
pause
- Save the file in the folder as start.bat
Run CanaryMod
Double click start.bat
You will be asked to confirm you accept the EULA. Open the eula.txt file and change eula=false to eula=true and save the file.
Double click start.bat to run the CanaryMod again.
You will be asked to confirm you accept the EULA. Open the eula.txt file and change eula=false to eula=true and save the file.
Double click start.bat to run the CanaryMod again.
Test Canarymod
The version of Minecraft you use needs to match the version of Canarymod you downloaded. So if you downloaded Canarymod 1.7.10 you need to set Minecraft to use 1.7.10 as well. You can do this by picking the correct version from the "Edit Profile" window on the Minecraft Launcher.
Open Minecraft, Multiplayer, Direct Connect, Type "localhost", Join Server
You can stop Canarymod by typing stop in the canarymod command window
Download and Install Raspberry Juice
- Download raspberry juice source code and plugin from https://github.com/martinohanlon/CanaryRaspberryJuice/archive/master.zip
- Open the zip file and copy the latest version of the plugin CanaryRaspberryJuice-#.#.jar from the jars folder to the plugins folder in the Canarymod folder
- Start up Canarymod
If everything has gone to plan you should see a message when you start up Canarymod that RaspberryJuice has been enabled.
You can now run your Minecraft: Pi Edition programs on the full version of Minecraft. Here is a video of the Minecraft Analogue Clock running on Bukkit using Raspberry Juice.
You can now run your Minecraft: Pi Edition programs on the full version of Minecraft. Here is a video of the Minecraft Analogue Clock running on Bukkit using Raspberry Juice.
Very awesome that you've updated RaspberryJuice for Canarymod (I'm a huge supporter of free software (open source) myself)! I noticed that the HREF for the download link on this page is still pointed to the Bukkit page and not your GitHub page for the Canarymod version. Also, thanks for all your other Minecraft programming resources!
ReplyDeleteDuh, updated, this will teach me to update 2 posts at the same time...
DeleteHi, thanks for the great work. Are there any plans to make RaspberryJuice available in PocketMine?
ReplyDeleteIts certainly an idea I have had few a little while. The only problem is I know nothing of php!
DeleteOk, let's hope that some PHP knowing person will read this and will code it up. Thanks!
DeleteYes, its called raspberry jam.
Delete@Dallas - do you have a link? I found this, but it's not for PocketMine:
Deletehttps://github.com/arpruss/raspberryjammod
I did see http://dragonet.org which is a possibility for MCPE, but have not tried it.
DeleteI'm able to run Python scripts on a server which has both iOS Minecraft and Windows 10 Beta Edition Minecraft connected to it using:
Delete* http://nukkit.io/ as the server
* https://github.com/rutgerkok/Pokkit installed as a plugin. This, in turn, allows you to install Bukkit plugins like Raspberry Juice. I've had to build Pokkit 0.5-SNAPSHOT from source because release 0.4 hasn't got all required methods implemented. Hopefully the Pokkit team will release 0.5 soon (it's easy to Maven build from source until then).
* Install Raspberry Juice within the Pokkit plugins directory.
I'm having a look at porting Raspberry Juice over to the Nukkit API, but Pokkit is currently working well for me so I may stick with that.
To clarify, this has nothing to do with PocketMine (a PHP implementation of an MCPE server) but using Nukkit as an alternative you can use Python scripts on MCPE clients (e.g. iOS, Win 10 Beta).
This comment has been removed by the author.
ReplyDeleteCould RaspberryJuice work if Canarymod were running on the Pi? It might be a convenient way to have a portable server, and if you always attach any hardware to the Pi GPIOs you could then use it with either the Minecraft Pi edition or the full blown Minecraft running on a separate PC/Mac without having to change the GPIO cabling. (e.g. pull out Adafruit T-Cobbler and replace w/ Arduino board.)
ReplyDeleteWhen using the Pi as a server something like the Adafruit USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi is handy.
Yes, no problem. The only challenge is the capacity of the Pi to run a full blown Minecraft server.
DeleteThanks for the response. Hopefully the python scripts would be able to run on a separate core and not further weigh down the minecraft server. Although any interactions (mcli protocol) would impose some additional load. I have a spare SD card so I'll give it a try sometime - just got your book in today! (We had been playing with the LearnToMod stuff.)
DeleteI need some help with this, could someone contact me?
ReplyDeletePerhaps if you used a name to comment?!
DeleteThis comment has been removed by a blog administrator.
ReplyDeleteSorry about that, my name is Hunts168, you can email me at Hunts168@gmail.com
ReplyDeleteSorry for getting antsy, I've researched all I could to try to find a solution, but there's limited info about this. I am getting an error saying "there is no module 'conection.py'" when I try to import mcpi.minecraft as minecraft and try to make things with the code.
ReplyDeleteAre you saving your Python script in the the same directory as mcpi? mcpi is a folder, you don't want to save inside the mcpi folder, but in the folder in which mcpi resides (how you can make sense of that!)
DeleteAlso, Minecraft must be running and you must be in an active game before the API can connect to it.
Hope this helps!
You are using python 3. The python api library is only python 2 compatible.
DeleteI believe that Python3 API for Minecraft PI is available now.
ReplyDeleteThere is a community built python 3 library https://github.com/py3minepi/py3minepi the one which ships with minecraft pi from mojang is still python 2
DeleteHi I am new to canaryMod and rasberryjuice so this may not be the best place to ask this question. I am runing on windows 8 and have almost everything working. I can run a basic python program and see the results in the world I am in. As a player, I can manually place blocks and destroy them (i.e., I am on the ops list). However, from within a python program it appears that calls to setBlock have no effect. The program doesn't crash or produce an error message, it just seems that the calls are "ignored". Below is a program that runs perfectly except for the fact that a stone block is not placed. Any help would be greatly appreciated.
ReplyDeleteimport mcpi.minecraft as minecraft
import mcpi.block as block
import time
mc = minecraft.Minecraft.create()
mc.postToChat("Python program is running...")
mc.player.setPos(0, 0, 0)
x,y,z = mc.player.getPos()
mc.postToChat("I am at position x=" + str(x) + ", y=" + str(y) + ", z=" + str(z))
mc.setBlock(x+1,y,z,1)
mc.postToChat("Stone block has been placed.")
time.sleep(10)
At first I couldnt see anything wrong with your code.... but I think you are floats (decimal numbers) when setting a block.
Deletei.e.
getPos will return 0.000000 , 0.000000, 0.000000
setBlock expects integers (whole numbers) i.e. 0, 0, 0
You can probably fix your program by using mc.player.getTilePos() which returns the 'tile' the player is standing on rather than the precise position in decimals.
If you are still struggling, I would create a simple program to test it which create a single diamond block high up in the sky above spawn.
i.e. mc.setBlock(0, 100, 0, block.DIAMOND_BLOCK.id)
That way you will be sure its your block and not just one randomly put there.
Thanks for the help. I tried the variations you suggested with (unfortunately) no luck. I also tried running the clock and bridge examples with the same results. I see the post to chat messages but nothing else. The world I am experimenting on is flat -- just grass as far as the eye can see.
DeleteAny additional help would be greatly appreciated.
I have run several experiments today -- which included a fresh install of everything on a new machine (also with the same results). I suspect that when I run a python program, it is in "visitor" mode. Specifically, all functions that I can get working also work when my player is in visitor mode. I don't know enough about the system to determine if this makes sense...it just seems so strange to me that I can execute so many functions....just not the setBlock function.
DeleteThis comment has been removed by the author.
ReplyDeleteI have a couple of questions regarding how to manipulate minecraft worlds. I am able to create a world using the command: /createworld worldname. I am able to move to that world using the command /spawn worldname playername. I can also load a world using then command /world load worldname NORMAL
ReplyDeleteThe problem I am having is when I run a python program...it automatically moves me back to the default world and executes the python program "on the default world".
Ideally, I would like to create various worlds (e.g., flat, etc.), move to a world, and then run python programs in the world in which I currently reside. How can I do this?
=========
How can I remove all files associated with a world I no longer want?
MCPI - Visibility Question:
ReplyDeleteHow do you make the contents of the (python) mcpi folder visible from anywhere on your machine?
Background: After trying a variety of suggestions for installing canaryMod and rasberryjuice I finally
settled on the AIMCanaryStarterKit located at the following url:
https://drive.google.com/folderview?id=0BwqjqhNUlUf1TjRGNXR6U3Uza0k&usp=sharing#list
That is where I ended up, not where I started. Anyway, on my PC I can run python-minecraft programs from anywhere. However, when I installed canaryMod etc. on my daughter's machine the "run from anywhere" property does not hold. On her machine I can get things to run when the mcpi folder resides in the same directory as her python program. I really like the more flexible "run from anywhere" setup. Any help on how to do this would be much appreciated.
Too bad this isn't for forge...
ReplyDeleteHELP! WHERE TO PUT THE CODES?
ReplyDeleteWHAT CODES?
DeleteMartin, I honestly hope you do not mind my posting here but I want to answer some of these questions.
ReplyDelete1. the modding in the minecraftPE is called raspberry juice. Can also be found on Alex's instructable or github page. http://www.instructables.com/id/Python-coding-for-Minecraft/
2. Forge works very well with the API. I use Amazon AWS to host a minecraft (pycraft) server with forge. Forge gets updates out quite fast and Alex seems to always be ahead of forge.
http://thecodingkids.com
3. @victor sounds like you need to add your path to PYTHONPATH