15

My son wants to make a game in Python that is materialized in Minecraft. If he does that using the RasPi Edition, can that same Python code control the normal Minecraft on a PC? My guess is that Python sends commands to Minecraft rather than running in the same VM, so it should work for both.

RichVel
  • 103
  • 3
Jim L.
  • 325
  • 1
  • 3
  • 12

4 Answers4

13

Check out my blog post Drawing Sierpinski's Triangle in Minecraft Using Python. I was able to write Python code that plugs into the open source Minecraft server called Bukkit. You can use a normal Minecraft client on OS X to connect to the Bukkit server.

It's not as easy to setup as it is on Raspberry Pi, but it does work.

techraf
  • 4,319
  • 10
  • 31
  • 42
  • Note: Code written for the Raspberry Pi should be almost exactly the same as code written for the RaspberryJuice plugin (The plugin used in the above link). However, it is not quite complete, so you may have to tweak your code slightly in some circumstances. – daviewales Dec 19 '13 at 04:12
9

I wrote a Forge mod (Raspberry Jam Mod) for desktop Minecraft that implements most of the Pi version's protocol, and works with the scripts I've tested. Event handling is the major omission.

Source code and binaries are here.

To install, you'll need python, Minecraft 1.8, Minecraft Forge, my Raspberry Jam Mod and the Minecraft PI Python package. Then:

  1. Install Forge for 1.8.
  2. Create a Minecraft profile that uses it.
  3. Create a mods subdirectory to your Minecraft directory (%appdata%.minecraft on Windows).
  4. Put my mod in the mods directory.
  5. Create an mcpipy subdirectory to your Minecraft directory.
  6. Put the contents of the Minecraft PI Python package into the mcpipy directory.
  7. Create a Minecraft profile that uses the 1.8 Forge.
  8. Run Minecraft and create a world.
  9. Run python scripts via commandline or straight in Minecraft via /py scriptname. E.g., /py nt7s_sphere will draw a sphere.

If you want even more detail, I wrote an Instructable.

Alexander Pruss
  • 194
  • 1
  • 5
3

I found this working for me with Minecraft 1.7.10 (as user875707's answer solution is meant to be used with Minecraft 1.8).

https://github.com/kbsriram/mcpiapi

All the instructions are in the link above but basically, you just need to download the .jar they offer you and drop it into your your_minecraft_folder/mods/.

You will both need Forge installed and Python (2 or 3 even though the sample scripts are designed for Py2).

Also makes sure that Python is in your PATH (aka you can just type python in your terminal - use this if it isn't).

That's about that simple for setup.

Place your scripts in your_minecraft_folder/mcpimods/python/ and launch from ingame by typping /python yourscriptname (or just /py yourscriptname), do not include the .py at the end of yourscriptname. If anything went wrong, check your console to see the error.

EDIT: Very powerful tool, BE CAREFUL, I did manage to corrupt my world. Hopefully I had AromaBackup installed which does automatic backup every so often (30 minutes for me).

EDIT 2: I found out you can also you the mod CustomNPC which allows you to use about whichever languages you want to run the NPCs (themselves can do a lot of things, including running commands, etc).

jeromej
  • 129
  • 4
0

No not really. At this point the three versions (pc, xbox and minecraft) are all entirely different branches. A mod will often not work on a pc from version 1.x to version 1.x+1 so you're really not going to see any kind of cross compatibility.

Jacobm001
  • 11,898
  • 7
  • 46
  • 56