Minecraft编程——建造巨大的黄金金字塔

代码如下:

import mcpi.minecraft as minecraft
import mcpi.block as block

mc = minecraft.Minecraft.create()
pos = mc.player.getTilePos()

x = pos.x
y = pos.y
z = pos.z

width = 100 #第一层边长
high = 0 

while True:
    for a in range(width):
        for b in range(width):
            mc.setBlock(x+a+high, pos.y+high, pos.z+b+high, block.GOLD_BLOCK.id)

    width-=2
    high+=1

    if width <= 0:
        break

 

 

效果截图:

猜你喜欢

转载自blog.csdn.net/paulzhang/article/details/82918950