Class endstone::Dimension¶
ClassList > endstone > Dimension
Represents a dimension within a Level .
#include <endstone/level/dimension.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| constexpr auto | Nether = [**DimensionId::minecraft**](classendstone_1_1Identifier.md#function-minecraft)("nether") |
| constexpr auto | Overworld = [**DimensionId::minecraft**](classendstone_1_1Identifier.md#function-minecraft)("overworld") |
| constexpr auto | TheEnd = [**DimensionId::minecraft**](classendstone_1_1Identifier.md#function-minecraft)("the\_end") |
Public Functions¶
| Type | Name |
|---|---|
| virtual bool | addPluginChunkTicket (int x, int z, Plugin & plugin) = 0 Adds a plugin ticket for the Chunk at the given coordinates, loading it if it is not already loaded. |
| virtual NotNull< Item > | dropItem (Location location, const ItemStack & item) = 0 Drops an item at the specified Location . |
| virtual std::vector< NotNull< Actor > > | getActors () const = 0 Get a list of all actors in this dimension. |
| virtual NotNull< Block > | getBlockAt (int x, int y, int z) const = 0 Gets the Block at the given coordinates. |
| virtual NotNull< Block > | getBlockAt (Location location) const = 0 Gets the Block at the givenLocation . |
| virtual NotNull< Block > | getHighestBlockAt (int x, int z) const = 0 Gets the highest non-empty (impassable) block at the given coordinates. |
| virtual NotNull< Block > | getHighestBlockAt (Location location) const = 0 Gets the highest non-empty (impassable) block at the given Location . |
| virtual int | getHighestBlockYAt (int x, int z) const = 0 Gets the highest non-empty (impassable) coordinate at the given coordinates. |
| virtual DimensionId | getId () const = 0 Return the identifier of this dimension. |
| virtual Level & | getLevel () const = 0 Gets the level to which this dimension belongs. |
| virtual std::vector< NotNull< Chunk > > | getLoadedChunks () = 0 Gets a list of all loaded Chunks. |
| virtual std::vector< NotNull< Mob > > | getMobs () const = 0 Get a list of all mobs in this dimension. |
| virtual std::vector< NotNull< Player > > | getPlayers () const = 0 Get a list of all players in this dimension. |
| virtual std::vector< Plugin * > | getPluginChunkTickets (int x, int z) const = 0 Gets which plugins hold a ticket for the Chunk at the given coordinates. |
| virtual std::unordered_map< Plugin *, std::vector< NotNull< Chunk > > > | getPluginChunkTickets () const = 0 Gets which plugins hold tickets for which Chunks in this dimension. |
| virtual std::string | getTranslationKey () const = 0 Get the translation key, suitable for use in a translation component. |
| virtual bool | isChunkGenerated (int x, int z) const = 0 Checks if the Chunk at the given coordinates has been generated. |
| virtual bool | isChunkLoaded (int x, int z) const = 0 Checks if the Chunk at the given coordinates is loaded. |
| virtual bool | isValid () const = 0 Checks whether this dimension is still valid (loaded). |
| virtual bool | loadChunk (int x, int z) = 0 Requests the Chunk at the given coordinates to be loaded, generating it if it does not exist yet. |
| virtual bool | loadChunk (int x, int z, bool generate) = 0 Requests the Chunk at the given coordinates to be loaded, and keeps it resident until it is released again. |
| virtual bool | removePluginChunkTicket (int x, int z, Plugin & plugin) = 0 Removes the given plugin's ticket for the Chunk at the given coordinates. |
| virtual void | removePluginChunkTickets (Plugin & plugin) = 0 Removes every ticket the given plugin holds in this dimension. |
| virtual Nullable< Actor > | spawnActor (Location location, ActorTypeId type) = 0 Creates an actor at the given Location . |
| virtual bool | unloadChunk (int x, int z) = 0 Releases the hold that loadChunk() placed on theChunk at the given coordinates, and unloads it if nothing else keeps it resident. |
| virtual bool | unloadChunkRequest (int x, int z) = 0 Releases the hold that loadChunk() placed on theChunk at the given coordinates, without unloading it now. |
| virtual | ~Dimension () = default |
Public Static Attributes Documentation¶
variable Nether¶
variable Overworld¶
variable TheEnd¶
Public Functions Documentation¶
function addPluginChunkTicket¶
Adds a plugin ticket for the Chunk at the given coordinates, loading it if it is not already loaded.
A plugin ticket keeps the chunk resident until it is explicitly removed or the owning plugin is disabled. A plugin may only have one ticket per chunk, but each chunk can have multiple plugin tickets. unloadChunk() does not remove plugin tickets.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunkpluginPlugin taking the ticket
Returns:
true if a plugin ticket was added, false if the plugin already holds one for this chunk
function dropItem¶
Drops an item at the specified Location .
virtual NotNull < Item > endstone::Dimension::dropItem (
Location location,
const ItemStack & item
) = 0
Parameters:
Returns:
Item entity created as a result of this method
function getActors¶
Get a list of all actors in this dimension.
Returns:
A List of all actors currently residing in this dimension
function getBlockAt [½]¶
Gets the Block at the given coordinates.
Parameters:
xX-coordinate of the blockyY-coordinate of the blockzZ-coordinate of the block
Returns:
Block at the given coordinates
function getBlockAt [2/2]¶
Gets the Block at the givenLocation .
Parameters:
locationLocation of the block
Returns:
Block at the given coordinates
function getHighestBlockAt [½]¶
Gets the highest non-empty (impassable) block at the given coordinates.
Parameters:
xX-coordinate of the blockzZ-coordinate of the block
Returns:
Highest non-empty block
function getHighestBlockAt [2/2]¶
Gets the highest non-empty (impassable) block at the given Location .
Parameters:
locationCoordinates to get the highest block
Returns:
Highest non-empty block
function getHighestBlockYAt¶
Gets the highest non-empty (impassable) coordinate at the given coordinates.
Parameters:
xX-coordinate of the blockszZ-coordinate of the blocks
Returns:
Y-coordinate of the highest non-empty block
function getId¶
Return the identifier of this dimension.
Returns:
this dimension's identifier
function getLevel¶
Gets the level to which this dimension belongs.
Returns:
Level containing this dimension.
function getLoadedChunks¶
Gets a list of all loaded Chunks.
Returns:
All loaded chunks
function getMobs¶
Get a list of all mobs in this dimension.
Returns:
A List of all mobs currently residing in this dimension
function getPlayers¶
Get a list of all players in this dimension.
Returns:
A List of all players currently residing in this dimension
function getPluginChunkTickets [½]¶
Gets which plugins hold a ticket for the Chunk at the given coordinates.
virtual std::vector< Plugin * > endstone::Dimension::getPluginChunkTickets (
int x,
int z
) const = 0
The returned list is a snapshot; it does not track tickets added or removed afterwards.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
Plugins holding a ticket for the chunk
function getPluginChunkTickets [2/2]¶
Gets which plugins hold tickets for which Chunks in this dimension.
virtual std::unordered_map< Plugin *, std::vector< NotNull < Chunk > > > endstone::Dimension::getPluginChunkTickets () const = 0
The returned map is a snapshot; it does not track tickets added or removed afterwards. A plugin holding no tickets is absent from it.
Returns:
Chunks each plugin holds a ticket for
function getTranslationKey¶
Get the translation key, suitable for use in a translation component.
Returns:
the translation key
function isChunkGenerated¶
Checks if the Chunk at the given coordinates has been generated.
A chunk counts as generated once it is loaded or has been written to the level's chunk storage.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
true if the chunk has been generated, otherwise false
function isChunkLoaded¶
Checks if the Chunk at the given coordinates is loaded.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
true if the chunk is loaded, otherwise false
function isValid¶
Checks whether this dimension is still valid (loaded).
A Dimension handle can outlive the underlying dimension if it is unloaded; this returns false once that happens, after which accessing the dimension throws.
Returns:
true if the dimension is still loaded, false otherwise
function loadChunk [½]¶
Requests the Chunk at the given coordinates to be loaded, generating it if it does not exist yet.
Equivalent to loadChunk(x, z, true).
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
true if the chunk is now held resident, otherwise false
function loadChunk [2/2]¶
Requests the Chunk at the given coordinates to be loaded, and keeps it resident until it is released again.
The chunk is held from the moment this returns until unloadChunk() or unloadChunkRequest() releases it, or the server restarts. Bedrock has no synchronous chunk load, so unless the chunk was already resident the load finishes on a later tick and isChunkLoaded() may still report false right afterwards. A chunk held this way stays in memory but is not ticked, and the hold never expires on its own. Intended for keeping a handful of chunks resident; it is not suited to loading large regions.
The hold is not attributed to any plugin and survives that plugin being disabled. Use addPluginChunkTicket() for a hold that is released automatically.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunkgenerateWhether to generate the chunk if it does not exist yet
Returns:
false if generate is false and the chunk has not been generated, or if the coordinates lie outside the world limit, otherwise true
function removePluginChunkTicket¶
Removes the given plugin's ticket for the Chunk at the given coordinates.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunkpluginPlugin whose ticket to remove
Returns:
true if a plugin ticket was removed, false if the plugin holds none for this chunk
function removePluginChunkTickets¶
Removes every ticket the given plugin holds in this dimension.
Parameters:
pluginPlugin whose tickets to remove
function spawnActor¶
Creates an actor at the given Location .
virtual Nullable < Actor > endstone::Dimension::spawnActor (
Location location,
ActorTypeId type
) = 0
Parameters:
locationThe location to spawn the actortypeThe actor type to spawn
Returns:
Resulting Actor of this method
function unloadChunk¶
Releases the hold that loadChunk() placed on theChunk at the given coordinates, and unloads it if nothing else keeps it resident.
A chunk kept alive by a nearby player, the spawn area, a /tickingarea or a plugin chunk ticket stays loaded, and this reports false. Unloading a chunk saves it and fires a ChunkUnloadEvent, which handlers observe before this returns.
Note:
This also completes any chunk unloads the dimension had pending, so calling it once per chunk over a large area is expensive. Use unloadChunkRequest() when releasing many chunks at once.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
true if the chunk is no longer loaded, otherwise false
function unloadChunkRequest¶
Releases the hold that loadChunk() placed on theChunk at the given coordinates, without unloading it now.
The chunk is unloaded on a later tick once nothing else keeps it resident.
Parameters:
xX-coordinate of the chunkzZ-coordinate of the chunk
Returns:
true
function ~Dimension¶
The documentation for this class was generated from the following file include/endstone/level/dimension.h