程序包 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.
  • 方法详细资料

    • 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
      另请参阅:
    • 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
      另请参阅:
    • 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
      另请参阅:
    • 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
      另请参阅:
    • 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
      另请参阅:
    • 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

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