import mcpi.minecraft as minecraft import mcpi.block as blockmc = minecraft.Minecraft.create("localhost", 4711) pos = mc.player.getTilePos()width, height, depth = 5, 4, 5mc.setBlocks(pos.x - width//2, pos.y - 1, pos.z - depth//2, pos.x + width//2, pos.y - 1, pos.z + depth//2, block.STONE.id) //地板mc.setBlocks(pos.x - width//2, pos.y, pos.z - depth//2, pos.x + width//2, pos.y + height, pos.z + depth//2, block.WOOD.id) //墙壁mc.setBlocks(pos.x - width//2 + 1, pos.y, pos.z - depth//2 + 1, pos.x + width//2 - 1, pos.y + height - 1, pos.z + depth//2 - 1, block.AIR.id) //挖空内部mc.setBlock(pos.x, pos.y, pos.z - depth//2, block.AIR.id) mc.setBlock(pos.x, pos.y + 1, pos.z - depth//2, block.AIR.id) //门口mc.setBlock(pos.x + width//2, pos.y + 2, pos.z, block.GLASS.id) mc.setBlock(pos.x - width//2, pos.y + 2, pos.z, block.GLASS.id) //窗户mc.setBlocks(pos.x - width//2, pos.y + height, pos.z - depth//2, pos.x + width//2, pos.y + height, pos.z + depth//2, block.WOOD_PLANKS.id) //屋顶mc.postToChat("房子已建成!") `