Skip to content

Class endstone::Level

ClassList > endstone > Level

Represents a level, which may contain actors, chunks and blocks.

  • #include <endstone/level/level.h>

Public Functions

Type Name
virtual GameRuleValue _getGameRule (Identifier< GameRule > rule) const = 0
Gets the value of a game rule.
virtual bool _hasGameRule (Identifier< GameRule > rule) const = 0
Checks if a game rule exists.
virtual bool _setGameRule (Identifier< GameRule > rule, GameRuleValue value) = 0
Sets the value of a game rule.
virtual Nullable< Dimension > createDimension (const DimensionCreator & creator) = 0
Creates a new custom dimension within this level.
virtual std::vector< NotNull< Actor > > getActors () const = 0
Get a list of all actors in this level.
virtual Nullable< Dimension > getDimension (DimensionId id) const = 0
Gets the dimension with the given id.
virtual std::vector< NotNull< Dimension > > getDimensions () const = 0
Gets a list of all dimensions within this level.
T getGameRule (GameRuleId< T > rule) const
Gets the value of a game rule.
virtual std::string getName () const = 0
Gets the unique name of this level.
virtual std::vector< NotNull< Recipe > > getRecipes () const = 0
Get the list of crafting recipes.
virtual std::int64_t getSeed () const = 0
Gets the Seed for this level.
virtual int getTime () const = 0
Gets the relative in-game time of this level.
bool hasGameRule (GameRuleId< T > rule) const
Checks if a game rule exists.
bool setGameRule (GameRuleId< T > rule, T value)
Sets the value of a game rule.
virtual void setTime (int time) = 0
Sets the relative in-game time on the server.
virtual ~Level () = default

Public Functions Documentation

function _getGameRule

Gets the value of a game rule.

virtual GameRuleValue endstone::Level::_getGameRule (
    Identifier < GameRule > rule
) const = 0

Parameters:

  • rule The Minecraft game rule to get

Returns:

The current game rule value


function _hasGameRule

Checks if a game rule exists.

virtual bool endstone::Level::_hasGameRule (
    Identifier < GameRule > rule
) const = 0

Parameters:

  • rule The Minecraft game rule to check

Returns:

True if the game rule exists


function _setGameRule

Sets the value of a game rule.

virtual bool endstone::Level::_setGameRule (
    Identifier < GameRule > rule,
    GameRuleValue value
) = 0

Parameters:

  • rule The Minecraft game rule to set
  • value The new value

Returns:

True if the value was accepted


function createDimension

Creates a new custom dimension within this level.

virtual Nullable < Dimension > endstone::Level::createDimension (
    const  DimensionCreator & creator
) = 0

The dimension is created from the options described by the given DimensionCreator. Custom dimensions are empty (void) dimensions identified by a namespaced id, e.g. myplugin:void_realm; populate them with blocks, structures or actors afterward.

The level remembers which id belongs to which name, so a dimension's terrain and actors survive a restart. The registration itself does not: call this again on every startup to get the same dimension back.

If a dimension with the requested name already exists, that existing dimension is returned instead.

Parameters:

  • creator the options to use when creating the dimension

Returns:

the newly created (or existing) Dimension, or null if it could not be created


function getActors

Get a list of all actors in this level.

virtual std::vector< NotNull < Actor > > endstone::Level::getActors () const = 0

Returns:

A List of all actors currently residing in this level


function getDimension

Gets the dimension with the given id.

virtual Nullable < Dimension > endstone::Level::getDimension (
    DimensionId id
) const = 0

Parameters:

  • id the id of the dimension to retrieve.

Returns:

The Dimension with the given id, or null if none exists


function getDimensions

Gets a list of all dimensions within this level.

virtual std::vector< NotNull < Dimension > > endstone::Level::getDimensions () const = 0

Returns:

a list of dimensions


function getGameRule

Gets the value of a game rule.

template<typename  T>
inline T endstone::Level::getGameRule (
    GameRuleId < T > rule
) const

Template parameters:

  • T The type of the game rule's value.

Parameters:

  • rule The Minecraft game rule to get

Returns:

The current game rule value


function getName

Gets the unique name of this level.

virtual std::string endstone::Level::getName () const = 0

Returns:

Name of this level


function getRecipes

Get the list of crafting recipes.

virtual std::vector< NotNull < Recipe > > endstone::Level::getRecipes () const = 0

Returns:

a list of recipes


function getSeed

Gets the Seed for this level.

virtual std::int64_t endstone::Level::getSeed () const = 0

Returns:

This level's Seed


function getTime

Gets the relative in-game time of this level.

virtual int endstone::Level::getTime () const = 0

Returns:

The current relative time


function hasGameRule

Checks if a game rule exists.

template<typename  T>
inline bool endstone::Level::hasGameRule (
    GameRuleId < T > rule
) const

Template parameters:

  • T The type of the game rule's value.

Parameters:

  • rule The Minecraft game rule to check

Returns:

True if the game rule exists


function setGameRule

Sets the value of a game rule.

template<typename  T>
inline bool endstone::Level::setGameRule (
    GameRuleId < T > rule,
    T value
) 

Template parameters:

  • T The type of the game rule's value.

Parameters:

  • rule The Minecraft game rule to set
  • value The new value

Returns:

True if the value was accepted


function setTime

Sets the relative in-game time on the server.

virtual void endstone::Level::setTime (
    int time
) = 0

Parameters:

  • time The new relative time to set the in-game time to

function ~Level

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


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