Introduction: Star Wars and Star Trek in Minecraft With Raspberry Jam Mod

I'll explain how to (a) easily render Star Wars and Star Trek (and other) 3D models in Minecraft and (b) fly a spaceship in Minecraft (or even have another entity, like a bat or a zombie, fly it!), using the sample python scripts included with my Raspberry Jam Mod. The Raspberry Jam Mod emulates the Minecraft-to-Python interface of the Raspberry PI version of Minecraft and lets you write Python scripts for Minecraft, but for this Instructable no programming experience is needed.

Note: You can do this on Android Pocket Edition of Minecraft if you have version 1.13 of my Raspberry Jam Mod for Pocket Edition. For more information on Pocket Edition installation, see here.

Step 1: Install Raspberry Jam Mod

To communicate with Python scripts, install Raspberry Jam Mod. On Windows this has three steps:

1. Create a Minecraft 1.8 profile in Minecraft and start up Minecraft with that profile once.

2. Download and run the latest Minecraft Forge for 1.8 installer.

3. Download and run my latest Raspberry Jam Mod .exe installer for Windows (you need the scripts included in 0.41). Install all the options. (Potentially, Windows will give you some kind of a warning about a file that hasn't been downloaded very often. You can either trust me, or you can download all the zip packages and install manually if you prefer.)

If you prefer to install manually than with the .exe installer, or you're installing on Linux or OS X, install the appropriate Minecraft Forge for 1.8 installer, download RaspberryJamMod.jar and python2-scripts.zip, put RaspberryJamMod.jar in the mods folder of your .minecraft folder, and put the mcpipy folder from python2-scripts.zip file in the .minecraft folder as well.

To test the installation, switch to the Forge profile that the Forge installer will create, start Minecraft, create a single-player world and type

/py render 1701d 100

If all goes well, a big USS Enterprise 1701D will be drawn. Other models that are preset in the mod besides 1701d are ds9 (a giant Deep Space 9 station), bop (a Klingon Bird of Prey), jemcruiser (a Jem'hadar Cruiser), neghvar (a Klingon flagship), and, on the Star Wars side, stardestroyer, yt-1300 and atat.

Note: Unless you have an empty flat world, the drawing may take a very long time and look like it's hanging. Be patient. It might even be 20 minutes: this is a very large and complex model.

Technically, what happens is that any Python scripts in the %appdata%\.minecraft\mcpipy directory can be executed with a /py command. In your Windows Start Menu, you should also have a Raspberry Jam Mod entry wtih the IDLE Python environment. You can use that environment to edit all the .py scripts.

To interrupt a running Python script, do:

/py

by itself.

Step 2: Get and Convert Meshes

There are a number of sources for Star Wars and Star Trek 3D model meshes on the web. The best one I've found just for Star Trek is www.trekmeshes.ch. For Star Wars, as well as Star Trek, an excellent source is scifi3d.com.

The render.py script included with Raspberry Jam Mod (based on code by Martin O'Hanlon and myself) handles meshes in two different formats: .OBJ and .3DS. Other meshes will need to be converted. Two useful open source tools for converting various formats of meshes are Wings3D and MeshLab (just import the mesh from the format it's in and then export to .OBJ). If you own a copy of 3DS Max or qualify for their three year educational license, this will let you convert .MAX files as well as a number of other formats. Make sure you obey all the copyright restrictions on the file (and note that because Star Wars and Star Trek are under copyright, you are responsible for ensuring that your use obeys your local copyright laws; in particular, commercial use is unlikely to be acceptable without express permission from Lucasfilm or Paramount).

To extract the meshes from trekmeshes.ch, you'll need unrar. The meshes from scifi3d.com just need to be unzipped.

Once you have your .OBJ or .3DS mesh, put it in the models folder of the mcpipy folder (with all the python scripts) in your .minecraft folder (%appdata%\.minecraft\mcpipy\models on Windows).

Finally, if you're a Space Janitors supporter, you should have lovely meshes of craft in your Janitor's Locker.

Step 3: Convert to Minecraft

For my example, I'll assume that you've downloaded the r2d2.3ds mesh from scifi3d.com, extracted it from its zip file and put it in your .minecraft\mcpipy\models folder.

Then in Minecraft (I recommend a creative superflat world, but in my screenshot I did it in survival) type

/py render r2d2

(No extension on r2d2.) This will generate a gigantic (the default size is 100 blocks) R2D2 statue centered right on top of the player (you may need to teleport away).

There are a few options you can use with the render script. A full commandline will be:

/py render filename options size yaw pitch roll

where currently the only option is "n" for non-destructive (this disables the default clearing of a large rectangular prism for the output), and you can omit the options if you don't want them, size is the size of the largest dimension in blocks, and yaw, pitch and roll let you change where the model is pointing (the angles are all in degrees). For instance, you do /py render r2d2 50 for a more manageable R2D2, and you can have him point 45 degrees clockwise of his normal pointing with /py render r2d2 50 45.

Your initial rendering will probably be disappointing. First of all, the whole image will be made out of stone. Second, in many cases the image will be lying on its side (you can fix . You now need to tweak the materials and other options for the model.

Step 4: Orientation, Size and Materials

When you first ran the render script on your image, the script automatically generated a control file in the .minecraft\mcpipy\models folder, with the same name as your image but a .txt extension. In our example, the control file is r2d2.txt. Navigate to the models folder and double click on the control file to edit it (e.g., with Notepad). The file should look like this:

file 'r2d2.3ds'
swapyz 1
#credits [add?]
#url [add?]
#urlgz [add?]
yaw 0
pitch 0
roll 0
size 100
default STONE
#order material position
materials
Blue_Metal default
Blue_Reflection default
White_Metal default
Material_#22 default
Material_#4 default
Gold_Crinkle_Pro default
Datos default
Material_#23 default
Yellow_Sensor default
Red_Sensor default
Blue_Sensor default
Material_#21 default
end</p><p>[Insert any detailed licensing information here]</p>

The first thing to change is that if your image is lying on its side, then replace swapyz 1 with swapyz 0 (or the other way around: currently .3DS files default to swapyz 1 while .OBJ files default to swapyz 0). With R2D2, I was lucky and that worked just fine. (You can also do other adjustments with the roll/pitch/yaw lines.)

Comments start with #, and everything after the "end" line is ignored. I recommend changing the credits line to give credit to the mesh author and the site you downloaded from and including any detailed copyright information after the end.

Then edit the blocks used for the materials in the mesh. Many meshes are divided into materials, and render.py will put a list of all the materials in your file after the "materials" line. Also, before the "materials" line you can set the default material for otherwise unspecified areas.

The most basic way to specify a material is this:

materialname XX

or

materialname XX YY

where XX is the Minecraft block ID and YY is the meta data (or subtype). You can look up the numbers here. For instance, to make the default material be polished diorite, you can change the "default STONE" line to:

default 1 4

Because it's hard to remember lots of numbers, you can also specify many materials by a name defined by the Minecraft python API (as extended by Raspberry Jam Mod). These are all in capitals, e.g., STAINED_GLASS_BLUE. A list of all these materials is here.

Finaly, while I was at it, I changed the default size (you can always override it with /py render name size) to 50.

Here's what my control file looks like now:

file 'r2d2.3ds'
swapyz 1
credits Dr. Harry Jones and Jose Luis Martín. scifi3d.com. Star Wars is copyright Lucasfilm.
#url [add?]
#urlgz [add?]
yaw 0
pitch 0
roll 0
size 50
default QUARTZ_BLOCK
#order material position
materials
Blue_Metal WOOL_BLUE
Blue_Reflection WOOL_LIGHT_BLUE
White_Metal QUARTZ_BLOCK
Material_#22 default
Material_#4 default
Gold_Crinkle_Pro GOLD_BLOCK
Datos default
Material_#23 default
Yellow_Sensor STAINED_GLASS_YELLOW
Red_Sensor STAINED_GLASS_RED
Blue_Sensor STAINED_GLASS_BLUE
Material_#21 default
end

Step 5: Drawing Order

Sometimes, small details--especially windows and lights on spaceships--are drawn before large expanses of surface that surrounds them. Once the surface is turned into big Minecraft blocks, the details disappear. Sometimes, too, an inside surface gets drawn after an outside one, but because of the low resolution of Minecraft blocks, the inside surface overwrites the outside one.

See this screenshot of the Enterprise with a control file that specified SEA_LANTERN and GLOWSTONE_BLOCK for various glowing materials like "phaserstrips" or "warpblue". The most obvious problem is that the glowing windows don't go all around the saucer section. To fix these problems, you need to specify the order in which the materials are drawn.

In the initial control file, there was a commented out line:

#order material position

You can replace this line by a list of materials you want to modify the drawing order for. The default drawing order position 0. Materials with a smaller position get drawn earlier and ones with a larger position get drawn later. So, I put:

order phaserstrips 1
order bluethingies 1 order warpblue 1

This makes the items drawn out of these materials get drawn later. I also found that the stuff made out of "entdnacelle" material got drawn later, overwriting stuff that was supposed to be on the outside. In the end, this didn't matter much as I set that material to be default, but you could also fix the problem by forcing this material to be drawn first:

order entdnacelle -1

See the 1701d.txt file in the models folder for the final version. In the screenshot you can now see the glow going all around the saucer. (You don't, of course, have to make it glow, but it makes the problem more obvious.)

Step 6: Moving Vehicles

Raspberry Jam Mod's sample scripts include vehicle.py, a script I wrote that makes small vehicles like boats, cars and spaceships move along with the player. This is only practical for small vehicles due to lag (and there is a maximum size of 30 blocks from the player). Make a vehicle in Minecraft, being careful not to use landscape blocks (like bedrock, grass, etc.). Then you put the player in or on or near the vehicle, ensuring a 3x3 area for moving around in (or a 3x3x3 area for moving and flying around in, if you want to move the vehicle up and down), and run:

/py vehicle

The script scans the vehicle (but be careful: it might pick up also a nearby building if the vehicle is touching it). Moving the player moves the vehicle, then.

The vehicle is superpowerful: it destroys anything that gets in its way. You can also make the vehicle non-destructive. Then it can go through things without destroying them (there may be minor damage: torches rearranged and the like). To do that, use:

/py vehicle n

To exit the vehicle script, just do:

/py

There are a lot of things you can do with the vehicle script. For instance, you can save your vehicle for use elsewhere and in other worlds. The vehicle script is controlled by typing commands that start with a "v" in chat (press T for chat; no slash). The basic commands are:

  • vsave name: save vehicle in .minecraft\mcpipy\vehicles\name.py; no spaces in name, please
  • vload name: replace current vehicle with a loaded vehicle
  • vlist name: list saved vehicles
  • verase: clear current vehicle out of your world and exit script
  • vhelp: get list of commands

There is also a fun command that replaces you with a newly spawned piloting entity:

  • vdriver EntityName

For instance,

vdriver Bat

puts a bat in the vehicle and makes it fly your vehicle. To get back to driving the vehicle yourself, do:

vdriver

by itself.

You can also load vehicles right on the initial /py vehicle command. The Raspberry Jam Mod comes with two vehicles made by my kids: TIE_Fighter and X-Wing_Fighter. You can pilot the X-Wing, for instance, by doing:

/py vehicle l X-Wing_Fighter

(Or to load in non-destructive mode, do /py vehicle nl X-Wing_Fighter). Then to make it be auto-piloted by a bat (will look like a drunken pilot), press T and type:

vdriver Bat

Unfortunately, for a vehicle to be small enough to move without much lag, it probably has to be hand-drawn rather than generated from a mesh.