Faucet Mod SDK 1.0.0
Modding API for Minecraft Legacy Console Edition
Loading...
Searching...
No Matches
ServerLevel Class Reference

The server-side representation of a loaded dimension/world. More...

#include <SDK.h>

Public Member Functions

shared_ptr< class Explosion > explode (shared_ptr< Entity > source, double x, double y, double z, float radius, bool fire, bool destroyBlocks)
 Spawn an explosion in the world.
shared_ptr< Entity > getEntity (int id)
 Get an entity by its integer ID.
virtual bool addEntity (shared_ptr< Entity > entity)
 Add an entity to this level.
void addToTickNextTick (int x, int y, int z, int tileId, int tickDelay)
 Force a tile tick at a position on the next tick.
void queueSendTileUpdate (int x, int y, int z)
 Broadcast a tile update to all nearby players.
vector< shared_ptr< class TileEntity > > * getTileEntitiesInRegion (int x0, int y0, int z0, int x1, int y1, int z1)
 Get all tile entities in a rectangular region.
void save (bool force, class ProgressListener *listener, bool bAutosave=false)
 Save the level to disk.
void sendParticles (const wstring &name, double x, double y, double z, int count)
 Send a named particle effect to all players near a position.
void sendParticles (const wstring &name, double x, double y, double z, int count, double xDist, double yDist, double zDist, double speed)
 Send a named particle effect with velocity spread.
bool mayInteract (shared_ptr< Player > player, int x, int y, int z, int content)
 Check if a block position is under spawn protection.
MinecraftServergetServer ()
 Get the server that owns this level.
EntityTracker * getTracker ()
 Get the EntityTracker for this level.
void setTimeAndAdjustTileTicks (__int64 newTime)
 Set the world time (adjusting scheduled ticks).

Public Attributes

bool noSave
 True if the level's save-on-exit flag is set to not save.
bool canEditSpawn
 True if admins can edit the spawn area.

Detailed Description

The server-side representation of a loaded dimension/world.

Obtain via SDK::GetServerLevel(dimension) or MinecraftServer::getLevel(dimension).

Definition at line 970 of file SDK.h.

Member Function Documentation

◆ addEntity()

virtual bool ServerLevel::addEntity ( shared_ptr< Entity > entity)
virtual

Add an entity to this level.

Parameters
entityEntity to add.
Returns
true if successfully added.

◆ addToTickNextTick()

void ServerLevel::addToTickNextTick ( int x,
int y,
int z,
int tileId,
int tickDelay )

Force a tile tick at a position on the next tick.

Parameters
x,y,zBlock coordinates.
tileIdID of the tile to tick.
tickDelayDelay in ticks.

◆ explode()

shared_ptr< class Explosion > ServerLevel::explode ( shared_ptr< Entity > source,
double x,
double y,
double z,
float radius,
bool fire,
bool destroyBlocks )

Spawn an explosion in the world.

Parameters
sourceEntity that caused the explosion, or nullptr.
x,y,zCentre of the explosion.
radiusExplosion radius in blocks.
fireTrue to start fires.
destroyBlocksTrue to destroy blocks.
Returns
Explosion object.
Example
level->explode(nullptr, 0, 64, 0, 4.0f, false, true);

◆ getEntity()

shared_ptr< Entity > ServerLevel::getEntity ( int id)

Get an entity by its integer ID.

Parameters
idEntity ID.
Returns
Entity shared_ptr or nullptr.

◆ getTileEntitiesInRegion()

vector< shared_ptr< class TileEntity > > * ServerLevel::getTileEntitiesInRegion ( int x0,
int y0,
int z0,
int x1,
int y1,
int z1 )

Get all tile entities in a rectangular region.

Parameters
x0,y0,z0Min corner.
x1,y1,z1Max corner.
Returns
Vector of tile entities in the region.

◆ mayInteract()

bool ServerLevel::mayInteract ( shared_ptr< Player > player,
int x,
int y,
int z,
int content )

Check if a block position is under spawn protection.

Parameters
levelLevel the position is in.
x,y,zBlock coordinates.
playerPlayer trying to modify the block.
Returns
true if protected.

◆ queueSendTileUpdate()

void ServerLevel::queueSendTileUpdate ( int x,
int y,
int z )

Broadcast a tile update to all nearby players.

Parameters
x,y,zBlock coordinates to update.

◆ save()

void ServerLevel::save ( bool force,
class ProgressListener * listener,
bool bAutosave = false )

Save the level to disk.

Parameters
forceForce save even if nothing is dirty.
listenerProgress listener, or nullptr.
bAutosaveTrue if this is an auto-save.

◆ sendParticles() [1/2]

void ServerLevel::sendParticles ( const wstring & name,
double x,
double y,
double z,
int count )

Send a named particle effect to all players near a position.

Parameters
nameParticle name (e.g. L"explode", L"flame", L"smoke").
x,y,zOrigin position.
countNumber of particles.

◆ sendParticles() [2/2]

void ServerLevel::sendParticles ( const wstring & name,
double x,
double y,
double z,
int count,
double xDist,
double yDist,
double zDist,
double speed )

Send a named particle effect with velocity spread.

Parameters
nameParticle name.
x,y,zOrigin position.
countNumber of particles.
xDist,yDist,zDistSpread distance per axis.
speedParticle speed.

The documentation for this class was generated from the following file: