Doesn't mcpi work in Minecraft Education Edition?
Hello, fellow teachers.
Greetings from South Korea.
I'm currently working on building my contents teaching python with M:EE.
I've got several books about teaching python with Minecraft Java but it seems there is no book teaching python with Minecraft Education Edition.
So I'm trying to follow what one of the book with Java says, but it doesn't work and says
SyntaxError: invalid syntax
ModuleNotFoundError: No module named 'mcpi'
My question is as follows.
"Doesn't mcpi work at Minecraft Education Edition?"
=======================
the code I tried to commit was as follows.
-
Hello! I am very happy to meet another educator who is also teaching student Python in Minecraft! (Since this is a coding question, I will move this to the Coding with Minecraft area of the community, where it may get attention from folks who know a bit about this.)
I have not tried to use mcpi in Minecraft, but I will look into it. =] Is "gasbugs" the name of the player, and you are trying to get info on the player?
I am unaware of any print capability in Minecraft EDU, but I will look around. I use the say command. You used this command: pos.x += 5 For commands like this one, I usually am using the tilde character, or the from_me() function.
This gives you the very basics of where I start: http://tech.grandmadeb.com/index.php/2021/07/31/minecraft-education-notebooks-intro-posts/
0 -
I've taught Python coding in Minecraft using mcpi, and it does not work with M:EE. I don't know the technical reasons or details but the API used in Python in M:EE with MakeCode is different. And the Python API in Jupyter Notebooks is different from the one in MakeCode.
I am still a huge fan of the mcpi API, but the only way I know to use it is to either use Java Edition, which requires a Minecraft license and running a local server, OR run it on the Raspberry Pi, which does not require a license or a server. But it does require having and running Raspberry Pi's!
The "bible" for this is the book Adventures in Minecraft by O'Hanlon and Whale. I love that book! But as far as I know, there isn't a way to incorporate that into M:EE, which is based on Bedrock code base. I would happily stand corrected if someone knows of a way to do this!
0 -
This is my best attempt to recreate what you are doing in Python Notebooks. Usually, the agent moves left or right, forward or backward, rather than on the cartesian coordinates. I don't believe I can overwrite location data. I believe it is a tuple, and immutable.
my_spot = player.position # this function returns coordinates of my locationsay(my_spot)agent_spot = from_me(0,5,0) # Give the agent a spot 5 blocks awaysay(agent_spot)agent.teleport(agent_spot) # Set the agent up to place some blocksagent.give("grass",64,1)for index in range (1,10): # Attempt to place blocks in different locations by changing agent dataagent.place(1,"down")say(agent.position)say(agent.position.x) # this workspos_x = agent.position.x + 1.0say(pos_x)say("tried")agent.position.x = pos_x # this doesn't worksay("*new*")say(agent.position.x) # no chane - I don't think it is addressable0 -
Okay, yippee! I am making a new post because I don't want to be confusing. The previous code does not work because locations are tuples, and immutable. You cannot assign a new value to the x,y, or z component.
So I figured a workaround. Forgive all of the "debug" say commands. They are (obviously) unnecessary to the execution, but they make it easier to follow along.
my_spot = player.position # this function returns coordinates of my locationsay(my_spot)agent_spot = from_me(5,0,0) # Give the agent a spot 5 blocks awaysay(agent_spot)agent.teleport(agent_spot) # Set the agent up to place some blocksagent.give("grass",64,1)for index in range (1,10): # Attempt to place blocks in different locations by changing agent dataagent.place(1,"left")say("Agent position now is:")say(agent.position)say(agent.position.x) # this workspos_x = agent.position.x + 1.0say("new x")say(pos_x)pos_y = agent.position.ypos_z = agent.position.zagent.teleport((pos_x,pos_y,pos_z))say("Did agent move?")say(agent.position)1 -
That's mighty impressive, Debbie!
My only complaint about the Python notebooks is the inability to save your code.
0 -
Well, I do wish I didn't have to keep up the copy pasta... At least now I can save from the Mac window. When I first started, I couldn't and that took some serious work-arounds!
And thanks. (blushes!) I was happy to have a class cancelled today and have a bit of time for fun!
0 -
Have you finally succeeded in using mcpi with Minecraft Education Edition?
0 -
Rodrigo González - if you read the thread carefully, you will see that Bob Irving replied in the third comment that mcpi does not work in MC:EE - so no, it won't succeed. Please take the time to engage and be a part of the conversation. We'd love to join in with you, but you need to do your part, too, and read up! =]
0 -
Sorry I didn't express myself right. What I meant is that probaly you can install mods and plugins in Minecraft Education Edition as well?. Would it be possible to hack Minecraft EE to install forge and raspberry juice? This would open a gate to allow working with mcpi
0 -
I'm sorry that won't work, Rodrigo. the mcpi API is written to worth with Java Minecraft. And M:EE is Bedrock. The code bases are different. Java MC uses Java(!), and Bedrock uses C++. So mods and plugins that work on the Java edition don't work on Bedrock.
Sad but that's the way it is.
0 -
Thanks! Funny that two versions of the same game are coded in different programming languages!
0 -
I am too looking for this info in order to figure out if there's a way that I can use all the functions from MakeCode with M:EE.
For example, there is a specific mob related function in MakeCode such as below :
https://minecraft.makecode.com/reference/mobs/on-mob-killed
I assume that mcpi won't provide such preset functions which I am going to need in mcpi+Raspberry Pi environment to make a game.
0
Please sign in to leave a comment.
Comments
12 comments