Skip to content

Instantly share code, notes, and snippets.

@NT7S
Last active March 26, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NT7S/4942078 to your computer and use it in GitHub Desktop.
Save NT7S/4942078 to your computer and use it in GitHub Desktop.
Create a sphere in Minecraft Pi Edition Quick, dumb, and dirty, but it shows the basics of how to access the API.
import minecraft.minecraft as minecraft
import minecraft.block as block
mc = minecraft.Minecraft.create()
mc.postToChat("Hallo, here's your sphere")
radius = 6
playerPos = mc.player.getPos()
for x in range(radius*-1,radius):
for y in range(radius*-1, radius):
for z in range(radius*-1,radius):
if x**2 + y**2 + z**2 < radius**2:
mc.setBlock(playerPos.x + x, playerPos.y + y + radius, playerPos.z - z - 10, block.GOLD_BLOCK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment