程序包 org.bukkit

接口 Chunk

所有超级接口:
PersistentDataHolder

public interface Chunk extends PersistentDataHolder
代表一个16*256*16的空间.

如果区块尚未完全生成,但又被请求了数据,那么区块只会生成到足以提供所请求数据的程度。

  • 方法详细资料

    • 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

      返回:
      区块快照
    • getChunkSnapshot

      @NotNull @NotNull ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain)
      获取区块数据的线程安全只读快照.

      原文:Capture thread-safe read-only snapshot of chunk data

      参数:
      includeMaxblocky - 如果为true,快照将包含每个坐标的最大Y轴高度值
      includeBiome - 如果为true,快照将包含每个坐标的生物群系类型
      includeBiomeTempRain - 如果为true,快照将包含每个坐标的原始生物群系温度和降雨量
      返回:
      区块快照
    • isEntitiesLoaded

      boolean isEntitiesLoaded()
      检查此区块中的实体是否已加载.

      原文:Checks if entities in this chunk are loaded.

      返回:
      如果实体已加载则返回true
    • 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
    • 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
    • isForceLoaded

      boolean isForceLoaded()
      获取指定坐标处的区块是否被强制加载.

      强制加载的区块不会因为缺少玩家活动而被卸载.

      原文:Gets whether the chunk at the specified chunk coordinates is force loaded.

      返回:
      强制加载状态
      另请参阅:
    • setForceLoaded

      void setForceLoaded(boolean forced)
      设置指定坐标处的区块是否被强制加载.

      强制加载的区块不会因为缺少玩家活动而被卸载.

      原文:Sets whether the chunk at the specified chunk coordinates is force loaded.

      参数:
      forced - 强制加载状态
      另请参阅:
    • addPluginChunkTicket

      boolean addPluginChunkTicket(@NotNull @NotNull Plugin plugin)
      为此区块添加一个插件票据,如果区块尚未加载则会加载该区块.

      插件票据会阻止区块被卸载,直到被显式移除。每个插件实例在每个区块上只能有一个票据,但每个区块可以有多个插件票据.

      原文:Adds a plugin ticket for this chunk, loading this chunk if it is not already loaded.

      参数:
      plugin - 拥有该票据的插件
      返回:
      如果添加了插件票据则返回true,如果该插件的票据已存在则返回false
      抛出:
      IllegalStateException - 如果指定的插件未启用
      另请参阅:
    • removePluginChunkTicket

      boolean removePluginChunkTicket(@NotNull @NotNull Plugin plugin)
      移除指定插件在此区块上的票据.

      插件票据会阻止区块被卸载,直到被显式移除。每个插件实例在每个区块上只能有一个票据,但每个区块可以有多个插件票据.

      原文:Removes the specified plugin's ticket for this chunk

      参数:
      plugin - 拥有该票据的插件
      返回:
      如果移除了插件票据则返回true,如果该区块没有该插件的票据则返回false
      另请参阅:
    • getPluginChunkTickets

      @NotNull @NotNull Collection<Plugin> getPluginChunkTickets()
      获取指定哪些插件在此区块拥有票据的集合。当插件票据被添加或移除时,此集合不会更新.

      插件票据会阻止区块被卸载,直到被显式移除。每个插件实例在每个区块上只能有一个票据,但每个区块可以有多个插件票据.

      原文:Retrieves a collection specifying which plugins have tickets for this chunk.

      返回:
      包含在此区块拥有票据的插件的不可修改集合
      另请参阅:
    • getInhabitedTime

      long getInhabitedTime()
      获取此区块已被居住的时间(以tick为单位).

      注意:对于在怪物生成距离内的每个玩家,每个tick时间会增加一次.

      原文:Gets the amount of time in ticks that this chunk has been inhabited.

      返回:
      已被居住的时间
    • setInhabitedTime

      void setInhabitedTime(long ticks)
      设置此区块已被居住的时间(以tick为单位).

      原文:Sets the amount of time in ticks that this chunk has been inhabited.

      参数:
      ticks - 新的居住时间
    • contains

      boolean contains(@NotNull @NotNull BlockData block)
      测试此区块是否包含指定的方块.

      原文:Tests if this chunk contains the specified block.

      参数:
      block - 要测试的方块
      返回:
      如果区块包含该方块则返回true
    • contains

      boolean contains(@NotNull @NotNull Biome biome)
      测试此区块是否包含指定的生物群系.

      原文:Tests if this chunk contains the specified biome.

      参数:
      biome - 要测试的生物群系
      返回:
      如果区块包含该生物群系则返回true
    • getLoadLevel

      获取此区块的加载级别,该级别决定了会处理哪些游戏逻辑.

      原文:Gets the load level of this chunk, which determines what game logic is processed.

      返回:
      加载级别
    • getStructures

      获取与此区块相交的所有已生成结构.

      如果没有结构存在,将返回空集合.

      原文:Gets all generated structures that intersect this chunk.

      返回:
      此区块中已放置结构的集合
    • getStructures

      获取与此区块相交的所有给定 Structure 类型的已生成结构.

      如果没有结构存在,将返回空集合.

      原文:Gets all generated structures of a given Structure that intersect this chunk.

      参数:
      structure - 要查找的结构类型
      返回:
      此区块中已放置结构的集合
    • getPlayersSeeingChunk

      @NotNull @NotNull Collection<Player> getPlayersSeeingChunk()
      获取所有能从客户端查看此区块的玩家列表.

      如果没有玩家正在查看此区块,或区块已卸载,则此列表为空.

      原文:Get a list of all players who are can view the chunk from their client

      返回:
      能看到此区块的玩家集合