Chicken Rain


Let’s get started with coding in Minecraft! Why not add some life to your world? Maybe a chicken… No, let’s have LOTS OF CHICKENS!!!

Chicken rain

Step 1: Spawn a chicken

Let’s spawn a chicken directly above the player’s head:

mobs.spawn(CHICKEN, pos(0, 10, 0))

This tells Minecraft to spawn a chicken at coordinates relative to the player’s location. The positon of (0, 10, 0) is 10 blocks above the player’s head.

Step 2: Test

Run your code by pressing the green arrow button. You should see a flying chicken above your head!

Step 3: More chickens

The chicken is lonely. To give our chicken some friends, we can run this line code several times using a loop. Add a loop to your code to spawn more chickens:

# @highlight
for i in range(100):
    mobs.spawn(CHICKEN, pos(0, 10, 0))

Be sure you indent the mobs.spawn code by using the “tab” key.

Step 4

Run your code again and see a flock of chickens overhead!

Well Done!