接口 Chunk
- 所有超级接口:
PersistentDataHolder
-
嵌套类概要
-
方法概要
修饰符和类型方法说明boolean
addPluginChunkTicket
(@NotNull Plugin plugin) Adds a plugin ticket for this chunk, loading this chunk if it is not already loaded.boolean
Tests if this chunk contains the specified biome.boolean
Tests if this chunk contains the specified block.getBlock
(int x, int y, int z) 从区块中获取某个方块(Block
).Capture thread-safe read-only snapshot of chunk datagetChunkSnapshot
(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) Capture thread-safe read-only snapshot of chunk data获取该区块内的所有实体.long
Gets the amount of time in ticks that this chunk has been inhabited.Gets the load level of this chunk, which determines what game logic is processed.Get a list of all players who are can view the chunk from their clientRetrieves a collection specifying which plugins have tickets for this chunk.Gets all generated structures that intersect this chunk.getStructures
(@NotNull Structure structure) Gets all generated structures of a givenStructure
that intersect this chunk.获取该区块内所有的TileEntity的列表.getWorld()
获取该区块属于哪个世界.int
getX()
获取该区块的X轴坐标.int
getZ()
获取该区块的Z轴坐标.boolean
Checks if entities in this chunk are loaded.boolean
Gets whether the chunk at the specified chunk coordinates is force loaded.boolean
Checks if the chunk is fully generated.boolean
isLoaded()
返回该区块是否被加载.boolean
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 chunkvoid
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
获取该区块属于哪个世界.原文:Gets the world containing this chunk
- 返回:
- 世界名
-
getBlock
从区块中获取某个方块(Block
).原文:Gets a block from this chunk
- 参数:
x
- 获取方块的X轴坐标,在0-15之间y
- 获取方块的Y轴坐标,在 [世界最低高度, 世界最高高度) 之间z
- 获取方块的Z轴坐标,在0-15之间- 返回:
- 方块对象
-
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 valuesincludeBiome
- - if true, snapshot includes per-coordinate biome typeincludeBiomeTempRain
- - 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
获取该区块内的所有实体. 这将强制加载尚未加载的任意实体.原文:Get a list of all entities in the chunk. This will force load any entities, which are not loaded.
- 返回:
- 所有实体
-
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
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
Removes the specified plugin's ticket for this chunkA 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
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
Tests if this chunk contains the specified block.- 参数:
block
- block to test- 返回:
- if the block is contained within
-
contains
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
-
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 givenStructure
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
Get a list of all players who are can view the chunk from their clientThis list will be empty if no players are viewing the chunk, or the chunk is unloaded.
- 返回:
- collection of players who can see the chunk
-