Last active
March 26, 2019 15:59
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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