Could somebody please explain to me how to do these through an ssh tunnel (i am a complete python noob):
1. initialize the coding environment (what to import in the python console, how to connect to minecraft)
2. placing a block, placing larger figures like cubes
3. creating my own functions, like one to auto- create a cube of a specified size (do i need to make a separate script, or can i do it directly in the console?)
4. how to move the character
i think that's it. i really wish mojang would make a quick user's guide on how to do this.
1. You need to be running minecraft pi on the pi its self before you start plenty of info there.
2. now open a command prompt and cd into the api directory which should be something like "/home/pi/mcpi/api/python/mcpi"
2. At the command prompt type "python" some text is displayed and your prompt becomes >>>
3. Now type "import minecraft as minecraft" and press enter
4. type "mc = Minecraft.create()" press enter
5. now type "mc.postToChat("Hello, Minecraft!")"
6. to place a block type "mc.setBlock(0,5,0,46)" then press enter in this exampe a tnt block is placed at hight 5 above the spawn(0,0,0) the command works like this (x,y,z,blockid,[data])
hope this gets you started
Last edited by radcom123 on Mon Feb 11, 2013 10:08 pm, edited 1 time in total.
but since i already imported minecraft.py, i thought i didnt have to specify that Minecraft was in minecraft.py? oh well.
and minecraft.py is the only thing i had t import, right? is there any reason i would need to import the other files in the api folder, or are they imported for me?
okay, thanks. in theory, it should be possible to run multiple minecraft python 'services' at a time- say, one for the bridge, another for the clock program in the forums, one for general building use, etc?
and i could run all of these 'services' on a separate computer and connect to my pi's ip to cut down on the cpu load right?
Yes you can multiple services and yes you can run them from another computer. However I suspect the bottleneck will be the minecraft server running on the Pi itself, even though you have off-loaded the running of the scripts to do stuff in minecraft, the changes to the minecraft world will still be happening on the Pi.
Give it a stress test, see what performance you can get from it!
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"
wow, that was a big difference!
my "stress" test was this:
clear from (64,64,64) to (-64,-64,-64)
run 3 advanced digital clock instances (the post for that is in the forum)
time how long it takes to make a menger sponge with a depth of 3.
The menger sponge code (and a lot more) is in the first post in
the actual commang i used was (the code is imported as form)
When on the raspberry pi through ssh, it took 1:07.68 to build the menger sponge.
When the programs ran on my laptop (minecraft was still on the pi), it took 12.91 seconds!
And this is with 3 samba shares and a CUPS server running in the background.
So running remotely rather than on the Pi and ssh'ing is actually about 5.5x faster.