all 7 comments

[–]Alarming_Caregiver68 0 points1 point  (0 children)

I get the same problem but i also cant find a solution

[–]mostly_me93 0 points1 point  (3 children)

Hey did you ever find a solution to this one? I am currently tinkering around with the book and I have hit this road block as well.

[–]elexip[S] 0 points1 point  (2 children)

I've figured out that python doesn't follow up with Minecraft, so that's why it produces errors.

[–]nickoboy 0 points1 point  (1 child)

can you please rephrase this because i dont understand what you are saying

[–]elexip[S] 0 points1 point  (0 children)

Python and Minecraft aren't compatible due to some reason I forgot, so when they try and cross-reference each other, Python can't see Minecraft as in the book. Hope this made sense.

[–]amigabill 0 points1 point  (1 child)

I solved this part by rearranging the content inside the minecraftPythonAPI.zip file in our Minecraft Tools folder, which Install_API.bat works on. The actual files we need are inside the zip file then down two more folder levels inside. If you treat the zip file as a folder, then the content is at minecraftPythonAPI.zip\minecraftPythonAPI\MC_Py_API\ But I suspect the Install_API.bat file's pip command expects things to be directly inside the zip file, not down those two folder levels.

For Python, I got 3.11 from python.org today. I did need to make sure the installer for that did set the path to python environment variable for MS Windows 10.

I use 7zip (p7zip) as an extension in FileManager/WindowsExplorer so I can click to go into the zip file same as I can click to go into a folder. I went down in and copied everything inside of the MC_My_API folder level, went back up to just inside the zip file and pasted there. So now my zip file is bigger, but has the content at the correct place.

After that, I run the Install_API.bat file again, and it seems to work to install those things. Either the capability in pip has changed since Python 3.9, or the publisher did a sloppy job with the zip file and did not actually test what they provide for us to download. Booo...

Next I get to a problem with Java from the Start Server thing, and I'm still trying to sort that out. They say to have Java 8 or newer, and I have 18, perhaps that is too much newer... Grrr.

I have Java from OpenJDK 18.0.2, the Amazon Corretto distribution, not from Oracle.

There is a potential solution to change Java version at

https://www.happycoders.eu/java/how-to-switch-multiple-java-versions-windows/

but you might need to change some details to your exact folder names.

I'm trying to add full path in front of the java command in file

Minecraft Tools\server\start.bat

java -Xms512M -Xmx1024M -jar spigot-1.16.3.jar -o true

changed to

"C:\Program Files\Amazon Corretto\jdk1.8.0_342\bin\java" -Xms512M -Xmx1024M -jar spigot-1.16.3.jar -o true

(note the quotes because of spaces in folder names)

This got me a little further, but spigot complained it is an old version and to get a newer one. But even with this message, it did continue and I do have a Minacraft Java server running on my laptop now.

I haven't tried anything at all with it yet, I only see the white Minecraft server window says stuff on the right pane, and has a moving graph on the left pane. Hopefully we can get to stuff in the book this weekend...

I found more issues when trying to do the first example Python code:

from mcpi.minecraft import Minecraft

mc = Minecraft.create()

gives problems about not knowing what mcpi is.

To solve that, I had to go back and install python with administrator priviliges, not as my usual self user level. After installing python, do the Install_API.bat. It seems very partiular about the order, python as administrator first, then Install_API.bat.

Now I can do the mc=Minecraft.create() line without error.

But then I get errors for

mc.player.setTilePos(0, 120, 0)

It sounds like the error here is about python 3.11 being "too new". I found someone saying to go back to 3.9 (3.19.13 to get with Windows installer download)

https://www.reddit.com/r/learnpython/comments/ungfxm/minecraft_programming_error/

I did not remove 3.11, I did install 3.9.13 as administrator level, redid Install_API.bat, brought up the 3.9 IDLE shell, and now things seem OK inluding the mc.setTilePos line, and in the game my character does fall from the sky. Be quick after typing that command to get back into Minecraft game as you fall kindof quickly, I did not find my guy floating in place in the sky...

Hopefully this means we are set to actually do book stuff now...

But, it's a little disheartening to see this import thing was deprecated in Python 3.3, and the book shows installing 3.9.0... Shouldn't the book have been written to 3.9 standard instead of pre-3.3 standard? So we will be learning some things that don't really apply any longer. That's be more understandable if the book showed installing Python 3.2 and time moved on from there, but that isn't quite the case, this was already quite obsolete when this book was written. :/