Skip to content

Class endstone::Chunk

ClassList > 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.

virtual bool endstone::Chunk::addPluginChunkTicket (
    Plugin & plugin
) = 0

Parameters:

  • plugin Plugin 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.

virtual std::vector< NotNull < BlockState > > endstone::Chunk::getBlockActors () const = 0

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.

virtual NotNull < Dimension > endstone::Chunk::getDimension () const = 0

Returns:

Parent Dimension


function getLevel

Gets the level containing this chunk.

virtual Level & endstone::Chunk::getLevel () const = 0

Returns:

Parent Level


function getPluginChunkTickets

Gets which plugins hold a ticket for this chunk.

virtual std::vector< Plugin * > endstone::Chunk::getPluginChunkTickets () const = 0

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.

virtual int endstone::Chunk::getX () const = 0

Returns:

X-coordinate


function getZ

Gets the Z-coordinate of this chunk.

virtual int endstone::Chunk::getZ () const = 0

Returns:

Z-coordinate


function isLoaded

Checks if this chunk is loaded.

virtual bool endstone::Chunk::isLoaded () const = 0

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.

virtual bool endstone::Chunk::load () = 0

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.

virtual bool endstone::Chunk::load (
    bool generate
) = 0

See also: Dimension::loadChunk() for how the hold behaves.

Parameters:

  • generate Whether 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.

virtual bool endstone::Chunk::removePluginChunkTicket (
    Plugin & plugin
) = 0

Parameters:

  • plugin Plugin 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.

virtual bool endstone::Chunk::unload () = 0

Returns:

true if the chunk is no longer loaded, otherwise false


function ~Chunk

virtual endstone::Chunk::~Chunk () = default


The documentation for this class was generated from the following file include/endstone/level/chunk.h