outside Radius

Sets the closest (minimum) distance from this selector’s base coordinates. This is a useful way change the minimum distance of an existing target selector.

Only mobs that are farther than the distance chosen from this selector’s coordinates are selected.

mobs.target(ALL_ENTITIES).outsideRadius(0);

Parameters

  • radius: the minimum distance (in blocks) for this target selector, like: 10

Example

This code shows how to select all chickens between 10 and 20 blocks away from the player.

First: The code creates a target selector that selects all chickens within 20 blocks of the current player’s world position. The target selector is stored in a variable called item.

Then: The selector’s minimum radius is changed to 10.

Finally: The selector is used in a teleport command. Because we changed the selector’s minimum radius, chickens within 10 blocks of the player are not teleported.

let item: TargetSelector = null;
item = mobs.near(
    mobs.entitiesByType(CHICKEN),
    player.position(),
    20
);
item.outsideRadius(10);
mobs.teleportToPosition(
    item,
    pos(0, 10, 0)
);

See also

||mobs:within radius||

You can read about how target selectors work in the Minecraft wiki.