# Processing and Minecraft

**URL:** <https://discourse.processing.org/t/processing-and-minecraft/12494>\
**Category:** Teaching\
**Created:** [July 4, 2019, 7:03am UTC](https://discourse.processing.org/t/processing-and-minecraft/12494 "2019-07-04T07:03:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaotiklabs](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@kaotiklabs](https://discourse.processing.org/u/kaotiklabs)\
**Post date:** [July 4, 2019, 7:03am UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/1 "2019-07-04T07:03:03Z")

</div>

Hi,  
I’m teaching my students basic programming and would like to know if there’s any way to join processing language with minecraft through any mod or something else.  
I would like to interact with the world, bot programming, etc…

It would be an awesome way to get them focused hehe.  
As minecraft is also java based, it should not be very complicated I think.

---

<div class="post-metadata">

**Author:** ![mcintyre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mcintyre/32/14561_2.png) [@mcintyre](https://discourse.processing.org/u/mcintyre)\
**Post date:** [July 4, 2019, 4:10pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/2 "2019-07-04T16:10:32Z")

</div>

Cool!! I had a Raspberry Pi sitting around and got the basic connection working with Minecraft Pi. The process may be similar on Windows/macOS but I don’t have a license (yet).

First, create a new sketch and add a `code` folder within the sketch’s folder. Next, copy the `McPi.jar` file from `/opt/minecraft-pi/api/java/lib/` to the sketch’s `code` folder. With a game open, run the following sketch.

```java
import pi.Minecraft;

void setup() {
  Minecraft mc = Minecraft.connect();
}

void draw() {
  // profit
}

```

I teach mathematics and computer science and would love to help out–just started a [project](https://github.com/nickmcintyre/processing-minecraft).

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 4, 2019, 4:56pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/3 "2019-07-04T16:56:41Z")

</div>

> [@mcintyre](#):
>
> First, create a new sketch and add a “code/” folder within the sketch’s folder.

At least in the Windows version (but it should work for all OS versions AFAIK), dragging and releasing a “.jar” file on the PDE automatically creates the subfolder “code/” and copy the “.jar” file into it. ☕

---

<div class="post-metadata">

**Author:** ![mcintyre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mcintyre/32/14561_2.png) [@mcintyre](https://discourse.processing.org/u/mcintyre)\
**Post date:** [July 4, 2019, 6:29pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/4 "2019-07-04T18:29:16Z")

</div>

Nice–yep works on the Pi!

---

<div class="post-metadata">

**Author:** ![kaotiklabs](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@kaotiklabs](https://discourse.processing.org/u/kaotiklabs)\
**Post date:** [July 5, 2019, 3:44pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/5 "2019-07-05T15:44:31Z")

</div>

Great you are also interested!  
I’m using mac licensed version and can’t find the lib to import. anyone?

---

<div class="post-metadata">

**Author:** ![mcintyre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mcintyre/32/14561_2.png) [@mcintyre](https://discourse.processing.org/u/mcintyre)\
**Post date:** [July 6, 2019, 8:36pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/6 "2019-07-06T20:36:01Z")

</div>

Made a little progress on macOS this afternoon–might suggest a general solution.

I installed version 1.12.2 of Minecraft, [Forge](http://files.minecraftforge.net/), and the [Raspberry Jam Mod](https://github.com/arpruss/raspberryjammod/releases/latest), which implements nearly the same API as Minecraft Pi.

I created a world and tried running the [rainbow example](https://dev.bukkit.org/projects/raspberryjuice) with Jython from the terminal and it worked! Next, I modified the rainbow example a bit in [Python Mode](https://py.processing.org/), saved the sketch, then copied the `mcpi` package to the sketch’s folder. I created another new world, ran the sketch, and clicked on the window that popped up.

```python
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()
rainbow_height = 60
mc.setBlocks(-64, 0, 0, 64, rainbow_height + len(colors), 0, 0)
            
def draw():
    if mousePressed:
        for x in range(0, 128):
            for colourindex in range(0, len(colors)):
                y = sin((x / 128.0) * pi) * rainbow_height + colourindex
                mc.setBlock(x - 64, y, 0, block.WOOL.id, colors[len(colors) - 1 - colourindex])

```

 ![rainbow](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8790b9725e50725efe9b23e0ec584823fea2c677.png)

Translating the `mcpi` package to Processing/Java could be a good starting point for something that works cross-platform.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 8, 2019, 2:25pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/7 "2019-07-08T14:25:50Z")

</div>

There are so many ways to engage students learning to program.

It all started here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

I have had success with these individually and in combination to create some very cool projects:

1. Serial communications  
[Electronics / Processing.org](https://processing.org/tutorials/electronics/)

- Processing to\from Ardunio
- Processing to\from Processing
- Processing to applications that use serial communications
- Processing to any hardware that has serial communications

1. Network Client to Server  
[Network / Processing.org](https://processing.org/tutorials/network/)

2. Data from Network and PC  
[https://processing.org/tutorials/data/](https://processing.org/tutorials/data/)  
XML, JSON, tables, text files, etc.

3. Sound  
[Sound / Processing.org](https://processing.org/tutorials/sound/)

4. Interactivity:  
[Interactivity / Processing.org](https://processing.org/tutorials/interactivity/)

- keyboard, mouse and check out tools and libraries!

1. Print  
[Print / Processing.org](https://processing.org/tutorials/print/)

2. GUI interface to run a command-line tool  
I used some JAVA directly for this in the Processing applications.  
It was to control my LCD screen colors; I created an interface to a free command-line tool that did this.

3. Video  
[Video / Processing.org](https://processing.org/tutorials/video/)

4. And… check out the tools and libraries in the Processing software!

5. And… there are other modes like Android mode!  
Ketai libraries:  
[http://ketai.org/](http://ketai.org/)

I mostly just tinker with it as a hobby and posted some videos here:

> **[GLV](https://www.youtube.com/user/etshopstuff)**
>
> Stuff. :)

🙂

---

<div class="post-metadata">

**Author:** ![robertoxyz20](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/robertoxyz20/32/7513_2.png) [@robertoxyz20](https://discourse.processing.org/u/robertoxyz20)\
**Post date:** [December 16, 2019, 11:56pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/8 "2019-12-16T23:56:52Z")

</div>

Do you know how to read data from minecraft? For example: money, x, y, z position, active enchantment …

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 17, 2019, 12:00am UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/9 "2019-12-17T00:00:13Z")

</div>

What form of Minecraft are you running – what version, on what hardware / platform, with what operating system? Did you try the version and example described above?

---

<div class="post-metadata">

**Author:** ![robertoxyz20](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/robertoxyz20/32/7513_2.png) [@robertoxyz20](https://discourse.processing.org/u/robertoxyz20)\
**Post date:** [December 21, 2019, 10:41pm UTC](https://discourse.processing.org/t/processing-and-minecraft/12494/10 "2019-12-21T22:41:54Z")

</div>

The version I have is 1.14 on PC x64 bits. Finally, what I want is to send data such as position, life, hunger, strength, that kind of variables towards arduino led matrix. But I have no idea how to read data from minecraft. I will try your example for var if it works on PC.
