Class endstone::Chunk¶
Represents a chunk of blocks.
#include <endstone/level/chunk.h>
Public Functions¶
| Type | Name |
|---|---|
| virtual bool | addPluginChunkTicket (Plugin & plugin) = 0 Adds a plugin ticket for this chunk, loading it if it is not already loaded. |
| virtual std::vector< NotNull< BlockState > > | getBlockActors () const = 0 Gets a list of all block actors in this chunk. |
| virtual NotNull< Dimension > | getDimension () const = 0 Gets the dimension containing this chunk. |
| virtual Level & | getLevel () const = 0 Gets the level containing this chunk. |
| virtual std::vector< Plugin * > | getPluginChunkTickets () const = 0 Gets which plugins hold a ticket for this chunk. |
| virtual int | getX () const = 0 Gets the X-coordinate of this chunk. |
| virtual int | getZ () const = 0 Gets the Z-coordinate of this chunk. |
| virtual bool | isLoaded () const = 0 Checks if this chunk is loaded. |
| virtual bool | load () = 0 Requests this chunk to be loaded, generating it if it does not exist yet. |
| virtual bool | load (bool generate) = 0 Requests this chunk to be loaded, and keeps it resident until it is released again. |
| virtual bool | removePluginChunkTicket (Plugin & plugin) = 0 Removes the given plugin's ticket for this chunk. |
| virtual bool | unload () = 0 Releases the hold that load() placed on this chunk, and unloads it if nothing else keeps it resident. |
| virtual | ~Chunk () = default |
Public Functions Documentation¶
function addPluginChunkTicket¶
Adds a plugin ticket for this chunk, loading it if it is not already loaded.
Parameters:
pluginPlugin taking the ticket
Returns:
true if a plugin ticket was added, false if the plugin already holds one for this chunk
function getBlockActors¶
Gets a list of all block actors in this chunk.
The returned list is a snapshot; it does not track block actors placed or broken afterwards.
Returns:
the state of every block actor in this chunk, or an empty list if this chunk is not loaded
function getDimension¶
Gets the dimension containing this chunk.
Returns:
Parent Dimension
function getLevel¶
Gets the level containing this chunk.
Returns:
Parent Level
function getPluginChunkTickets¶
Gets which plugins hold a ticket for this chunk.
The returned list is a snapshot; it does not track tickets added or removed afterwards.
Returns:
Plugins holding a ticket for this chunk
function getX¶
Gets the X-coordinate of this chunk.
Returns:
X-coordinate
function getZ¶
Gets the Z-coordinate of this chunk.
Returns:
Z-coordinate
function isLoaded¶
Checks if this chunk is loaded.
Returns:
true if the chunk is loaded, otherwise false
function load [½]¶
Requests this chunk to be loaded, generating it if it does not exist yet.
Equivalent to load(true).
Returns:
true if the chunk is now held resident, otherwise false
function load [2/2]¶
Requests this chunk to be loaded, and keeps it resident until it is released again.
See also: Dimension::loadChunk() for how the hold behaves.
Parameters:
generateWhether to generate the chunk if it does not exist yet
Returns:
false if generate is false and the chunk has not been generated, otherwise true
function removePluginChunkTicket¶
Removes the given plugin's ticket for this chunk.
Parameters:
pluginPlugin whose ticket to remove
Returns:
true if a plugin ticket was removed, false if the plugin holds none for this chunk
function unload¶
Releases the hold that load() placed on this chunk, and unloads it if nothing else keeps it resident.
Returns:
true if the chunk is no longer loaded, otherwise false
function ~Chunk¶
The documentation for this class was generated from the following file include/endstone/level/chunk.h