# Leaping Salmon

## Introduction

Look out, salmon are leaping dangerously high! We must create ponds for them to land in!

## Swing a ‘trident’

We’ll use a Trident to cause salmon to make giant leaps into the sky. Add a `||player:on item used||` to your code and set the item type to Trident.

``````player.onItemInteracted(TRIDENT, function () {

})``````

## Use a ‘repeat’ loop

We want multiple fish to spawn for each Trident use, so insert a `||loops:repeat||` loop into the `||player:on item used||` block and set the repeat number to 6.

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
}
})``````

## Spawn some salmon

Now it’s time to spawn the salmon. Put a `||mobs:spawn||` into the `||loops:repeat||` loop and set the animal type to Salmon.

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
mobs.spawn(SALMON, pos(0, 0, 0))
}
})``````

## Set random positions

If the salmon all spawn to the same place, you won’t see how grand the feat was! Let’s add a `||positions: pick random position||` into the `||mobs:spawn||` instruction to spread the fish apart randomly.
Set the from position to ~-3 ~30 ~-3 and the to position to ~3 ~30 ~3. That’ll make them spawn high in the sky over a nice area!

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
mobs.spawn(SALMON, randpos(
pos(-3, 30, -3),
pos(3, 30, 3)
))
}
})``````

## Save the salmon!

We’ve just made it so the salmon fall from extremely high! We should create a pond to catch them so they don’t get injured when they land. Add a new `||player:on item used||` to your code, and set the item to Kelp.

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
mobs.spawn(SALMON, randpos(
pos(-3, 30, -3),
pos(3, 30, 3)
))
}
})
player.onItemInteracted(KELP, function () {

})``````

## Rescue pond

Put a `||blocks:fill||` into the `||player:on item used||` that’s set for Kelp. The falling fish need to land in water, so set the fill block type to Water.

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
mobs.spawn(SALMON, randpos(
pos(-3, 30, -3),
pos(3, 30, 3)
))
}
})
player.onItemInteracted(KELP, function () {
blocks.fill(
WATER,
pos(0, 0, 0),
pos(0, 0, 0),
FillOperation.Replace
)
})``````

## Expand the pond

Finally, we must change the size of our pond so the fish can land right into it. In the `||blocks:fill||`, set the from position to ~-4 ~-1 ~-4 and the to position to ~4 ~-1 ~4. This creates a 9 x 9 shallow pool of water around the player.

``````player.onItemInteracted(TRIDENT, function () {
for (let i = 0; i < 6; i++) {
mobs.spawn(SALMON, randpos(
pos(-3, 30, -3),
pos(3, 30, 3)
))
}
})
player.onItemInteracted(KELP, function () {
blocks.fill(
WATER,
pos(-4, -1, -4),
pos(4, -1, 4),
FillOperation.Replace
)
})``````

## Play the game!

You’re all done! Go in-game and add a Trident and some Kelp to your equipment. Use the Kelp to create a pond, then use your Trident to fill it with fish! If you’re feeling brave, try using the Trident before the Kelp and see if you’re fast enough to save the Salmon.