程序包 org.bukkit.spawner

# 接口 Spawner

所有超级接口:
  `BaseSpawner`

所有已知子接口:
  `CreatureSpawner`, `SpawnerMinecart`

public interface Spawner extends BaseSpawner
Represents an entity spawner.
May be a `SpawnerMinecart` or a `CreatureSpawner`.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `int`
  `getMaxNearbyEntities()`
  获取刷怪范围内允许出现的相似实体的最大数量.
  `int`
  `getMaxSpawnDelay()`
  获取刷怪笼最大刷怪延迟.
  `int`
  `getMinSpawnDelay()`
  获取刷怪笼最小刷怪延迟.
  `int`
  `getSpawnCount()`
  获取刷怪笼每次刷怪的数量.
  `void`
  `setDelay(int delay)`
  设置刷怪笼刷怪延迟.
  `void`
  `setMaxNearbyEntities(int maxNearbyEntities)`
  设置刷怪范围内允许出现的相似实体的最大数量.
  `void`
  `setMaxSpawnDelay(int delay)`
  设置刷怪笼最大刷怪延迟.
  `void`
  `setMinSpawnDelay(int delay)`
  设置刷怪笼最小刷怪延迟.
  `void`
  `setSpawnCount(int spawnCount)`
  设置刷怪笼每次刷怪的数量.

  ### 从接口继承的方法 org.bukkit.spawner.BaseSpawner

  `addPotentialSpawn, addPotentialSpawn, getDelay, getPotentialSpawns, getRequiredPlayerRange, getSpawnedEntity, getSpawnedType, getSpawnRange, setPotentialSpawns, setRequiredPlayerRange, setSpawnedEntity, setSpawnedEntity, setSpawnedType, setSpawnRange`

- ## 方法详细资料

  - ### setDelay

    void setDelay(int delay)
    设置刷怪笼刷怪延迟.

    原文:Set the spawner's delay.
    如果设为-1，则刷怪延迟将被重置为一个随机的值(范围在`getMinSpawnDelay()`和`getMaxSpawnDelay()`之间).

    指定者:
      `setDelay` 在接口中 `BaseSpawner`
    参数:
      `delay` - 延迟.

  - ### getMinSpawnDelay

    int getMinSpawnDelay()
    获取刷怪笼最小刷怪延迟.
    当刷怪延迟被重置时使用该值. 系统会在范围 [`getMinSpawnDelay()`, `getMaxSpawnDelay()`) 内随机选一个值用于下一个`刷怪延迟`.
    默认值为 200 ticks.

    原文:The minimum spawn delay amount (in ticks).
    This value is used when the spawner resets its delay (for any reason). It will choose a random number between `getMinSpawnDelay()` and `getMaxSpawnDelay()` for its next `BaseSpawner.getDelay()`.
    Default value is 200 ticks.

    返回:
      最小刷怪延迟

  - ### setMinSpawnDelay

    void setMinSpawnDelay(int delay)
    设置刷怪笼最小刷怪延迟.

    原文:Set the minimum spawn delay amount (in ticks).

    参数:
      `delay` - 最小刷怪延迟
    另请参阅:
      - `getMinSpawnDelay()`

  - ### getMaxSpawnDelay

    int getMaxSpawnDelay()
    获取刷怪笼最大刷怪延迟.
    当刷怪延迟被重置时使用该值. 系统会在范围 [`getMinSpawnDelay()`, `getMaxSpawnDelay()`) 内随机选一个值用于下一个`刷怪延迟`.
    该值必须大于0且小于或等于 `getMaxSpawnDelay()`.
    默认值为 800 ticks.

    原文:The maximum spawn delay amount (in ticks).
    This value is used when the spawner resets its delay (for any reason). It will choose a random number between `getMinSpawnDelay()` and `getMaxSpawnDelay()` for its next `BaseSpawner.getDelay()`.
    This value must be greater than 0 and less than or equal to `getMaxSpawnDelay()`.
    Default value is 800 ticks.

    返回:
      最大刷怪延迟

  - ### setMaxSpawnDelay

    void setMaxSpawnDelay(int delay)
    设置刷怪笼最大刷怪延迟.
    该值必须大于0且小于或等于 `getMaxSpawnDelay()`.

    原文:Set the maximum spawn delay amount (in ticks).
    This value must be greater than 0, as well as greater than or equal to `getMinSpawnDelay()`

    参数:
      `delay` - 最大刷怪延迟
    另请参阅:
      - `getMaxSpawnDelay()`

  - ### getSpawnCount

    int getSpawnCount()
    获取刷怪笼每次刷怪的数量.
    默认值为 4.

    原文:Get how many mobs attempt to spawn.
    Default value is 4.

    返回:
      刷怪数

  - ### setSpawnCount

    void setSpawnCount(int spawnCount)
    设置刷怪笼每次刷怪的数量.

    原文:Set how many mobs attempt to spawn.

    参数:
      `spawnCount` - 刷怪数

  - ### getMaxNearbyEntities

    int getMaxNearbyEntities()
    获取刷怪范围内允许出现的相似实体的最大数量.
    如果刷怪范围内存在超过数量上限的实体, 刷怪笼将不会刷怪并在随机的新延迟后再次尝试刷怪.
    默认值为 6 (译注:原文 "16" 的数据有误, wiki和代码中的数据均为 6).

    原文:Set the new maximum amount of similar entities that are allowed to be within spawning range of this spawner.
    If more than the maximum number of entities are within range, the spawner will not spawn and try again with a new `BaseSpawner.getDelay()`.
    Default value is 16.

    返回:
      附近相似实体的最大数量

  - ### setMaxNearbyEntities

    void setMaxNearbyEntities(int maxNearbyEntities)
    设置刷怪范围内允许出现的相似实体的最大数量.
    “相似实体”指的是同种`类型`的实体.

    原文:Set the maximum number of similar entities that are allowed to be within spawning range of this spawner.
    Similar entities are entities that are of the same `EntityType`

    参数:
      `maxNearbyEntities` - 附近相似实体的最大数量