程序包 org.bukkit.generator

# 类 BlockPopulator

java.lang.Object
org.bukkit.generator.BlockPopulator

public abstract class BlockPopulator extends Object
用于生成一定小区域的方块的方块填充器。

例如，在地狱中或生成的填满宝藏的地牢中生成萤石。

A BlockPopulator can be used in combination with a custom `ChunkGenerator` by returning it in the method `ChunkGenerator.getDefaultPopulators(World)` or by adding it manually to the worlds populator list returned by `World.getPopulators()`.

When adding a BlockPopulator manually to a world it is recommended to do so during the `WorldInitEvent`.

- ## 构造器概要

  构造器
  构造器
  说明
  `BlockPopulator()`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `void`
  `populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull LimitedRegion limitedRegion)`
  Populates an area of blocks at or around the given chunk.
  `void`
  `populate(@NotNull World world, @NotNull Random random, @NotNull Chunk source)`
  已过时。
  建议使用 `populate(WorldInfo, Random, int, int, LimitedRegion)`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### BlockPopulator

    public BlockPopulator()

- ## 方法详细资料

  - ### populate

    @Deprecated public void populate(@NotNull @NotNull World world, @NotNull @NotNull Random random, @NotNull @NotNull Chunk source)
    已过时。
    建议使用 `populate(WorldInfo, Random, int, int, LimitedRegion)`
    在指定的区块附近或内部填充一定区域的方块。

    在指定区块四周的区块必须已经存在；就是说，指定方块的东南西北都必须有一个区块存在， 角落区块可以不存在。当准备好时填充器会记录那些区块所有的修改请求并执行修改。

    译注：存在的意思可能是加载。

    原文： Populates an area of blocks at or around the given chunk.

    The chunks on each side of the specified chunk must already exist; that is, there must be one north, east, south and west of the specified chunk. The "corner" chunks may not exist, in which scenario the populator should record any changes required for those chunks and perform the changes when they are ready.

    参数:
      `world` - 用于生成的世界
      `random` - 使用的随机生成器
      `source` - 用于生成的区块

  - ### populate

    public void populate(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull LimitedRegion limitedRegion)
    Populates an area of blocks at or around the given chunk.

    Notes:

    This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop

    This method should never modify a `LimitedRegion` at a later point of time.

    This method must be completely thread safe and able to handle multiple concurrent callers.

    No physics are applied, whether or not it is set to true in `BlockState.update(boolean, boolean)`

    Only use the `BlockState` returned by `LimitedRegion`, never use methods from a `World` to modify the chunk.

    参数:
      `worldInfo` - The world info of the world to generate in
      `random` - The random generator to use
      `chunkX` - The X-coordinate of the chunk
      `chunkZ` - The Z-coordinate of the chunk
      `limitedRegion` - The chunk region to populate