on Travelled

Runs code when the current player travels in a certain way.

player.onTravelled(TravelMethod.Walk, () => {
    
});

Parameters

  • method: the travel method. The methods you can use are:

    walk, swim water, fall, climb, swim lava, fly, riding, sneak, sprint, bounce

  • handler: code to run when the player travels

Example

Leave a trail of flowers behind when the player walks around:

player.onTravelled(TravelMethod.Walk, () => {
    blocks.place(YELLOW_FLOWER, pos(0, 0, 0));
});