- New command: /nightvision toggles night vision
- Unofficial and unsupported API to set block light level: block.setLightLevel(blockId, level) (level is a float between 0 and 1); unsupported APIs may be removed and their functionality may leave something to be desired
- text.py module for drawing large text banners
- various optimizations and bug fixes
- improved pypy support in script and mod (set python interpreter in mod config)
I just released version 0.40 of Raspberry Jam Mod. For those who don't know, this is a mod for Minecraft 1.8 to support the Juice/Pi Python API on single-player Minecraft (also works with LAN sessions) without running a modded server.
In addition to general beta-quality code for the base Juice/Pi API, it includes experimental code (which may disappear if I am not happy with it) for three new major features:
1. Client-only "read-only" mode: use scripts on the client without the server supporting it
2. Multiple world support: use scripts in the Nether and the End
3. Server-side modding: use scripts server-side
These are all major features, but very technical. I will be happy to answer questions.
1. Client-only "read-only" mode: What if you want to debug a script that generates some large structures but don't want to mess up the world you'd like to place the structures in while debugging? Or what if you want to run a python script while you're connected to a server not under your control?
So, I made a client-only read-only mode for Raspberry Jam Mod. From the Minecraft menu, if you choose "Mods", then "Raspberry Jam Mod", and then set Client-only read-only mode to "True".
If you use this mode, then any Python scripts you run will run on the client side and make no changes on the server side (except maybe to the player position). You can, however, call getBlock() and setBlock() to your heart's content. So you can create giant structures while in a world controlled by a server that you don't own. Because the structures are only on your client-side, other players won't see them, and they won't be saved. If you try to mine blocks from these structures, you will fail (and may end up mining the "real blocks" the server knows about).
There are two provisos. First, the usual /py command for running scripts doesn't work. You need /lpy. ("l" for "local") Second, scripts will be disconnected if you switch worlds.
The main thing I want to use this for is to have my kids run the scan.py script to capture buildings that they've built in a server we don't control, and then copy the buildings to a local world.
2. Multiple worlds: When I was teaching programming using Raspberry Jam Mod, it was unfortunate that python scripts didn't work in the Nether (they also don't work in the Nether using Juice) as occasionally students ended up there.
After thinking long and hard, I decided that the easiest way to make many (but not all) scripts work not just in the Overworld but in the Nether and The End is to extend the coordinate system to include the Nether and the End all within a single coordinate system, by imagining the worlds as stacked one over the other.
Specifically, the spawn position in the Overworld is at Python coordinates (0,0,0). The spawn position in the Nether is, however, at (0,-2000,0). The spawn position in The End is at (0,-4000,0). (This should extend if you're using a server with more worlds.) So if you're in the End and you call getPos(), you get a position with a y-coordinate somewhere around -4000. setBlock() works across all the worlds (though it may not work if the world hasn't been initialized yet). In theory, you should be able to take a magic bridge right through a portal from one world to another.
The major limitation is that getHeight() currently only works in the Overworld. But because Raspberry Jam Mod's getBlock() implementation is quite speedy, you can write your own getHeight() alternative to work in the other worlds. Another limitation is that setPos() won't move you across worlds.
If you don't like the solution, just don't use the large negative coordinates. It won't affect existing scripts.
3. Server-side modding: While Raspberry Jam Mod was designed to fill the niche of a mod for single-player Minecraft supporting the Python API, I can imagine wanting to run it in a server situation. To do that, you need to install Forge for 1.8 and the Mod both on the server and the client side. And everything should then just work, with scripts being run on the server side. This is basically how Juice works, except that you need Forge+RJM on the client side as well (due to Forge limitations) and you can use the standard Minecraft server instead of Bukkit, etc., though with Forge.
And I made an Instructable on how to use scripts with Raspberry Jam Mod to draw fractals!
- changed passwords.dat filename to raspberryjammod_passwords.dat
- added raspberryjammod_permissions.dat control file to protect selected areas of the map [alpha quality; designed for servers]
- added options to disable in-wall and fall damage
- added a lot of block names to mcpi/block.py, supporting most blocks through Minecraft 1.10.2
- deprecated mc.py and mcturtle.py in favor of mine.py and mineturtle.py, which are the same as except blocks are referred to as block.BLOCKNAME instead of BLOCKNAME
- added RGBA and material data availability to Block structure; the RGB data is typically an average RGB value of a side-face; the alpha is mostly made up; the material data is made to support Visual Python
- added dithering and color rendering utilities; see earth.py and dither.py for examples on how to use; these are designed to use blocks from 1.10.2
- added support for running many scripts in Visual Python *without* Minecraft [alpha quality]; on Linux/OSX/Cygwin, after installing Visual Python, you can do:
MCPI_VPYTHON=1 python scriptname.py
On Windows, you can do:
You can monitor placement events, yes. Have a look at symmetry.py, which is a script that helps you draw symmetric objects (for instance, "/py symmetry n" will help you draw an object north-sound reflection symmetric around the point where you are when you run the script--every block you place will draw another block in a flipped location).
I've uploaded 0.90 which fixes a bug with some recent Minecraft versions and updates a few scripts, like chess, and adds a pong game.
Is there any way that I could use this mod to run an interactive python interpreter in minecraft? If so, would I be able to use that to give input into one of the functions of one of my python scripts and receive output from that function in the minecraft chat?
I am just trying to jump on this minecraft wagon. My almost 9 year old daughter is very into it and just got her a gaming laptop :-) I teach programming but havent messed minecraft yet. Figure if I can get this working and show her a bit, she can teach her brother too. Anyway, I think I have it installed, but minecraft is not recognizing the /lpy command. Any guidance is appreciated!
Hi there. I believe if you're just running it locally on your own machine, you shouldn't need /lpy. If you're on a server with this mod installed, I believe that's the primary use case for /lpy. I hope your interest lead you to find a way to make it work, if /py isn't good for what you wanted to do. If you wanted to use /lpy for the non-destructive aspect, it may be worth starting a new world as a test environment, running your script there, then you can run it on your main world once you know what the script will do.