Chicken Rain

Chickens!

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

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 position of (0, 10, 0) is 10 blocks above the player’s head.

Test

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

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.

Run your code!

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

Well Done!