程序包 org.bukkit

# 接口 Chunk

所有超级接口:
  `PersistentDataHolder`

public interface Chunk extends PersistentDataHolder
代表一个16*256*16的空间. If the chunk is not yet fully generated and data is requested from the chunk, then the chunk will only be generated as far as it needs to provide the requested data.

- ## 嵌套类概要

  嵌套类
  修饰符和类型
  接口
  说明
  `static enum`
  `Chunk.LoadLevel`
  An enum to specify the load level of a chunk.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `boolean`
  `addPluginChunkTicket(@NotNull Plugin plugin)`
  Adds a plugin ticket for this chunk, loading this chunk if it is not already loaded.
  `boolean`
  `contains(@NotNull Biome biome)`
  Tests if this chunk contains the specified biome.
  `boolean`
  `contains(@NotNull BlockData block)`
  Tests if this chunk contains the specified block.
  `@NotNull Block`
  `getBlock(int x, int y, int z)`
  从区块中获取某个方块(`Block`).
  `@NotNull ChunkSnapshot`
  `getChunkSnapshot()`
  Capture thread-safe read-only snapshot of chunk data
  `@NotNull ChunkSnapshot`
  `getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain)`
  Capture thread-safe read-only snapshot of chunk data
  `@NotNull Entity[]`
  `getEntities()`
  获取该区块内的所有实体.
  `long`
  `getInhabitedTime()`
  Gets the amount of time in ticks that this chunk has been inhabited.
  `@NotNull Chunk.LoadLevel`
  `getLoadLevel()`
  Gets the load level of this chunk, which determines what game logic is processed.
  `@NotNull Collection<Player>`
  `getPlayersSeeingChunk()`
  Get a list of all players who are can view the chunk from their client
  `@NotNull Collection<Plugin>`
  `getPluginChunkTickets()`
  Retrieves a collection specifying which plugins have tickets for this chunk.
  `@NotNull Collection<GeneratedStructure>`
  `getStructures()`
  Gets all generated structures that intersect this chunk.
  `@NotNull Collection<GeneratedStructure>`
  `getStructures(@NotNull Structure structure)`
  Gets all generated structures of a given `Structure` that intersect this chunk.
  `@NotNull BlockState[]`
  `getTileEntities()`
  获取该区块内所有的TileEntity的列表.
  `@NotNull World`
  `getWorld()`
  获取该区块属于哪个世界.
  `int`
  `getX()`
  获取该区块的X轴坐标.
  `int`
  `getZ()`
  获取该区块的Z轴坐标.
  `boolean`
  `isEntitiesLoaded()`
  Checks if entities in this chunk are loaded.
  `boolean`
  `isForceLoaded()`
  Gets whether the chunk at the specified chunk coordinates is force loaded.
  `boolean`
  `isGenerated()`
  Checks if the chunk is fully generated.
  `boolean`
  `isLoaded()`
  返回该区块是否被加载.
  `boolean`
  `isSlimeChunk()`
  Checks if this chunk can spawn slimes without being a swamp biome.
  `boolean`
  `load()`
  加载区块.
  `boolean`
  `load(boolean generate)`
  加载区块.
  `boolean`
  `removePluginChunkTicket(@NotNull Plugin plugin)`
  Removes the specified plugin's ticket for this chunk
  `void`
  `setForceLoaded(boolean forced)`
  Sets whether the chunk at the specified chunk coordinates is force loaded.
  `void`
  `setInhabitedTime(long ticks)`
  Sets the amount of time in ticks that this chunk has been inhabited.
  `boolean`
  `unload()`
  卸载并可选是否保存区块.
  `boolean`
  `unload(boolean save)`
  卸载该区块.可以选择是否保存.

  ### 从接口继承的方法 org.bukkit.persistence.PersistentDataHolder

  `getPersistentDataContainer`

- ## 方法详细资料

  - ### getX

    int getX()
    获取该区块的X轴坐标.

    原文:Gets the X-coordinate of this chunk

    返回:
      区块X轴坐标

  - ### getZ

    int getZ()
    获取该区块的Z轴坐标.

    Gets the Z-coordinate of this chunk

    返回:
      区块的Z轴坐标

  - ### getWorld

    @NotNull @NotNull World getWorld()
    获取该区块属于哪个世界.

    原文:Gets the world containing this chunk

    返回:
      世界名

  - ### getBlock

    @NotNull @NotNull Block getBlock(int x, int y, int z)
    从区块中获取某个方块(`Block`).

    原文:Gets a block from this chunk

    参数:
      `x` - 获取方块的X轴坐标,在0-15之间
      `y` - 获取方块的Y轴坐标,在 [世界最低高度, 世界最高高度) 之间
      `z` - 获取方块的Z轴坐标,在0-15之间
    返回:
      方块对象

  - ### getChunkSnapshot

    @NotNull @NotNull ChunkSnapshot getChunkSnapshot()
    Capture thread-safe read-only snapshot of chunk data
    返回:
      ChunkSnapshot

  - ### getChunkSnapshot

    @NotNull @NotNull ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain)
    Capture thread-safe read-only snapshot of chunk data
    参数:
      `includeMaxblocky` - - if true, snapshot includes per-coordinate maximum Y values
      `includeBiome` - - if true, snapshot includes per-coordinate biome type
      `includeBiomeTempRain` - - if true, snapshot includes per-coordinate raw biome temperature and rainfall
    返回:
      ChunkSnapshot

  - ### isEntitiesLoaded

    boolean isEntitiesLoaded()
    Checks if entities in this chunk are loaded.
    返回:
      True if entities are loaded.

  - ### getEntities

    @NotNull @NotNull Entity[] getEntities()
    获取该区块内的所有实体. 这将强制加载尚未加载的任意实体.

    原文:Get a list of all entities in the chunk. This will force load any entities, which are not loaded.

    返回:
      所有实体

  - ### getTileEntities

    @NotNull @NotNull BlockState[] getTileEntities()
    获取该区块内所有的TileEntity的列表.

    原文:Get a list of all tile entities in the chunk.

    返回:
      实体列表数组

  - ### isGenerated

    boolean isGenerated()
    Checks if the chunk is fully generated.
    返回:
      True if it is fully generated.

  - ### isLoaded

    boolean isLoaded()
    返回该区块是否被加载.

    原文:Checks if the chunk is loaded.

    返回:
      成功加载返回true,否则返回false

  - ### load

    boolean load(boolean generate)
    加载区块.

    原文:Loads the chunk.

    参数:
      `generate` - 如果该区块不存在是否自动生成
    返回:
      成功加载返回true,反之返回false

  - ### load

    boolean load()
    加载区块.
    返回:
      成功加载返回true,反之返回false

  - ### unload

    boolean unload(boolean save)
    卸载该区块.可以选择是否保存.

    原文:Unloads and optionally saves the Chunk

    参数:
      `save` - 卸载时是否保存.
    返回:
      成功卸载返回true,反之返回false

  - ### unload

    boolean unload()
    卸载并可选是否保存区块.

    原文:Unloads and optionally saves the Chunk

    返回:
      成功卸载返回true,反之返回false

  - ### isSlimeChunk

    boolean isSlimeChunk()
    Checks if this chunk can spawn slimes without being a swamp biome.
    返回:
      true if slimes are able to spawn in this chunk

  - ### isForceLoaded

    boolean isForceLoaded()
    Gets whether the chunk at the specified chunk coordinates is force loaded.

    A force loaded chunk will not be unloaded due to lack of player activity.

    返回:
      force load status
    另请参阅:
      - `World.isChunkForceLoaded(int, int)`

  - ### setForceLoaded

    void setForceLoaded(boolean forced)
    Sets whether the chunk at the specified chunk coordinates is force loaded.

    A force loaded chunk will not be unloaded due to lack of player activity.

    参数:
      `forced` - force load status
    另请参阅:
      - `World.setChunkForceLoaded(int, int, boolean)`

  - ### addPluginChunkTicket

    boolean addPluginChunkTicket(@NotNull @NotNull Plugin plugin)
    Adds a plugin ticket for this chunk, loading this chunk if it is not already loaded.

    A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

    参数:
      `plugin` - Plugin which owns the ticket
    返回:
      `true` if a plugin ticket was added, `false` if the ticket already exists for the plugin
    抛出:
      `IllegalStateException` - If the specified plugin is not enabled
    另请参阅:
      - `World.addPluginChunkTicket(int, int, Plugin)`

  - ### removePluginChunkTicket

    boolean removePluginChunkTicket(@NotNull @NotNull Plugin plugin)
    Removes the specified plugin's ticket for this chunk

    A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

    参数:
      `plugin` - Plugin which owns the ticket
    返回:
      `true` if the plugin ticket was removed, `false` if there is no plugin ticket for the chunk
    另请参阅:
      - `World.removePluginChunkTicket(int, int, Plugin)`

  - ### getPluginChunkTickets

    @NotNull @NotNull Collection<Plugin> getPluginChunkTickets()
    Retrieves a collection specifying which plugins have tickets for this chunk. This collection is not updated when plugin tickets are added or removed to this chunk.

    A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

    返回:
      unmodifiable collection containing which plugins have tickets for this chunk
    另请参阅:
      - `World.getPluginChunkTickets(int, int)`

  - ### getInhabitedTime

    long getInhabitedTime()
    Gets the amount of time in ticks that this chunk has been inhabited. Note that the time is incremented once per tick per player within mob spawning distance of this chunk.
    返回:
      inhabited time

  - ### setInhabitedTime

    void setInhabitedTime(long ticks)
    Sets the amount of time in ticks that this chunk has been inhabited.
    参数:
      `ticks` - new inhabited time

  - ### contains

    boolean contains(@NotNull @NotNull BlockData block)
    Tests if this chunk contains the specified block.
    参数:
      `block` - block to test
    返回:
      if the block is contained within

  - ### contains

    boolean contains(@NotNull @NotNull Biome biome)
    Tests if this chunk contains the specified biome.
    参数:
      `biome` - biome to test
    返回:
      if the biome is contained within

  - ### getLoadLevel

    @NotNull @NotNull Chunk.LoadLevel getLoadLevel()
    Gets the load level of this chunk, which determines what game logic is processed.
    返回:
      the load level

  - ### getStructures

    @NotNull @NotNull Collection<GeneratedStructure> getStructures()
    Gets all generated structures that intersect this chunk.
    If no structures are present an empty collection will be returned.
    返回:
      a collection of placed structures in this chunk

  - ### getStructures

    @NotNull @NotNull Collection<GeneratedStructure> getStructures(@NotNull @NotNull Structure structure)
    Gets all generated structures of a given `Structure` that intersect this chunk.
    If no structures are present an empty collection will be returned.
    参数:
      `structure` - the structure to find
    返回:
      a collection of placed structures in this chunk

  - ### getPlayersSeeingChunk

    @NotNull @NotNull Collection<Player> getPlayersSeeingChunk()
    Get a list of all players who are can view the chunk from their client

    This list will be empty if no players are viewing the chunk, or the chunk is unloaded.

    返回:
      collection of players who can see the chunk