程序包 org.bukkit.block

接口 CreatureSpawner

所有超级接口:
BlockState, Metadatable, PersistentDataHolder, TileState

public interface CreatureSpawner extends TileState
代表刷怪笼.
  • 方法详细资料

    • getSpawnedType

      EntityType getSpawnedType()
      获取刷出的生物的类型.

      原文: Get the spawner's creature type.

      返回:
      生物类型
    • setSpawnedType

      void setSpawnedType(EntityType creatureType)
      设置刷出的生物的类型.

      原文: Set the spawner's creature type.

      参数:
      creatureType - 生物类型
    • setCreatureTypeByName

      @Deprecated void setCreatureTypeByName(String creatureType)
      已过时。
      不安全的参数,请使用 setSpawnedType(org.bukkit.entity.EntityType).
      设置刷怪笼要生成的生物名.

      原文: Set the spawner mob type.

      参数:
      creatureType - 要刷出的生物的名称.
    • getCreatureTypeName

      @Deprecated String getCreatureTypeName()
      已过时。
      不安全的参数,请使用getSpawnedType().
      获取要刷出的生物的名称.

      原文: Get the spawner's creature type.

      返回:
      要刷出的生物的名称.
    • getDelay

      int getDelay()
      获取刷怪笼的刷怪延迟.
      延迟时间以tick为单位.

      原文: Get the spawner's delay.
      This is the delay, in ticks, until the spawner will spawn its next mob.

      返回:
      延迟.
    • setDelay

      void setDelay(int delay)
      设置刷怪笼刷怪延迟.
      如果设为-1,则刷怪延迟将被重置为一个随机的值(范围在getMinSpawnDelay()getMaxSpawnDelay()之间).

      原文: Set the spawner's delay.
      If set to -1, the spawn delay will be reset to a random value between getMinSpawnDelay() and getMaxSpawnDelay().

      参数:
      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 getDelay(). Default value is 200 ticks.

      返回:
      最小刷怪延迟
    • setMinSpawnDelay

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

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

      参数:
      delay - 最小刷怪延迟
      另请参阅:
    • 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 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 - 最大刷怪延迟
      另请参阅:
    • 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 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 - 附近相似实体的最大数量
    • getRequiredPlayerRange

      int getRequiredPlayerRange()
      获取玩家使刷怪笼激活所需的最远距离.
      如果该值小于或等于0, 则此刷怪笼永远处于激活状态.
      默认值为 16.
      译注:原文中的 "distance(squared)" 意为在比较距离时会使用此距离的平方与 两点(玩家与刷怪笼)间坐标差的平方和作比较, 毕竟乘法运算比开方运算快很多.

      原文:Get the maximum distance(squared) a player can be in order for this spawner to be active.
      If this value is less than or equal to 0, this spawner is always active (given that there are players online).
      Default value is 16.

      返回:
      激活刷怪笼所需最远距离
    • setRequiredPlayerRange

      void setRequiredPlayerRange(int requiredPlayerRange)
      设置玩家使刷怪笼激活所需的最远距离.
      如果设置小于或等于0的值, 将使刷怪笼永远处于激活状态.

      原文:Set the maximum distance (squared) a player can be in order for this spawner to be active.
      Setting this value to less than or equal to 0 will make this spawner always active (given that there are players online).

      参数:
      requiredPlayerRange - 激活刷怪笼所需最远距离
    • getSpawnRange

      int getSpawnRange()
      获取刷怪笼刷怪区域的半径.
      这个区域形为正方形, 以刷怪笼所在地为中心, 向 x,z 轴方向延伸(不含刷怪笼本身).
      这个区域以刷怪笼的y轴(它的底部)为中心算起, 高2个方块, 这允许生物有足够空间在这个区域的顶部和底部平面下一格方块的区域内生成.
      默认值为 4.

      原文:Get the radius around which the spawner will attempt to spawn mobs in.
      This area is square, includes the block the spawner is in, and is centered on the spawner's x,z coordinates - not the spawner itself.
      It is 2 blocks high, centered on the spawner's y-coordinate (its bottom); thus allowing mobs to spawn as high as its top surface and as low as 1 block below its bottom surface.
      Default value is 4.

      返回:
      刷怪半径
    • setSpawnRange

      void setSpawnRange(int spawnRange)
      设置新的刷怪半径.

      原文:Set the new spawn range.

      参数:
      spawnRange - 半径
      另请参阅: