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

Chat Command

Put in an ||player:on chat command|| and rename it to chicken.

player.onChat("chicken", function () {
})

Spawn a chicken

Put in ||mobs:spawn|| to spawn a chicken at your position.

The code under ||player:on chat command|| will run when you type chicken in the Minecraft chat. ~0 ~0 ~0 is the relative 3D position of the player.

player.onChat("chicken", function () {
    mobs.spawn(CHICKEN, pos(0, 0, 0))
})

Move the chicken up

Change the spawn position to 10 blocks above your player.

The second number in ~0 ~10 ~0 means 10 blocks above of the player elevation. The ~ symbol means that the coordinate is relative to the player.

player.onChat("chicken", function () {
    //@highlight
    mobs.spawn(CHICKEN, pos(0, 10, 0))
})

Test your chat command

Go to Minecraft, press t to open the chat and enter chicken. You should see a flying chicken!

Make more chickens!

The chicken is lonely. Place a ||loops:repeat|| loop around ||mobs:spawn|| to create 100 chickens!

player.onChat("chicken", function () {
    //@highlight
    for (let i = 0; i < 100; i++) {
        mobs.spawn(CHICKEN, pos(0, 10, 0))
    }
})

Try your new chat command!

Well Done! You’ve completed your first Mod!