Skip to content

Algorithm API command

XiaoColorful edited this page Mar 22, 2026 · 2 revisions

English

算法API指令

IAlgorithmApi

/battleroyale api algorithm [...]

均匀分布算法

IDistribution

/battleroyale api algorithm [distributionType] [...]

distributionType:分布类型

  • 矩形网格:rectangleGrid
  • 黄金螺旋:goldenSpiral
  • 双圆心网格:circleGrid

生成均匀分布点位

/battleroyale api algorithm [distributionType] [pos] [xyz] [count] [allowOnBorder] [globalShrinkRatio]

/battleroyale api algorithm [distributionType] [xyz] [count] [allowOnBorder] [globalShrinkRatio]

生成均匀分布点位,保存至相应分布类型的缓存:

  • pos:分布的中心位置,如无则取指令 /execute at 位置
  • xyz:分布的XYZ分量
  • count:模拟的点位数量
  • allowOnBorder:是否允许点位在边界上
  • globalShrinkRatio:全局缩放比例

打乱点位

/battleroyale api algorithm [distributionType] shuffle

打乱缓存的点位列表:

限量点位

/battleroyale api algorithm [distributionType] [minPoint] [maxPoint]

缓存的点位取第 minPointmaxPoint 个:

随机偏移点位

/battleroyale api algorithm [distributionType] [xyz] [rangeType]

缓存的点位逐个进行随机偏移:

  • 缓存的点位数量为空,返回值为 -1
  • xyz:随机偏移的输入向量
  • rangeType:随机偏移类型
    • randomAdjustXYZ:以输入向量为基准,往XYZ正反方向随机偏移
    • randomAdjustXZExpandY:以输入向量为基准,往XZ正反方向,Y正方向随机偏移
    • scaleXYZ:以输入向量为基准,缩放XYZ方向
    • randomCircleXZExpandY:以输入向量为基准,取X分量为半径,在XZ平面的圆内随机取点,Y正方向随机偏移
    • randomSphereXYZ:以输入向量为基准,取Y分量为半径,在XYZ球内随机偏移
  • 返回值缓存的点位数量

计划传送

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] [...]

  • findGround:是否传送至该点的地面,模组会在前 maxHangTime tick不断尝试寻找地面,超时则从该点1145.14高度处下落
  • maxHaneTime:当传送位置区块未加载或为虚空(无法通过射线检测)时,让玩家停留在空中的时间

注:原版 /spreadplayers 会立即加载区块(阻塞线程),而该命令是异步逐个加载点位所在区块;若某点位对应虚空,则该位置将始终无法找到地面

计划传送游戏玩家

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] gamePlayer [type]

在游戏维度创建计划传送:

  • type:游戏玩家列表
    • gamePlayers:所有游戏玩家
    • standingGamePlayers:未被淘汰的游戏玩家
  • 若不包含游戏玩家或缓存的点位为空,返回值为 0
  • 返回值:是否成功创建计划传送
计划传送生物

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] player [all]

在指令 /execute in 维度创建计划传送:

  • all:实体选择器
  • 若实体选择器为空或缓存的点位为空,返回值为 0
  • 若实体选择器过滤非生物实体后为空,则创建计划失败,影响返回值
  • 返回值:是否成功创建计划传送

English

Algorithm API command

IAlgorithmApi

/battleroyale api algorithm [...]

Uniform distribution algorithm

IDistribution

/battleroyale api algorithm [distributionType] [...]

distributionType: Distribution type

  • Rectangle grid: rectangleGrid
  • Golden spiral: goldenSpiral
  • Double center grid: circleGrid

Generate uniform distribution algorithm

/battleroyale api algorithm [distributionType] [pos] [xyz] [count] [allowOnBorder] [globalShrinkRatio]

/battleroyale api algorithm [distributionType] [xyz] [count] [allowOnBorder] [globalShrinkRatio]

Generates uniformly distributed points and saves them to the cache of the corresponding distribution type:

  • pos: center position of the distribution, the /execute at position is used if not specified
  • xyz: XYZ components of the distribution
  • count: number of simulated points
  • allowOnBorder: Whether to allow spawn points to be exactly on the boundary.
  • globalShrinkRatio: global scaling ratio applied to the distribution area

Shuffle points

/battleroyale api algorithm [distributionType] shuffle

Shuffles the list of cached points:

Bound points

/battleroyale api algorithm [distributionType] [minPoint] [maxPoint]

Selects the $minPoint^{th}$ to $maxPoint^{th}$ points from the cached points:

Random offset points

/battleroyale api algorithm [distributionType] [xyz] [rangeType]

Randomly offsets each cached points:

  • If the cached points count is empty, the return value is -1.
  • xyz: input vector for random offset
  • rangeType: Random offset type
    • randomAdjustXYZ: Randomly offset in both positive and negative XYZ directions based on the input vector.
    • randomAdjustXZExpandY: Randomly offset in positive/negative XZ and positive Y directions based on the input vector.
    • scaleXYZ: Scale XYZ directions based on the input vector.
    • randomCircleXZExpandY: Randomly offset within a circle on the XZ plane with X component as the radius, and randomly offset in the positive Y direction based on the input vector.
    • randomSphereXYZ: Randomly offset within a sphere with Y component as the radius based on the input vector.
  • return value: number of cached points

Schedule teleport

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] [...]

  • findGround: Whether to teleport to the ground at the teleport point. The mod will try to find the ground continuously in the first maxHangTime tick of the game. If it times out, it will fall from the height of 1145.14 at the point
  • maxHaneTime: How long to keep the player airborne when the teleport target chunk is not loaded or the area is considered void (cannot pass ray tracing).

Note: The vanilla /spreadplayers command loads chunks immediately (blocking the thread), whereas this command loads chunks asynchronously for each point. If a point corresponds to the void, the ground will never be found at that location.

Schedule teleport game players

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] gamePlayer [type]

Creates a scheduled teleport in the game dimension:

  • type: Game player list
    • gamePlayers: all game players
    • standingGamePlayers: non-eliminated game players
  • If there are no game players or the cached points are empty, the return value is 0.
  • return value: Whether the scheduled teleport was successfully created.
Schedule teleport living entities

/battleroyale api algorithm [distributionType] teleport [findGround] [maxHangTime] player [all]

Creates a scheduled teleport in the /execute in dimension:

  • all: entity selector
  • If the entity selector is empty or the cached points are empty, the return value is 0.
  • If the entity selector is empty after filtering out non-living entities, the creation fails, affecting the return value.
  • return value: Whether the scheduled teleport was successfully created.

🌐 Language / 语言


Clone this wiki locally