Issue with location parameter when using summon command in Notebooks
I'm having difficulty specifying location for summoning a mob in Python Notebooks.
Last year, when I went through this in my class, it was possible to include a location for where you wanted the mob to be summoned to, exactly as per the Chicken Rain tutorial:
-
Official comment
Our new Python Library Reference Guide with all commands, six associated exercises in the new Python Playgrounds, and a new MS Learn course for Advanced Python due out at the end of the month! Debbie Alexander Pucheng Mao
-
Hi, Jenny Godingt ! i will take a peek right now! I'm glad to know you are continuing in Python Notebooks! =]
Checked it to be sure: if you run this from too far a way, the distance may not allow the command.
chickens = 100for count in range(chickens):summon("chicken", "2 0 0")# This is an absolute location# If you are on a flat world, your chickens are# spawning into the void, or# in the bottom layer of bedrockI don't want to assume this solves anything for you, though. Do your commands work without a location? Can you change the absolute location to be near your spot on the map? Does that help? Let me know! =]0 -
Hi Debbie,
Thanks so much for that! - I'd been using world.set () earlier, which of course uses location relative to the player's position, and I'd completely forgotten that summon () uses the absolute position.
I had a few students getting that same error last year, and could never quite work out what that error message was about - most likely, they were too far away from the spawning location. So this time around, I'll have a much better idea of what the problem is.
The notebooks are a great set up - the perfect combination of basic Python skills with Minecraft. We have quite a few students who pick our Digital Technology elective because they've heard they'll get to do Minecraft, then they get into the coding side of things and are hooked!
0 -
Glad to help. So just to clarify, the coordinates with quotation marks, "2 0 0" are absolute, unless you use tilde, such as "~2 ~0 ~0" in which case they are relative... and (2,0,0) is also absolute, and does not allow tilde.
(I hope I am getting that right; I am not double checking it with code at the moment. very dangerous)
0 -
hi, Debbie Alexander:
Hello, I would like to ask, where can I find the complete python api manual? I only found this documentation: https://education.minecraft.net/wp-content/uploads/Code_Connection_API.pdf
However, the documentation does not give a good description of the representation of similar positions. I sometimes use the makecode editor, where the pos(x,y,z) function is used for the relative position. I don't know where there is a more detailed explanation?
Or Notebooks and makecode editor are completely different Apis ?
Thanks a lot.
0 -
I m sorry, I did not see this until recently. The only manual I know of is the documentation I have posted on my blog, here:
http://tech.grandmadeb.com/index.php/2022/06/20/where-are-all-of-the-minecraft-coding-manuals/
0
Please sign in to leave a comment.
Comments
6 comments