invalid argument

It's Raining Blocks

A super simple rain simulator creates blocks at random positions in the sky and lets them fall to the ground under minecraft physics.


import mcpi.minecraft as minecraft
import mcpi.block as block
import time
import random

world = minecraft.Minecraft.create()

while True:

  x = random.randint(-100, 100)
  y = 100
  z = random.randint(-100, 100)
  
  world.setBlock(x, y, z, block.WATER)
  time.sleep(random.randint(1, 5))


The slightly weird thing about this is the “rain” is much more like a waterfall. A single block stays in place in the sky and just leaks water downwards until it reaches the ground and then just sort of pools.

If you don’t like water, you could substitute ice blocks or even lava, Dante’s Peak style. Lava has different properties to water (no kidding!) in that it takes on a little bit more life and starts to bubble up and grow from wherever it was left.

This is a pretty “destructive” script in that it leaves a lot of messy blocks all over the world so you probably want to run it in a world that you don’t mind throwing away afterwards.