invalid argument

Minecraft Pi for Millionaires

If you were a millionaire, living in a minecraft-kind-of-world, I’m sure you would want to have an enormously ostentatious fish tank for your block-shaped tropical fish to swim in.

fish tank


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

world = minecraft.Minecraft.create()

x, y, z = world.player.getTilePos()

x += 2
z += 2

# clear area
world.setBlocks(x, y, z, x + 20, y + 10, z + 20, block.AIR)

width = 8
height = 3
depth = 5
# glass block
world.setBlocks(x, y, z, x + depth, y + height, z + width, block.GLASS)

# fill it with water
x += 1
z += 1
y += 1

depth -= 2
width -= 2
height -= 1
world.setBlocks(x, y, z, x + depth, y + height, z + width, block.WATER)


Now that the fish are taken care of, the minecraft millionaire about town might like to own their own human fish tank, which we usually call a swimming pool. The code that worked for the fish tank can be sunk into the ground and work just as well as a lovely swimming pool.

swimming pool


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

world = minecraft.Minecraft.create()

x, y, z = world.player.getTilePos()

x += 2
z += 2

# clear area
world.setBlocks(x, y, z, x + 20, y + 10, z + 20, block.AIR)

width = 8
height = 3
depth = 5

# glass block in the ground
y -= height + 1
world.setBlocks(x, y, z, x + depth, y + height, z + width, block.GLASS)

# fill it with water
x += 1
z += 1
y += 1

depth -= 2
width -= 2
height -= 1
world.setBlocks(x, y, z, x + depth, y + height, z + width, block.WATER)