code

From the GUI you need to open up 2 terminal windows,  one is to run minecraft the other is to run your code from the api directory

Game directory

/home/pi/minecraftpi/mcpi

pi@raspberrypi ~/minecraftpi/mcpi $ ls -l
total 1208
drwxr-xr-x 5 pi pi 4096 Apr 18 15:06 api
-rw-r–r– 1 pi pi 488 Apr 18 15:07 CONTROLS.txt
-rw-r–r– 1 pi pi 488 Dec 20 17:10 CONTROLS.txt~
drwxr-xr-x 4 pi pi 4096 Apr 18 15:06 data
-rw-r–r– 1 pi pi 208 Feb 11 10:07 HOW_TO_RUN.txt
-rw-r–r– 1 pi pi 319 Feb 11 11:01 LICENSE.txt
-rwxr-xr-x 1 pi pi 1206760 Feb 11 10:49 minecraft-pi
-rw-r–r– 1 pi pi 0 May 16 16:37 options.txt
-rw-r–r– 1 pi pi 13 Feb 11 10:04 VERSION.txt
pi@raspberrypi ~/minecraftpi/mcpi $

 

Note the api directory

in the OTHER terminal window navigate to

/home/pi/minecraftpi/mcpi/api/python/mcpi

pi@raspberrypi ~/minecraftpi/mcpi/api/python/mcpi $ ls -l
total 100
-rw-r–r– 1 pi pi 197 May 16 16:44 blockline2.py
-rw-r–r– 1 pi pi 190 May 16 16:41 blockline2.py~
-rw-r–r– 1 pi pi 208 May 16 16:19 blockline.py
-rw-r–r– 1 pi pi 208 May 16 16:18 blockline.py~
-rwxr-xr-x 1 pi pi 3000 Feb 11 10:26 block.py
-rw-r–r– 1 pi pi 3998 May 12 23:50 block.pyc
-rwxr-xr-x 1 pi pi 1607 Feb 7 13:35 connection.py
-rw-r–r– 1 pi pi 2560 May 12 23:50 connection.pyc
-rwxr-xr-x 1 pi pi 689 Feb 11 10:16 event.py
-rw-r–r– 1 pi pi 1361 May 12 23:50 event.pyc
-rwxr-xr-x 1 pi pi 0 Dec 19 19:03 __init__.py
-rwxr-xr-x 1 pi pi 6192 Feb 11 10:24 minecraft.py
-rw-r–r– 1 pi pi 10653 May 12 23:50 minecraft.pyc
-rw-r–r– 1 pi pi 64 May 12 23:38 README.md
-rw-r–r– 1 pi pi 452 May 12 23:38 tutorial1.py
-rw-r–r– 1 pi pi 849 May 14 00:58 tutorial2.py
-rw-r–r– 1 pi pi 850 May 14 00:55 tutorial2.py~
-rw-r–r– 1 pi pi 2282 May 12 23:38 tutorial3.py
-rwxr-xr-x 1 pi pi 289 Feb 7 13:34 util.py
-rw-r–r– 1 pi pi 712 May 12 23:50 util.pyc
-rwxr-xr-x 1 pi pi 2422 Feb 11 10:55 vec3.py
-rw-r–r– 1 pi pi 5122 May 12 23:50 vec3.pyc

 

This is the directory with some python files in, for the purpose of the programming tutorials you need

tutorial1.py, tutorial2.py and tutorial3.py

blockline.py is my current project,  to allow users to specify which block to enter,  however I am having issues with this and am attempting to debug.

 

To run code ,  start up minecraft,  then start a game,  press escape this should release mouse control,  go to the 2nd terminal window and type

python progname.py to run the code,  switch back to the minecraft window and you should see the programme running.  (progname.py being the name of the program you want to run of course)

Have a look for error messages in the terminal window when you run the code.

 

So far all I have is this for my project to specify which block to add

https://github.com/zleap/helloworld/blob/master/blockline.py