public interface Chunk
Modifier and Type | Method | Description |
---|---|---|
boolean |
addPluginChunkTicket(@NotNull Plugin plugin) |
Adds a plugin ticket for this chunk, loading this chunk if it is not
already loaded.
|
boolean |
contains(@NotNull BlockData block) |
Tests if this chunk contains the specified block.
|
@NotNull Block |
getBlock(int x,
int y,
int z) |
Gets a block from this chunk
|
default long |
getChunkKey() |
|
static long |
getChunkKey(int x,
int z) |
|
static long |
getChunkKey(@NotNull Location loc) |
|
@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() |
Get a list of all entities in the chunk.
|
long |
getInhabitedTime() |
Gets the amount of time in ticks that this chunk has been inhabited.
|
@NotNull Collection<Plugin> |
getPluginChunkTickets() |
Retrieves a collection specifying which plugins have tickets for this
chunk.
|
default @NotNull BlockState[] |
getTileEntities() |
Get a list of all tile entities in the chunk.
|
@NotNull BlockState[] |
getTileEntities(boolean useSnapshot) |
Get a list of all tile entities in the chunk.
|
@NotNull World |
getWorld() |
Gets the world containing this chunk
|
int |
getX() |
Gets the X-coordinate of this chunk
|
int |
getZ() |
Gets the Z-coordinate of this chunk
|
boolean |
isForceLoaded() |
Gets whether the chunk at the specified chunk coordinates is force
loaded.
|
boolean |
isLoaded() |
Checks if the chunk is loaded.
|
boolean |
isSlimeChunk() |
Checks if this chunk can spawn slimes without being a swamp biome.
|
boolean |
load() |
Loads the chunk.
|
boolean |
load(boolean generate) |
Loads the chunk.
|
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() |
Unloads and optionally saves the Chunk
|
boolean |
unload(boolean save) |
Unloads and optionally saves the Chunk
|
int getX()
int getZ()
default long getChunkKey()
static long getChunkKey(@NotNull @NotNull Location loc)
loc
- Location to get chunk keystatic long getChunkKey(int x, int z)
x
- X Coordinatez
- Z Coordinate@NotNull @NotNull World getWorld()
@NotNull @NotNull Block getBlock(int x, int y, int z)
x
- 0-15y
- 0-255z
- 0-15@NotNull @NotNull ChunkSnapshot getChunkSnapshot()
@NotNull @NotNull ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain)
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@NotNull @NotNull Entity[] getEntities()
@NotNull default @NotNull BlockState[] getTileEntities()
@NotNull @NotNull BlockState[] getTileEntities(boolean useSnapshot)
useSnapshot
- Take snapshots or direct referencesboolean isLoaded()
boolean load(boolean generate)
generate
- Whether or not to generate a chunk if it doesn't
already existboolean load()
boolean unload(boolean save)
save
- Controls whether the chunk is savedboolean unload()
boolean isSlimeChunk()
boolean isForceLoaded()
A force loaded chunk will not be unloaded due to lack of player activity.
World.isChunkForceLoaded(int, int)
void setForceLoaded(boolean forced)
A force loaded chunk will not be unloaded due to lack of player activity.
forced
- force load statusWorld.setChunkForceLoaded(int, int, boolean)
boolean addPluginChunkTicket(@NotNull @NotNull Plugin plugin)
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 tickettrue
if a plugin ticket was added, false
if the
ticket already exists for the pluginIllegalStateException
- If the specified plugin is not enabledWorld.addPluginChunkTicket(int, int, Plugin)
boolean removePluginChunkTicket(@NotNull @NotNull Plugin plugin)
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 tickettrue
if the plugin ticket was removed, false
if
there is no plugin ticket for the chunkWorld.removePluginChunkTicket(int, int, Plugin)
@NotNull @NotNull Collection<Plugin> getPluginChunkTickets()
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.
World.getPluginChunkTickets(int, int)
long getInhabitedTime()
void setInhabitedTime(long ticks)
ticks
- new inhabited timeboolean contains(@NotNull @NotNull BlockData block)
block
- block to testCopyright © 2020. All rights reserved.