near
Selects targets near a position.
mobs.near(
mobs.target(LOCAL_PLAYER),
world(0, 0, 0),
5
);
Parameters
- target: the type of mobs to select:
local player
: select the current player (you)nearest player
: select the player nearest to the world originrandom player
: select a random player in the worldall players
: select all players in the worldall entities
: select all players and mobsmy agent
: select the agent
- pos: the position near where you want to select targets
- radius: how far away (in blocks) you want to go to select targets, like:
5
blocks
Example
Teleport all chickens within 15 blocks of the player high in the sky.
mobs.teleportToPosition(
mobs.near(
mobs.entitiesByType(CHICKEN),
player.position(),
15
),
pos(0, 30, 0)
);
See Also
||mobs:target||
, ||positions:positions||
Read more about target selectors in the Minecraft wiki.