randpos

Pick a random position inside a cube shaped space.

randpos(
    pos(0, 0, 0),
    pos(0, 0, 0)
)

A random position is chosen somewhere in between to positions that you give. You set the corners of the space (volume) where the random position is chosen. The corners determine where, and how big, the cube shaped space is.

Parameters

  • p1: the position of the first corner of the cube.
  • p2: the position of the opposite corner of the cube.

Example

Spawn chickens at random positions above the player’s head.

for (let i = 0; i < 10; i++) {
    mobs.spawn(CHICKEN, randpos(
        pos(-3, 5, -3),
        pos(3, 10, 3)
    ))
}

||positions:pos||, ||positions:world||