Learn to program Python within a multiplayer world we all know and love, Minecraft!
Code yourself superpowers, build algorithms to construct large buildings or cities, even make a competitive PVP environment pitting your code-magic skills against your friends! Make learning to code fun!
(Disclaimer: TeachCraft is not associated with Mojang/Minecraft)
With only a few lines of code, grant yourself the magical power to teleport wherever you shoot your arrow.
Make your spells dynamic - by typing in a new spell name in chat, cause different python code to be active!
Observe this example, which grants your bow/arrow the power to teleport, or explode into a pool of lava, and is toggled by you typing the name of the spell in Minecraft chat!
import mcpi.minecraft as minecraft import time mc = minecraft.Minecraft.create(address="127.0.0.1", name="stevetest") active_spell = "teleport" while True: for blockhit in mc.player.pollProjectileHits(): if active_spell == "teleport": mc.player.setPos(blockhit.pos.x, blockhit.pos.y, blockhit.pos.z) elif active_spell == "lavapool": lava_block_id = 10 mc.setBlocks(blockhit.pos.x+4, blockhit.pos.y-1, blockhit.pos.z+4, blockhit.pos.x-4, blockhit.pos.y-1, blockhit.pos.z-4, lava_block_id) for chatpost in mc.player.pollChatPosts(): if chatpost.message.lower() == "lavapool": active_spell = "lavapool" elif chatpost.message.lower() == "teleport": active_spell = "teleport" time.sleep(.1)