Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cWorld Class Referencefinal

#include <World.h>

Inheritance diagram for cWorld:
Inheritance graph
[legend]
Collaboration diagram for cWorld:
Collaboration graph
[legend]

Classes

struct  BlockTickQueueItem
 
class  cChunkGeneratorCallbacks
 Implementation of the callbacks that the ChunkGenerator uses to store new chunks and interface to plugins. More...
 
class  cLock
 A simple RAII locker for the chunkmap - locks the chunkmap in its constructor, unlocks it in the destructor. More...
 
class  cTickThread
 

Public Member Functions

bool AddChunkClient (int a_ChunkX, int a_ChunkZ, cClientHandle *a_Client)
 Adds client to a chunk, if not already present; returns true if added, false if present. More...
 
void AddEntity (OwnedEntity a_Entity)
 Adds the entity into its appropriate chunk; takes ownership of the entity ptr. More...
 
void AddPlayer (std::unique_ptr< cPlayer > a_Player, cWorld *a_OldWorld=nullptr)
 Adds the player to the world. More...
 
bool AreCommandBlocksEnabled (void) const
 
virtual void BroadcastAttachEntity (const cEntity &a_Entity, const cEntity &a_Vehicle) override
 
virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastBlockBreakAnimation (UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle *a_Exclude=nullptr) override
 If there is a block entity at the specified coods, sends it to all clients except a_Exclude. More...
 
virtual void BroadcastChat (const AString &a_Message, const cClientHandle *a_Exclude=nullptr, eMessageType a_ChatPrefix=mtCustom) override
 
virtual void BroadcastChat (const cCompositeChat &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatDeath (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatFailure (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatFatal (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatInfo (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatSuccess (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastChatWarning (const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastCollectEntity (const cEntity &a_Pickup, const cPlayer &a_Player, int a_Count, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastDestroyEntity (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastDetachEntity (const cEntity &a_Entity, const cEntity &a_PreviousVehicle) override
 
virtual void BroadcastDisplayObjective (const AString &a_Objective, cScoreboard::eDisplaySlot a_Display) override
 
virtual void BroadcastEntityAnimation (const cEntity &a_Entity, Int8 a_Animation, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityEffect (const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityEquipment (const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityHeadLook (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityLook (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityMetadata (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityRelMove (const cEntity &a_Entity, Vector3< Int8 > a_RelMove, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityRelMoveLook (const cEntity &a_Entity, Vector3< Int8 > a_RelMove, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityStatus (const cEntity &a_Entity, Int8 a_Status, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastEntityVelocity (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastLeashEntity (const cEntity &a_Entity, const cEntity &a_EntityLeashedTo) override
 
virtual void BroadcastParticleEffect (const AString &a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastParticleEffect (const AString &a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array< int, 2 > a_Data, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastPlayerListAddPlayer (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastPlayerListRemovePlayer (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastPlayerListUpdateDisplayName (const cPlayer &a_Player, const AString &a_CustomName, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastPlayerListUpdatePing (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastRemoveEntityEffect (const cEntity &a_Entity, int a_EffectID, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastScoreboardObjective (const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
 
virtual void BroadcastScoreUpdate (const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode) override
 
virtual void BroadcastSoundEffect (const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastSpawnEntity (cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastTeleportEntity (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastThunderbolt (Vector3i a_BlockPos, const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastTimeUpdate (const cClientHandle *a_Exclude=nullptr) override
 
virtual void BroadcastUnleashEntity (const cEntity &a_Entity) override
 
virtual void BroadcastUseBed (const cEntity &a_Entity, Vector3i a_BlockPos) override
 
virtual void BroadcastWeather (eWeather a_Weather, const cClientHandle *a_Exclude=nullptr) override
 
void CastThunderbolt (Vector3i a_Block)
 Casts a thunderbolt at the specified coords. More...
 
void CastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ)
 
void ChangeWeather (void)
 Forces a weather change in the next game tick. More...
 
void ChunkLighted (int a_ChunkX, int a_ChunkZ, const cChunkDef::BlockNibbles &a_BlockLight, const cChunkDef::BlockNibbles &a_SkyLight)
 
void ChunkLoadFailed (int a_ChunkX, int a_ChunkZ)
 Marks the chunk as failed-to-load: More...
 
void CollectPickupsByPlayer (cPlayer &a_Player)
 
void CompareChunkClients (int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback &a_Callback)
 Compares clients of two chunks, calls the callback accordingly. More...
 
UInt32 CreateProjectile (Vector3d a_Pos, cProjectileEntity::eKind a_Kind, cEntity *a_Creator, const cItem *a_Item, const Vector3d *a_Speed=nullptr)
 Creates a projectile of the specified type. More...
 
UInt32 CreateProjectile (double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity *a_Creator, const cItem *a_Item, const Vector3d *a_Speed=nullptr)
 OBSOLETE, use the Vector3d-based overload instead. More...
 
bool DigBlock (Vector3i a_BlockPos)
 Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()). More...
 
bool DigBlock (int a_X, int a_Y, int a_Z)
 OBSOLETE, use the Vector3-based overload instead. More...
 
virtual void DoExplosionAt (double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void *a_SourceData) override
 Does an explosion with the specified strength at the specified coordinates. More...
 
bool DoWithBeaconAt (int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback a_Callback)
 Calls the callback for the beacon at the specified coords; returns false if there's no beacon at those coords, true if found. More...
 
virtual bool DoWithBedAt (int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback a_Callback) override
 Calls the callback for the bed at the specified coords; returns false if there's no bed at those coords, true if found. More...
 
virtual bool DoWithBlockEntityAt (int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback a_Callback) override
 Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found. More...
 
bool DoWithBrewingstandAt (int a_BlockX, int a_BlockY, int a_BlockZ, cBrewingstandCallback a_Callback)
 Calls the callback for the brewingstand at the specified coords; returns false if there's no brewingstand at those coords, true if found. More...
 
bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback a_Callback)
 Calls the callback for the chest at the specified coords; returns false if there's no chest at those coords, true if found. More...
 
bool DoWithChunk (int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback)
 Calls the callback for the chunk specified, with ChunkMapCS locked. More...
 
bool DoWithChunkAt (Vector3i a_BlockPos, cChunkCallback a_Callback)
 Calls the callback for the chunk at the block position specified, with ChunkMapCS locked. More...
 
bool DoWithCommandBlockAt (int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback a_Callback)
 Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found. More...
 
bool DoWithDispenserAt (int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback a_Callback)
 Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found. More...
 
bool DoWithDropperAt (int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback a_Callback)
 Calls the callback for the dropper at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found. More...
 
bool DoWithDropSpenserAt (int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback a_Callback)
 Calls the callback for the dropspenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found. More...
 
bool DoWithEntityByID (UInt32 a_UniqueID, cEntityCallback a_Callback)
 Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. More...
 
bool DoWithFlowerPotAt (int a_BlockX, int a_BlockY, int a_BlockZ, cFlowerPotCallback a_Callback)
 Calls the callback for the flower pot at the specified coords; returns false if there's no flower pot at those coords or callback returns true, returns true if found. More...
 
bool DoWithFurnaceAt (int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback a_Callback)
 Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found. More...
 
bool DoWithMobHeadAt (int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadCallback a_Callback)
 Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found. More...
 
bool DoWithNearestPlayer (Vector3d a_Pos, double a_RangeLimit, cPlayerListCallback a_Callback, bool a_CheckLineOfSight=true, bool a_IgnoreSpectator=true)
 Calls the callback for nearest player for given position, Returns false if player not found, otherwise returns the same value as the callback. More...
 
bool DoWithNoteBlockAt (int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback a_Callback)
 Calls the callback for the noteblock at the specified coords; returns false if there's no noteblock at those coords or callback returns true, returns true if found. More...
 
bool DoWithPlayer (const AString &a_PlayerName, cPlayerListCallback a_Callback)
 Calls the callback for the player of the given name; returns true if the player was found and the callback called, false if player not found. More...
 
bool DoWithPlayerByUUID (const cUUID &a_PlayerUUID, cPlayerListCallback a_Callback)
 Finds the player over his uuid and calls the callback. More...
 
bool DropBlockAsPickups (Vector3i a_BlockPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
 Digs the specified block, and spawns the appropriate pickups for it. More...
 
void FastSetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Sets the block at the specified coords to the specified value. More...
 
void FastSetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 OBSOLETE, use the Vector3-based overload instead. More...
 
bool FindAndDoWithPlayer (const AString &a_PlayerNameHint, cPlayerListCallback a_Callback)
 Finds a player from a partial or complete player name and calls the callback - case-insensitive. More...
 
void ForceSendChunkTo (int a_ChunkX, int a_ChunkZ, cChunkSender::eChunkPriority a_Priority, cClientHandle *a_Client)
 Sends the chunk to the client specified, even if the client already has the chunk. More...
 
bool ForEachBlockEntityInChunk (int a_ChunkX, int a_ChunkZ, cBlockEntityCallback a_Callback)
 Calls the callback for each block entity in the specified chunk; returns true if all block entities processed, false if the callback aborted by returning true. More...
 
bool ForEachBrewingstandInChunk (int a_ChunkX, int a_ChunkZ, cBrewingstandCallback a_Callback)
 Calls the callback for each brewingstand in the specified chunk; returns true if all brewingstands processed, false if the callback aborted by returning true. More...
 
bool ForEachChestInChunk (int a_ChunkX, int a_ChunkZ, cChestCallback a_Callback)
 Calls the callback for each chest in the specified chunk; returns true if all chests processed, false if the callback aborted by returning true. More...
 
virtual bool ForEachChunkInRect (int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback &a_Callback) override
 Calls the callback for each chunk in the coords specified (all cords are inclusive). More...
 
bool ForEachDispenserInChunk (int a_ChunkX, int a_ChunkZ, cDispenserCallback a_Callback)
 Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true. More...
 
bool ForEachDropperInChunk (int a_ChunkX, int a_ChunkZ, cDropperCallback a_Callback)
 Calls the callback for each dropper in the specified chunk; returns true if all droppers processed, false if the callback aborted by returning true. More...
 
bool ForEachDropSpenserInChunk (int a_ChunkX, int a_ChunkZ, cDropSpenserCallback a_Callback)
 Calls the callback for each dropspenser in the specified chunk; returns true if all dropspensers processed, false if the callback aborted by returning true. More...
 
bool ForEachEntity (cEntityCallback a_Callback)
 Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true. More...
 
virtual bool ForEachEntityInBox (const cBoundingBox &a_Box, cEntityCallback a_Callback) override
 Calls the callback for each entity that has a nonempty intersection with the specified boundingbox. More...
 
bool ForEachEntityInChunk (int a_ChunkX, int a_ChunkZ, cEntityCallback a_Callback)
 Calls the callback for each entity in the specified chunk; returns true if all entities processed, false if the callback aborted by returning true. More...
 
bool ForEachFurnaceInChunk (int a_ChunkX, int a_ChunkZ, cFurnaceCallback a_Callback)
 Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true. More...
 
bool ForEachLoadedChunk (cFunctionRef< bool(int, int)> a_Callback)
 Calls the callback for each loaded chunk. More...
 
virtual bool ForEachPlayer (cPlayerListCallback a_Callback) override
 Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true. More...
 
void GenerateChunk (int a_ChunkX, int a_ChunkZ)
 Generates the given chunk. More...
 
EMCSBiome GetBiomeAt (int a_BlockX, int a_BlockZ)
 Returns the biome at the specified coords. More...
 
BLOCKTYPE GetBlock (Vector3i a_BlockPos)
 Returns the block type at the specified position. More...
 
BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ)
 OBSOLETE, use the Vector3-based overload instead. More...
 
NIBBLETYPE GetBlockBlockLight (Vector3i a_BlockPos)
 Returns the block-light value at the specified block position. More...
 
NIBBLETYPE GetBlockBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ)
 OBSOLETE, use the Vector3-based overload instead. More...
 
bool GetBlockInfo (Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_Meta, NIBBLETYPE &a_SkyLight, NIBBLETYPE &a_BlockLight)
 Queries the whole block specification from the world. More...
 
bool GetBlockInfo (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_Meta, NIBBLETYPE &a_SkyLight, NIBBLETYPE &a_BlockLight)
 Queries the whole block specification from the world. More...
 
NIBBLETYPE GetBlockMeta (Vector3i a_BlockPos)
 Returns the block meta at the specified position. More...
 
NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ)
 OBSOLETE, use the Vector3-based overload instead. More...
 
bool GetBlocks (sSetBlockVector &a_Blocks, bool a_ContinueOnFailure)
 Retrieves block types of the specified blocks. More...
 
NIBBLETYPE GetBlockSkyLight (Vector3i a_BlockPos)
 Returns the sky light value at the specified block position. More...
 
NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ)
 OBSOLETE, use the Vector3-based overload instead. More...
 
bool GetBlockTypeMeta (Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
 Retrieves the block type and meta at the specified coords. More...
 
bool GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
 OBSOLETE, use the Vector3i-based overload instead. More...
 
virtual cBroadcastInterfaceGetBroadcastManager (void) override
 
bool GetChunkBlockTypes (int a_ChunkX, int a_ChunkZ, BLOCKTYPE *a_BlockTypes)
 Gets the chunk's blocks, only the block types. More...
 
bool GetChunkData (cChunkCoords a_Coords, cChunkDataCallback &a_Callback) const
 Calls the callback with the chunk's data, if available (with ChunkCS locked). More...
 
cChunkMapGetChunkMap (void)
 
void GetChunkStats (int &a_NumValid, int &a_NumDirty, int &a_NumInLightingQueue)
 Returns the number of chunks loaded and dirty, and in the lighting queue. More...
 
const AStringGetDataPath (void) const
 Returns the data path to the world data. More...
 
int GetDefaultWeatherInterval (eWeather a_Weather)
 Returns the default weather interval for the specific weather type. More...
 
virtual eDimension GetDimension (void) const override
 
eGameMode GetGameMode (void) const
 Returns the current game mode. More...
 
cChunkGeneratorThreadGetGenerator (void)
 
int GetGeneratorQueueLength (void)
 
virtual int GetHeight (int a_BlockX, int a_BlockZ) override
 Returns the world height at the specified coords; waits for the chunk to get loaded / generated. More...
 
const AStringGetIniFileName (void) const
 Returns the name of the world.ini file used by this world. More...
 
cFluidSimulatorGetLavaSimulator (void)
 
size_t GetLightingQueueLength (void)
 
cLightingThreadGetLightingThread (void)
 
AString GetLinkedEndWorldName (void) const
 
AString GetLinkedNetherWorldName (void) const
 
AString GetLinkedOverworldName (void) const
 
cMapManagerGetMapManager (void)
 Returns the associated map manager instance. More...
 
int GetMaxCactusHeight (void) const
 
virtual int GetMaxNetherPortalHeight (void) const override
 
virtual int GetMaxNetherPortalWidth (void) const override
 
int GetMaxSugarcaneHeight (void) const
 
int GetMaxViewDistance (void) const
 
virtual int GetMinNetherPortalHeight (void) const override
 Returns or sets the minumim or maximum netherportal height. More...
 
virtual int GetMinNetherPortalWidth (void) const override
 Returns or sets the minumim or maximum netherportal width. More...
 
const AStringGetName (void) const
 Returns the name of the world. More...
 
size_t GetNumChunks () const
 Returns the number of chunks loaded. More...
 
size_t GetNumUnusedDirtyChunks (void) const
 Returns the number of unused dirty chunks. More...
 
cRedstoneSimulatorGetRedstoneSimulator (void)
 
cScoreboardGetScoreBoard (void)
 Returns the associated scoreboard instance. More...
 
int GetSeed (void)
 Returns the seed of the world. More...
 
bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString &a_Line1, AString &a_Line2, AString &a_Line3, AString &a_Line4)
 Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found. More...
 
cSimulatorManagerGetSimulatorManager (void)
 
NIBBLETYPE GetSkyDarkness ()
 Get the current darkness level based on the time. More...
 
double GetSpawnX (void) const
 
double GetSpawnY (void) const
 
double GetSpawnZ (void) const
 
cWorldStorageGetStorage (void)
 
size_t GetStorageLoadQueueLength (void)
 
size_t GetStorageSaveQueueLength (void)
 
int GetTickRandomNumber (int a_Range)
 Returns a random number in range [0 . More...
 
int GetTicksUntilWeatherChange (void) const
 
virtual int GetTimeOfDay (void) const override
 
eShrapnelLevel GetTNTShrapnelLevel (void) const
 
cFluidSimulatorGetWaterSimulator (void)
 
eWeather GetWeather (void) const
 Returns the current weather. More...
 
virtual Int64 GetWorldAge (void) const override
 
int GrowCactus (int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow)
 Grows a cactus present at the block specified by the amount of blocks specified, up to the max height specified in the config; returns the amount of blocks the cactus grew inside this call. More...
 
bool GrowMelonPumpkin (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType)
 Grows a melon or a pumpkin next to the block specified (assumed to be the stem); returns true if the pumpkin or melon sucessfully grew. More...
 
int GrowPlantAt (Vector3i a_BlockPos, int a_NumStages=1)
 Grows the plant at the specified position by at most a_NumStages. More...
 
bool GrowRipePlant (Vector3i a_BlockPos)
 Grows the plant at the specified block to its ripe stage. More...
 
bool GrowRipePlant (int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal=false)
 OBSOLETE, use the Vector3-based overload instead. More...
 
int GrowSugarcane (int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow)
 Grows a sugarcane present at the block specified by the amount of blocks specified, up to the max height specified in the config; returns the amount of blocks the sugarcane grew inside this call. More...
 
bool GrowTree (int a_BlockX, int a_BlockY, int a_BlockZ)
 Grows a tree at the specified coords. More...
 
bool GrowTreeByBiome (int a_BlockX, int a_BlockY, int a_BlockZ)
 Grows a tree at the specified coords, based on the biome in the place. More...
 
bool GrowTreeFromSapling (Vector3i a_BlockPos, NIBBLETYPE a_SaplingMeta)
 Grows a tree at the specified coords, based on the sapling meta provided. More...
 
bool GrowTreeFromSapling (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_SaplingMeta)
 OBSOLETE, use the Vector3-based overload instead. More...
 
bool GrowTreeImage (const sSetBlockVector &a_Blocks)
 Imprints the specified blocks into the world, as long as each log block replaces only allowed blocks. More...
 
bool HasChunkAnyClients (int a_ChunkX, int a_ChunkZ) const
 
bool HasEntity (UInt32 a_UniqueID)
 Returns true if an entity with the specified UniqueID exists in the world. More...
 
void InitializeSpawn (void)
 
bool IsBlockDirectlyWatered (int a_BlockX, int a_BlockY, int a_BlockZ)
 
bool IsChunkLighted (int a_ChunkX, int a_ChunkZ)
 
bool IsChunkQueued (int a_ChunkX, int a_ChunkZ) const
 Returns true iff the chunk is in the loader / generator queue. More...
 
bool IsChunkValid (int a_ChunkX, int a_ChunkZ) const
 Returns true iff the chunk is present and valid. More...
 
virtual bool IsDaylightCycleEnabled (void) const
 Is the daylight cycle enabled? More...
 
bool IsDeepSnowEnabled (void) const
 
bool IsGameModeAdventure (void) const
 Returns true if the world is in Adventure mode. More...
 
bool IsGameModeCreative (void) const
 Returns true if the world is in Creative mode. More...
 
bool IsGameModeSpectator (void) const
 Returns true if the world is in Spectator mode. More...
 
bool IsGameModeSurvival (void) const
 Returns true if the world is in Survival mode. More...
 
bool IsPVPEnabled (void) const
 
bool IsSavingEnabled (void) const
 Get whether saving chunks is enabled. More...
 
bool IsTrapdoorOpen (int a_BlockX, int a_BlockY, int a_BlockZ)
 Is the trapdoor open? Returns false if there is no trapdoor at the specified coords. More...
 
bool IsWeatherRain (void) const
 Returns true if the current weather is rainy. More...
 
bool IsWeatherRainAt (int a_BlockX, int a_BlockZ)
 Returns true if it is raining at the specified location. More...
 
bool IsWeatherStorm (void) const
 Returns true if the current weather is stormy. More...
 
bool IsWeatherStormAt (int a_BlockX, int a_BlockZ)
 Returns true if the weather is stormy at the specified location. More...
 
bool IsWeatherSunny (void) const
 Returns true if the current weather is sunny. More...
 
bool IsWeatherSunnyAt (int a_BlockX, int a_BlockZ)
 Returns true if it is sunny at the specified location. More...
 
bool IsWeatherWet (void) const
 Returns true if the world currently has any precipitation - rain, storm or snow. More...
 
virtual bool IsWeatherWetAt (int a_BlockX, int a_BlockZ) override
 Returns true if it is raining or storming at the specified location. More...
 
virtual bool IsWeatherWetAtXYZ (Vector3i a_Pos)
 Returns true if the specified location has wet weather (rain or storm), using the same logic as IsWeatherWetAt, except that any rain-blocking blocks above the specified position will block the precipitation and this function will return false. More...
 
void MarkChunkDirty (int a_ChunkX, int a_ChunkZ)
 
void MarkChunkSaved (int a_ChunkX, int a_ChunkZ)
 
void MarkChunkSaving (int a_ChunkX, int a_ChunkZ)
 
cItems PickupsFromBlock (Vector3i a_BlockPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
 Returns all the pickups that would result if the a_Digger dug up the block at a_BlockPos using a_Tool a_Digger is usually a player, but can be nullptr for natural causes. More...
 
void PrepareChunk (int a_ChunkX, int a_ChunkZ, std::unique_ptr< cChunkCoordCallback > a_CallAfter={})
 Queues the chunk for preparing - making sure that it's generated and lit. More...
 
void QueueBlockForTick (int a_BlockX, int a_BlockY, int a_BlockZ, int a_TicksToWait)
 Queues the block to be ticked after the specified number of game ticks. More...
 
void QueueLightChunk (int a_ChunkX, int a_ChunkZ, std::unique_ptr< cChunkCoordCallback > a_Callback={})
 Queues a chunk for lighting; a_Callback is called after the chunk is lighted. More...
 
void QueueSaveAllChunks (void)
 Queues a task to save all chunks onto the tick thread. More...
 
void QueueSetChunkData (cSetChunkDataPtr a_SetChunkData)
 Puts the chunk data into a queue to be set into the chunkmap in the tick thread. More...
 
void QueueTask (std::function< void(cWorld &)> a_Task)
 Queues a task onto the tick thread. More...
 
void QueueUnloadUnusedChunks (void)
 Queues a task to unload unused chunks onto the tick thread. More...
 
void RegenerateChunk (int a_ChunkX, int a_ChunkZ)
 Regenerate the given chunk: More...
 
void RemoveChunkClient (int a_ChunkX, int a_ChunkZ, cClientHandle *a_Client)
 Removes client from the chunk specified. More...
 
void RemoveClientFromChunks (cClientHandle *a_Client)
 Removes the client from all chunks it is present in. More...
 
void RemoveClientFromChunkSender (cClientHandle *a_Client)
 Removes client from ChunkSender's queue of chunks to be sent. More...
 
OwnedEntity RemoveEntity (cEntity &a_Entity)
 Removes the entity from the world. More...
 
std::unique_ptr< cPlayerRemovePlayer (cPlayer &a_Player, bool a_RemoveFromChunk)
 Removes the player from the world. More...
 
void ReplaceBlocks (const sSetBlockVector &a_Blocks, BLOCKTYPE a_FilterBlockType)
 Replaces world blocks with a_Blocks, if they are of type a_FilterBlockType. More...
 
void SaveAllChunks (void)
 Saves all chunks immediately. More...
 
void ScheduleTask (int a_DelayTicks, std::function< void(cWorld &)> a_Task)
 Queues a lambda task onto the tick thread, with the specified delay. More...
 
void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle &a_Client)
 If there is a block entity at the specified coords, sends it to the client specified. More...
 
virtual void SendBlockTo (int a_X, int a_Y, int a_Z, cPlayer &a_Player) override
 Sends the block on those coords to the player. More...
 
void SendChunkTo (int a_ChunkX, int a_ChunkZ, cChunkSender::eChunkPriority a_Priority, cClientHandle *a_Client)
 Sends the chunk to the client specified, if the client doesn't have the chunk yet. More...
 
void SendPlayerList (cPlayer *a_DestPlayer)
 
bool SetAreaBiome (int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome)
 Sets the biome at the area. More...
 
bool SetAreaBiome (const cCuboid &a_Area, EMCSBiome a_Biome)
 Sets the biome at the area. More...
 
bool SetBiomeAt (int a_BlockX, int a_BlockZ, EMCSBiome a_Biome)
 Sets the biome at the specified coords. More...
 
void SetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Sets the block at the specified coords to the specified value. More...
 
void SetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 OBSOLETE, use the Vector3-based overload instead. More...
 
void SetBlockMeta (Vector3i a_BlockPos, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty=true, bool a_ShouldInformClients=true)
 Sets the meta for the specified block, while keeping the blocktype. More...
 
void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty=true, bool a_ShouldInformClients=true)
 OBSOLETE, use the Vector3-based overload instead. More...
 
void SetBlocks (const sSetBlockVector &a_Blocks)
 Performs the specified single-block set operations simultaneously, as if SetBlock() was called for each item. More...
 
void SetChunkAlwaysTicked (int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked=true)
 Increments (a_AlwaysTicked == true) or decrements (false) the m_AlwaysTicked counter for the specified chunk. More...
 
bool SetCommandBlockCommand (int a_BlockX, int a_BlockY, int a_BlockZ, const AString &a_Command)
 Sets the command block command. More...
 
void SetCommandBlocksEnabled (bool a_Flag)
 
virtual void SetDaylightCycleEnabled (bool a_IsDaylightCycleEnabled)
 Sets the daylight cycle to true / false. More...
 
void SetLinkedEndWorldName (const AString &a_Name)
 
void SetLinkedNetherWorldName (const AString &a_Name)
 
void SetLinkedOverworldName (const AString &a_Name)
 
virtual void SetMaxNetherPortalHeight (int a_NewMaxHeight) override
 
virtual void SetMaxNetherPortalWidth (int a_NewMaxWidth) override
 
void SetMaxViewDistance (int a_MaxViewDistance)
 
virtual void SetMinNetherPortalHeight (int a_NewMinHeight) override
 
virtual void SetMinNetherPortalWidth (int a_NewMinWidth) override
 
void SetNextBlockTick (int a_BlockX, int a_BlockY, int a_BlockZ)
 Sets the blockticking to start at the specified block. More...
 
void SetSavingEnabled (bool a_IsSavingEnabled)
 Set whether saving chunks is enabled. More...
 
void SetShouldUseChatPrefixes (bool a_Flag)
 
bool SetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4, cPlayer *a_Player=nullptr)
 Sets the sign text, asking plugins for permission first. More...
 
bool SetSpawn (double a_X, double a_Y, double a_Z)
 Set default spawn at the given coordinates. More...
 
void SetTicksUntilWeatherChange (int a_WeatherInterval)
 
virtual void SetTimeOfDay (int a_TimeOfDay) override
 
void SetTNTShrapnelLevel (eShrapnelLevel a_Flag)
 
bool SetTrapdoorOpen (int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open)
 Set the state of a trapdoor. More...
 
void SetWeather (eWeather a_NewWeather)
 Sets the specified weather; resets weather interval; asks and notifies plugins of the change. More...
 
bool ShouldBroadcastAchievementMessages (void) const
 
bool ShouldBroadcastDeathMessages (void) const
 
bool ShouldLavaSpawnFire (void) const
 
bool ShouldUseChatPrefixes (void) const
 
UInt32 SpawnBoat (double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material)
 
UInt32 SpawnBoat (Vector3d a_Pos, cBoat::eMaterial a_Material)
 Spawns a boat at the given coordinates. More...
 
UInt32 SpawnExperienceOrb (Vector3d a_Pos, int a_Reward)
 Spawns an experience orb at the given location with the given reward. More...
 
virtual UInt32 SpawnExperienceOrb (double a_X, double a_Y, double a_Z, int a_Reward) override
 OBSOLETE, use the Vector3d-based overload instead. More...
 
UInt32 SpawnFallingBlock (Vector3i a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Spawns an falling block entity at the given position. More...
 
UInt32 SpawnFallingBlock (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 OBSOLETE, use the Vector3i-based overload instead. More...
 
UInt32 SpawnItemPickup (Vector3d a_Pos, const cItem &a_Item, Vector3f a_Speed, int a_LifetimeTicks=6000, bool a_CanCombine=true)
 Spawns a single pickup containing the specified item. More...
 
virtual UInt32 SpawnItemPickup (double a_PosX, double a_PosY, double a_PosZ, const cItem &a_Item, float a_SpeedX=0.f, float a_SpeedY=0.f, float a_SpeedZ=0.f, int a_LifetimeTicks=6000, bool a_CanCombine=true) override
 OBSOLETE, use the Vector3d-based overload instead. More...
 
void SpawnItemPickups (const cItems &a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
 Spawns item pickups for each item in the list. More...
 
void SpawnItemPickups (const cItems &a_Pickups, Vector3d a_Pos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
 Spawns item pickups for each item in the list. More...
 
virtual void SpawnItemPickups (const cItems &a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false) override
 OBSOLETE, use the Vector3d-based overload instead. More...
 
void SpawnItemPickups (const cItems &a_Pickups, Vector3d a_Pos, Vector3d a_Speed, bool a_IsPlayerCreated=false)
 Spawns item pickups for each item in the list. More...
 
virtual void SpawnItemPickups (const cItems &a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool a_IsPlayerCreated=false) override
 OBSOLETE, use the Vector3d-based overload instead. More...
 
UInt32 SpawnMinecart (Vector3d a_Pos, int a_MinecartType, const cItem &a_Content=cItem(), int a_BlockHeight=1)
 Spawns an minecart at the given coordinates. More...
 
UInt32 SpawnMinecart (double a_X, double a_Y, double a_Z, int a_MinecartType, const cItem &a_Content=cItem(), int a_BlockHeight=1)
 OBSOLETE, use the Vector3d-based overload instead. More...
 
virtual UInt32 SpawnMob (double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby=false) override
 Spawns a mob of the specified type. More...
 
UInt32 SpawnMobFinalize (std::unique_ptr< cMonster > a_Monster)
 Wraps cEntity::Initialize, doing Monster-specific things before spawning the monster. More...
 
UInt32 SpawnPrimedTNT (double a_X, double a_Y, double a_Z, int a_FuseTimeInSec=80, double a_InitialVelocityCoeff=1)
 
UInt32 SpawnPrimedTNT (Vector3d a_Pos, int a_FuseTimeInSec=80, double a_InitialVelocityCoeff=1)
 Spawns a new primed TNT entity at the specified block coords and specified fuse duration. More...
 
virtual std::vector< UInt32SpawnSplitExperienceOrbs (Vector3d a_Pos, int a_Reward) override
 Spawns experience orbs of the specified total value at the given location. More...
 
std::vector< UInt32SpawnSplitExperienceOrbs (double a_X, double a_Y, double a_Z, int a_Reward)
 OBSOLETE, use the Vector3d-based overload instead. More...
 
void Start ()
 Starts threads that belong to this world. More...
 
void Stop (cDeadlockDetect &a_DeadlockDetect)
 Stops threads that belong to this world (part of deinit). More...
 
void TabCompleteUserName (const AString &a_Text, AStringVector &a_Results)
 Appends all usernames starting with a_Text (case-insensitive) into Results. More...
 
void TickQueuedBlocks (void)
 Processes the blocks queued for ticking with a delay (m_BlockTickQueue[]) More...
 
void TouchChunk (int a_ChunkX, int a_ChunkZ)
 Touches the chunk, causing it to be loaded or generated. More...
 
bool TryGetHeight (int a_BlockX, int a_BlockZ, int &a_Height)
 Retrieves the world height at the specified coords; returns false if chunk not loaded / generated. More...
 
void UseBlockEntity (cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 a_Player is using block entity at [x, y, z], handle that: More...
 
bool VillagersShouldHarvestCrops (void) const
 
virtual void WakeUpSimulators (Vector3i a_Block) override
 Wakes up the simulators for the specified block. More...
 
void WakeUpSimulators (int a_BlockX, int a_BlockY, int a_BlockZ)
 
void WakeUpSimulatorsInArea (const cCuboid &a_Area)
 Wakes up the simulators for the specified area of blocks. More...
 
void WakeUpSimulatorsInArea (int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ)
 
virtual bool WriteBlockArea (cBlockArea &a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override
 Writes the block area into the specified coords. More...
 
- Public Member Functions inherited from cForEachChunkProvider
virtual ~cForEachChunkProvider ()
 
- Public Member Functions inherited from cWorldInterface
virtual ~cWorldInterface ()
 
- Public Member Functions inherited from cBroadcastInterface
virtual ~cBroadcastInterface ()
 

Static Public Member Functions

static const char * GetClassStatic (void)
 

Private Member Functions

void AddQueuedPlayers (void)
 Adds the players queued in the m_PlayersToAdd queue into the m_Players list. More...
 
bool CanSpawnAt (double a_X, double &a_Y, double a_Z)
 Can the specified coordinates be used as a spawn point? Returns true if spawn position is valid and sets a_Y to the valid spawn height. More...
 
bool CheckPlayerSpawnPoint (int a_PosX, int a_PosY, int a_PosZ)
 Check if player starting point is acceptable. More...
 
eWeather ChooseNewWeather (void)
 Chooses a reasonable transition from the current weather to a new weather. More...
 
 cWorld (const AString &a_WorldName, const AString &a_DataPath, cDeadlockDetect &a_DeadlockDetect, const AStringVector &a_WorldNames, eDimension a_Dimension=dimOverworld, const AString &a_LinkedOverworldName={})
 Construct the world and read settings from its ini file. More...
 
void GenerateRandomSpawn (int a_MaxSpawnRadius)
 Generates a random spawnpoint on solid land by walking chunks and finding their biomes. More...
 
bool GetLargeTreeAdjustment (int &a_BlockX, int &a_BlockY, int &a_BlockZ, NIBBLETYPE a_SaplingMeta)
 Checks if the sapling at the specified block coord is a part of a large-tree sapling (2x2). More...
 
void InitializeAndLoadMobSpawningValues (cIniFile &a_IniFile)
 Sets mob spawning values if nonexistant to their dimension specific defaults. More...
 
cFluidSimulatorInitializeFluidSimulator (cIniFile &a_IniFile, const char *a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock)
 Creates a new fluid simulator, loads its settings from the inifile (a_FluidName section) More...
 
cRedstoneSimulatorInitializeRedstoneSimulator (cIniFile &a_IniFile)
 Creates a new redstone simulator. More...
 
void SetChunkData (cSetChunkData &a_SetChunkData)
 Sets the specified chunk data into the chunkmap. More...
 
void Tick (std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec)
 
void TickClients (float a_Dt)
 Ticks all clients that are in this world. More...
 
void TickMobs (std::chrono::milliseconds a_Dt)
 Handles the mob spawning / moving / destroying each tick. More...
 
void TickQueuedTasks (void)
 Executes all tasks queued onto the tick thread. More...
 
void TickWeather (float a_Dt)
 Handles the weather in each tick. More...
 
void UnloadUnusedChunks (void)
 Unloads all chunks immediately. More...
 
void UpdateSkyDarkness (void)
 
virtual ~cWorld () override
 

Private Attributes

std::set< eMonsterTypem_AllowedMobs
 
bool m_bAnimals
 
bool m_bCommandBlocksEnabled
 Whether command blocks are enabled or not. More...
 
bool m_bEnabledPVP
 
std::vector< BlockTickQueueItem * > m_BlockTickQueue
 
std::vector< BlockTickQueueItem * > m_BlockTickQueueCopy
 
bool m_BroadcastAchievementMessages
 
bool m_BroadcastDeathMessages
 
bool m_bUseChatPrefixes
 Whether prefixes such as [INFO] are prepended to SendMessageXXX() / BroadcastChatXXX() functions. More...
 
std::unique_ptr< cChunkMapm_ChunkMap
 
cChunkSender m_ChunkSender
 
cClientHandlePtrs m_Clients
 List of clients in this world, these will be ticked by this world. More...
 
cClientHandlePtrs m_ClientsToAdd
 Clients that are scheduled for adding, waiting for TickClients to add them. More...
 
cClientHandles m_ClientsToRemove
 Clients that are scheduled for removal (ticked in another world), waiting for TickClients() to remove them. More...
 
cCriticalSection m_CSClients
 Guards m_Clients. More...
 
cCriticalSection m_CSEntitiesToAdd
 Guards m_EntitiesToAdd. More...
 
cCriticalSection m_CSPlayers
 
cCriticalSection m_CSPlayersToAdd
 Guards m_PlayersToAdd. More...
 
cCriticalSection m_CSSetChunkDataQueue
 CS protecting m_SetChunkDataQueue. More...
 
cCriticalSection m_CSTasks
 Guards the m_Tasks. More...
 
AString m_DataPath
 The path to the root directory for the world files. More...
 
eDimension m_Dimension
 The dimension of the world, used by the client to provide correct lighting scheme. More...
 
cEntityList m_EntitiesToAdd
 List of entities that are scheduled for adding, waiting for the Tick thread to add them. More...
 
std::unique_ptr< cFireSimulatorm_FireSimulator
 
eGameMode m_GameMode
 
cChunkGeneratorThread m_Generator
 The thread responsible for generating chunks. More...
 
cChunkGeneratorCallbacks m_GeneratorCallbacks
 The callbacks that the ChunkGenerator uses to store new chunks and interface to plugins. More...
 
AString m_IniFileName
 
bool m_IsBeetrootsBonemealable
 
bool m_IsBigFlowerBonemealable
 
bool m_IsCactusBonemealable
 
bool m_IsCarrotsBonemealable
 
bool m_IsCropsBonemealable
 
bool m_IsDaylightCycleEnabled
 
bool m_IsDeepSnowEnabled
 
bool m_IsGrassBonemealable
 
bool m_IsMelonBonemealable
 
bool m_IsMelonStemBonemealable
 
bool m_IsPotatoesBonemealable
 
bool m_IsPumpkinBonemealable
 
bool m_IsPumpkinStemBonemealable
 
bool m_IsSaplingBonemealable
 
std::atomic< bool > m_IsSavingEnabled
 Whether or not writing chunks to disk is currently enabled. More...
 
bool m_IsSpawnExplicitlySet
 
bool m_IsSugarcaneBonemealable
 
bool m_IsTallGrassBonemealable
 
cTickTimeLong m_LastChunkCheck
 
cTickTimeLong m_LastSave
 
std::map< cMonster::eFamily, cTickTimeLongm_LastSpawnMonster
 
cTickTimeLong m_LastTimeUpdate
 
cFluidSimulatorm_LavaSimulator
 
cLightingThread m_Lighting
 
AString m_LinkedEndWorldName
 Name of the End world - where End portals should teleport. More...
 
AString m_LinkedNetherWorldName
 Name of the nether world - where Nether portals should teleport. More...
 
AString m_LinkedOverworldName
 The name of the overworld that portals in this world should link to. More...
 
cMapManager m_MapManager
 
int m_MaxCactusHeight
 
int m_MaxNetherPortalHeight
 
int m_MaxNetherPortalWidth
 
unsigned int m_MaxPlayers
 
int m_MaxRainTicks
 
int m_MaxSugarcaneHeight
 
int m_MaxSunnyTicks
 
int m_MaxThunderStormTicks
 
int m_MaxViewDistance
 The maximum view distance that a player can have in this world. More...
 
int m_MinNetherPortalHeight
 
int m_MinNetherPortalWidth
 
int m_MinRainTicks
 
int m_MinSunnyTicks
 
int m_MinThunderStormTicks
 
cPlayerList m_Players
 
cAwaitingPlayerList m_PlayersToAdd
 List of players that are scheduled for adding, waiting for the Tick thread to add them. More...
 
cRedstoneSimulatorm_RedstoneSimulator
 
std::unique_ptr< cSandSimulatorm_SandSimulator
 
cScoreboard m_Scoreboard
 
cSetChunkDataPtrs m_SetChunkDataQueue
 Queue for the chunk data to be set into m_ChunkMap by the tick thread. More...
 
bool m_ShouldLavaSpawnFire
 
std::unique_ptr< cSimulatorManagerm_SimulatorManager
 
NIBBLETYPE m_SkyDarkness
 
double m_SpawnX
 
double m_SpawnY
 
double m_SpawnZ
 
cWorldStorage m_Storage
 
int m_StorageCompressionFactor
 
AString m_StorageSchema
 Name of the storage schema used to load and save chunks. More...
 
std::vector< std::pair< Int64, std::function< void(cWorld &)> > > m_Tasks
 Tasks that have been queued onto the tick thread, possibly to be executed at target tick in the future; guarded by m_CSTasks. More...
 
cTickThread m_TickThread
 
std::chrono::milliseconds m_TimeOfDay
 
eShrapnelLevel m_TNTShrapnelLevel
 The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities See the eShrapnelLevel enumeration for details. More...
 
size_t m_UnusedDirtyChunksCap
 The maximum number of allowed unused dirty chunks for this world. More...
 
bool m_VillagersShouldHarvestCrops
 
cFluidSimulatorm_WaterSimulator
 
eWeather m_Weather
 
int m_WeatherInterval
 
std::chrono::milliseconds m_WorldAge
 The age of the world. More...
 
AString m_WorldName
 

Friends

class cRoot
 

Detailed Description

Definition at line 65 of file World.h.

Constructor & Destructor Documentation

cWorld::cWorld ( const AString a_WorldName,
const AString a_DataPath,
cDeadlockDetect a_DeadlockDetect,
const AStringVector a_WorldNames,
eDimension  a_Dimension = dimOverworld,
const AString a_LinkedOverworldName = {} 
)
private

Construct the world and read settings from its ini file.

Parameters
a_DeadlockDetectis used for tracking this world's age, detecting a possible deadlock.
a_WorldNamesis a list of all world names, used to validate linked worlds

Definition at line 142 of file World.cpp.

cWorld::~cWorld ( )
overrideprivatevirtual

Definition at line 451 of file World.cpp.

Member Function Documentation

bool cWorld::AddChunkClient ( int  a_ChunkX,
int  a_ChunkZ,
cClientHandle a_Client 
)

Adds client to a chunk, if not already present; returns true if added, false if present.

Definition at line 2770 of file World.cpp.

void cWorld::AddEntity ( OwnedEntity  a_Entity)

Adds the entity into its appropriate chunk; takes ownership of the entity ptr.

The entity is added lazily - this function only puts it in a queue that is then processed by the Tick thread.

Definition at line 3035 of file World.cpp.

void cWorld::AddPlayer ( std::unique_ptr< cPlayer a_Player,
cWorld a_OldWorld = nullptr 
)

Adds the player to the world.

Uses a queue to store the player object until the Tick thread processes the addition event. Also adds the player as an entity in the chunkmap, and the player's ClientHandle, if any, for ticking. If a_OldWorld is provided, a corresponding ENTITY_CHANGED_WORLD event is triggerred after the addition.

Definition at line 2447 of file World.cpp.

void cWorld::AddQueuedPlayers ( void  )
private

Adds the players queued in the m_PlayersToAdd queue into the m_Players list.

Assumes it is called from the Tick thread.

Definition at line 3448 of file World.cpp.

bool cWorld::AreCommandBlocksEnabled ( void  ) const
inline

Definition at line 888 of file World.h.

void cWorld::BroadcastAttachEntity ( const cEntity a_Entity,
const cEntity a_Vehicle 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 109 of file Broadcaster.cpp.

void cWorld::BroadcastBlockAction ( Vector3i  a_BlockPos,
Byte  a_Byte1,
Byte  a_Byte2,
BLOCKTYPE  a_BlockType,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 122 of file Broadcaster.cpp.

void cWorld::BroadcastBlockBreakAnimation ( UInt32  a_EntityID,
Vector3i  a_BlockPos,
Int8  a_Stage,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 135 of file Broadcaster.cpp.

void cWorld::BroadcastBlockEntity ( Vector3i  a_BlockPos,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

If there is a block entity at the specified coods, sends it to all clients except a_Exclude.

Implements cBroadcastInterface.

Definition at line 148 of file Broadcaster.cpp.

void cWorld::BroadcastChat ( const AString a_Message,
const cClientHandle a_Exclude = nullptr,
eMessageType  a_ChatPrefix = mtCustom 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 174 of file Broadcaster.cpp.

void cWorld::BroadcastChat ( const cCompositeChat a_Message,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 187 of file Broadcaster.cpp.

virtual void cWorld::BroadcastChatDeath ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 176 of file World.h.

virtual void cWorld::BroadcastChatFailure ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 172 of file World.h.

virtual void cWorld::BroadcastChatFatal ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 175 of file World.h.

virtual void cWorld::BroadcastChatInfo ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 171 of file World.h.

virtual void cWorld::BroadcastChatSuccess ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 173 of file World.h.

virtual void cWorld::BroadcastChatWarning ( const AString a_Message,
const cClientHandle a_Exclude = nullptr 
)
inlineoverridevirtual

Implements cBroadcastInterface.

Definition at line 174 of file World.h.

void cWorld::BroadcastCollectEntity ( const cEntity a_Pickup,
const cPlayer a_Player,
int  a_Count,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 200 of file Broadcaster.cpp.

void cWorld::BroadcastDestroyEntity ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 213 of file Broadcaster.cpp.

void cWorld::BroadcastDetachEntity ( const cEntity a_Entity,
const cEntity a_PreviousVehicle 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 226 of file Broadcaster.cpp.

void cWorld::BroadcastDisplayObjective ( const AString a_Objective,
cScoreboard::eDisplaySlot  a_Display 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 239 of file Broadcaster.cpp.

void cWorld::BroadcastEntityAnimation ( const cEntity a_Entity,
Int8  a_Animation,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 369 of file Broadcaster.cpp.

void cWorld::BroadcastEntityEffect ( const cEntity a_Entity,
int  a_EffectID,
int  a_Amplifier,
int  a_Duration,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 252 of file Broadcaster.cpp.

void cWorld::BroadcastEntityEquipment ( const cEntity a_Entity,
short  a_SlotNum,
const cItem a_Item,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 265 of file Broadcaster.cpp.

void cWorld::BroadcastEntityHeadLook ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 278 of file Broadcaster.cpp.

void cWorld::BroadcastEntityLook ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 291 of file Broadcaster.cpp.

void cWorld::BroadcastEntityMetadata ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 304 of file Broadcaster.cpp.

void cWorld::BroadcastEntityRelMove ( const cEntity a_Entity,
Vector3< Int8 a_RelMove,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 317 of file Broadcaster.cpp.

void cWorld::BroadcastEntityRelMoveLook ( const cEntity a_Entity,
Vector3< Int8 a_RelMove,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 330 of file Broadcaster.cpp.

void cWorld::BroadcastEntityStatus ( const cEntity a_Entity,
Int8  a_Status,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 343 of file Broadcaster.cpp.

void cWorld::BroadcastEntityVelocity ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 356 of file Broadcaster.cpp.

void cWorld::BroadcastLeashEntity ( const cEntity a_Entity,
const cEntity a_EntityLeashedTo 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 382 of file Broadcaster.cpp.

void cWorld::BroadcastParticleEffect ( const AString a_ParticleName,
Vector3f  a_Src,
Vector3f  a_Offset,
float  a_ParticleData,
int  a_ParticleAmount,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 395 of file Broadcaster.cpp.

void cWorld::BroadcastParticleEffect ( const AString a_ParticleName,
Vector3f  a_Src,
Vector3f  a_Offset,
float  a_ParticleData,
int  a_ParticleAmount,
std::array< int, 2 >  a_Data,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 408 of file Broadcaster.cpp.

void cWorld::BroadcastPlayerListAddPlayer ( const cPlayer a_Player,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 421 of file Broadcaster.cpp.

void cWorld::BroadcastPlayerListRemovePlayer ( const cPlayer a_Player,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 434 of file Broadcaster.cpp.

void cWorld::BroadcastPlayerListUpdateDisplayName ( const cPlayer a_Player,
const AString a_CustomName,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 473 of file Broadcaster.cpp.

void cWorld::BroadcastPlayerListUpdateGameMode ( const cPlayer a_Player,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 447 of file Broadcaster.cpp.

void cWorld::BroadcastPlayerListUpdatePing ( const cPlayer a_Player,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 460 of file Broadcaster.cpp.

void cWorld::BroadcastRemoveEntityEffect ( const cEntity a_Entity,
int  a_EffectID,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 486 of file Broadcaster.cpp.

void cWorld::BroadcastScoreboardObjective ( const AString a_Name,
const AString a_DisplayName,
Byte  a_Mode 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 499 of file Broadcaster.cpp.

void cWorld::BroadcastScoreUpdate ( const AString a_Objective,
const AString a_Player,
cObjective::Score  a_Score,
Byte  a_Mode 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 512 of file Broadcaster.cpp.

void cWorld::BroadcastSoundEffect ( const AString a_SoundName,
Vector3d  a_Position,
float  a_Volume,
float  a_Pitch,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 525 of file Broadcaster.cpp.

void cWorld::BroadcastSoundParticleEffect ( const EffectID  a_EffectID,
Vector3i  a_SrcPos,
int  a_Data,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 538 of file Broadcaster.cpp.

void cWorld::BroadcastSpawnEntity ( cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 551 of file Broadcaster.cpp.

void cWorld::BroadcastTeleportEntity ( const cEntity a_Entity,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 564 of file Broadcaster.cpp.

void cWorld::BroadcastThunderbolt ( Vector3i  a_BlockPos,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 577 of file Broadcaster.cpp.

void cWorld::BroadcastTimeUpdate ( const cClientHandle a_Exclude = nullptr)
overridevirtual

Implements cBroadcastInterface.

Definition at line 590 of file Broadcaster.cpp.

void cWorld::BroadcastUnleashEntity ( const cEntity a_Entity)
overridevirtual

Implements cBroadcastInterface.

Definition at line 603 of file Broadcaster.cpp.

void cWorld::BroadcastUseBed ( const cEntity a_Entity,
Vector3i  a_BlockPos 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 616 of file Broadcaster.cpp.

void cWorld::BroadcastWeather ( eWeather  a_Weather,
const cClientHandle a_Exclude = nullptr 
)
overridevirtual

Implements cBroadcastInterface.

Definition at line 629 of file Broadcaster.cpp.

bool cWorld::CanSpawnAt ( double  a_X,
double &  a_Y,
double  a_Z 
)
private

Can the specified coordinates be used as a spawn point? Returns true if spawn position is valid and sets a_Y to the valid spawn height.

Definition at line 749 of file World.cpp.

void cWorld::CastThunderbolt ( Vector3i  a_Block)

Casts a thunderbolt at the specified coords.

Definition at line 487 of file World.cpp.

void cWorld::CastThunderbolt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Definition at line 477 of file World.cpp.

void cWorld::ChangeWeather ( void  )

Forces a weather change in the next game tick.

Definition at line 551 of file World.cpp.

bool cWorld::CheckPlayerSpawnPoint ( int  a_PosX,
int  a_PosY,
int  a_PosZ 
)
private

Check if player starting point is acceptable.

Definition at line 822 of file World.cpp.

eWeather cWorld::ChooseNewWeather ( void  )
private

Chooses a reasonable transition from the current weather to a new weather.

Definition at line 864 of file World.cpp.

void cWorld::ChunkLighted ( int  a_ChunkX,
int  a_ChunkZ,
const cChunkDef::BlockNibbles a_BlockLight,
const cChunkDef::BlockNibbles a_SkyLight 
)

Definition at line 2361 of file World.cpp.

void cWorld::ChunkLoadFailed ( int  a_ChunkX,
int  a_ChunkZ 
)

Marks the chunk as failed-to-load:

Definition at line 2843 of file World.cpp.

void cWorld::CollectPickupsByPlayer ( cPlayer a_Player)

Definition at line 2438 of file World.cpp.

void cWorld::CompareChunkClients ( int  a_ChunkX1,
int  a_ChunkZ1,
int  a_ChunkX2,
int  a_ChunkZ2,
cClientDiffCallback a_Callback 
)

Compares clients of two chunks, calls the callback accordingly.

Definition at line 2761 of file World.cpp.

UInt32 cWorld::CreateProjectile ( Vector3d  a_Pos,
cProjectileEntity::eKind  a_Kind,
cEntity a_Creator,
const cItem a_Item,
const Vector3d a_Speed = nullptr 
)

Creates a projectile of the specified type.

Returns the projectile's UniqueID if successful, cEntity::INVALID_ID otherwise Item parameter is currently used for Fireworks to correctly set entity metadata based on item metadata.

Definition at line 3241 of file World.cpp.

UInt32 cWorld::CreateProjectile ( double  a_PosX,
double  a_PosY,
double  a_PosZ,
cProjectileEntity::eKind  a_Kind,
cEntity a_Creator,
const cItem a_Item,
const Vector3d a_Speed = nullptr 
)

OBSOLETE, use the Vector3d-based overload instead.

Creates a projectile of the specified type. Returns the projectile's UniqueID if successful, cEntity::INVALID_ID otherwise Item parameter is currently used for Fireworks to correctly set entity metadata based on item metadata.

Definition at line 3262 of file World.cpp.

bool cWorld::DigBlock ( Vector3i  a_BlockPos)

Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()).

Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead. Returns true on success, false if the chunk is not loaded.

Definition at line 2180 of file World.cpp.

bool cWorld::DigBlock ( int  a_X,
int  a_Y,
int  a_Z 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()). Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead. Returns true on success, false if the chunk is not loaded.

Definition at line 666 of file World.h.

void cWorld::DoExplosionAt ( double  a_ExplosionSize,
double  a_BlockX,
double  a_BlockY,
double  a_BlockZ,
bool  a_CanCauseFire,
eExplosionSource  a_Source,
void *  a_SourceData 
)
overridevirtual

Does an explosion with the specified strength at the specified coordinates.

Executes the HOOK_EXPLODING and HOOK_EXPLODED hooks as part of the processing. a_SourceData exact type depends on the a_Source, see the declaration of the esXXX constants in BlockID.h for details. Exported to Lua manually in ManualBindings_World.cpp in order to support the variable a_SourceData param.

Implements cWorldInterface.

Definition at line 1399 of file World.cpp.

bool cWorld::DoWithBeaconAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cBeaconCallback  a_Callback 
)

Calls the callback for the beacon at the specified coords; returns false if there's no beacon at those coords, true if found.

Definition at line 1441 of file World.cpp.

bool cWorld::DoWithBedAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cBedCallback  a_Callback 
)
overridevirtual

Calls the callback for the bed at the specified coords; returns false if there's no bed at those coords, true if found.

Implements cWorldInterface.

Definition at line 1450 of file World.cpp.

bool cWorld::DoWithBlockEntityAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cBlockEntityCallback  a_Callback 
)
overridevirtual

Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found.

Implements cWorldInterface.

Definition at line 1432 of file World.cpp.

bool cWorld::DoWithBrewingstandAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cBrewingstandCallback  a_Callback 
)

Calls the callback for the brewingstand at the specified coords; returns false if there's no brewingstand at those coords, true if found.

Definition at line 1459 of file World.cpp.

bool cWorld::DoWithChestAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cChestCallback  a_Callback 
)

Calls the callback for the chest at the specified coords; returns false if there's no chest at those coords, true if found.

Definition at line 1468 of file World.cpp.

bool cWorld::DoWithChunk ( int  a_ChunkX,
int  a_ChunkZ,
cChunkCallback  a_Callback 
)

Calls the callback for the chunk specified, with ChunkMapCS locked.

Returns false if the chunk doesn't exist, otherwise returns the same value as the callback

Definition at line 1558 of file World.cpp.

bool cWorld::DoWithChunkAt ( Vector3i  a_BlockPos,
cChunkCallback  a_Callback 
)

Calls the callback for the chunk at the block position specified, with ChunkMapCS locked.

Returns false if the chunk isn't loaded, otherwise returns the same value as the callback

Definition at line 1567 of file World.cpp.

bool cWorld::DoWithCommandBlockAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cCommandBlockCallback  a_Callback 
)

Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found.

Definition at line 1522 of file World.cpp.

bool cWorld::DoWithDispenserAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cDispenserCallback  a_Callback 
)

Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found.

Definition at line 1477 of file World.cpp.

bool cWorld::DoWithDropperAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cDropperCallback  a_Callback 
)

Calls the callback for the dropper at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found.

Definition at line 1486 of file World.cpp.

bool cWorld::DoWithDropSpenserAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cDropSpenserCallback  a_Callback 
)

Calls the callback for the dropspenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found.

Definition at line 1495 of file World.cpp.

bool cWorld::DoWithEntityByID ( UInt32  a_UniqueID,
cEntityCallback  a_Callback 
)

Calls the callback if the entity with the specified ID is found, with the entity object as the callback param.

Returns true if entity found and callback returned false.

Definition at line 2738 of file World.cpp.

bool cWorld::DoWithFlowerPotAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cFlowerPotCallback  a_Callback 
)

Calls the callback for the flower pot at the specified coords; returns false if there's no flower pot at those coords or callback returns true, returns true if found.

Definition at line 1540 of file World.cpp.

bool cWorld::DoWithFurnaceAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cFurnaceCallback  a_Callback 
)

Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found.

Definition at line 1504 of file World.cpp.

bool cWorld::DoWithMobHeadAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cMobHeadCallback  a_Callback 
)

Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found.

Definition at line 1531 of file World.cpp.

bool cWorld::DoWithNearestPlayer ( Vector3d  a_Pos,
double  a_RangeLimit,
cPlayerListCallback  a_Callback,
bool  a_CheckLineOfSight = true,
bool  a_IgnoreSpectator = true 
)

Calls the callback for nearest player for given position, Returns false if player not found, otherwise returns the same value as the callback.

Definition at line 2639 of file World.cpp.

bool cWorld::DoWithNoteBlockAt ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cNoteBlockCallback  a_Callback 
)

Calls the callback for the noteblock at the specified coords; returns false if there's no noteblock at those coords or callback returns true, returns true if found.

Definition at line 1513 of file World.cpp.

bool cWorld::DoWithPlayer ( const AString a_PlayerName,
cPlayerListCallback  a_Callback 
)

Calls the callback for the player of the given name; returns true if the player was found and the callback called, false if player not found.

Callback return value is ignored. If there are multiple players of the same name, only (random) one is processed by the callback.

Definition at line 2567 of file World.cpp.

bool cWorld::DoWithPlayerByUUID ( const cUUID a_PlayerUUID,
cPlayerListCallback  a_Callback 
)

Finds the player over his uuid and calls the callback.

Definition at line 2622 of file World.cpp.

bool cWorld::DropBlockAsPickups ( Vector3i  a_BlockPos,
const cEntity a_Digger = nullptr,
const cItem a_Tool = nullptr 
)

Digs the specified block, and spawns the appropriate pickups for it.

a_Digger is an optional entity causing the digging, usually the player. a_Tool is an optional item used to dig up the block, used by the handlers (empty hand vs shears produce different pickups from leaves). An empty hand is assumed if a_Tool is nullptr. Returns true on success, false if the chunk is not loaded.

Definition at line 2200 of file World.cpp.

void cWorld::FastSetBlock ( Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inline

Sets the block at the specified coords to the specified value.

The replacement doesn't trigger block updates, nor wake up simulators. The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block)

Definition at line 400 of file World.h.

void cWorld::FastSetBlock ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Sets the block at the specified coords to the specified value. The replacement doesn't trigger block updates, nor wake up simulators. The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block)

Definition at line 409 of file World.h.

bool cWorld::FindAndDoWithPlayer ( const AString a_PlayerNameHint,
cPlayerListCallback  a_Callback 
)

Finds a player from a partial or complete player name and calls the callback - case-insensitive.

Definition at line 2586 of file World.cpp.

void cWorld::ForceSendChunkTo ( int  a_ChunkX,
int  a_ChunkZ,
cChunkSender::eChunkPriority  a_Priority,
cClientHandle a_Client 
)

Sends the chunk to the client specified, even if the client already has the chunk.

If the chunk's not valid, the request is postponed (ChunkSender will send that chunk when it becomes valid + lighted).

Definition at line 2806 of file World.cpp.

bool cWorld::ForEachBlockEntityInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cBlockEntityCallback  a_Callback 
)

Calls the callback for each block entity in the specified chunk; returns true if all block entities processed, false if the callback aborted by returning true.

Definition at line 1336 of file World.cpp.

bool cWorld::ForEachBrewingstandInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cBrewingstandCallback  a_Callback 
)

Calls the callback for each brewingstand in the specified chunk; returns true if all brewingstands processed, false if the callback aborted by returning true.

Definition at line 1345 of file World.cpp.

bool cWorld::ForEachChestInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cChestCallback  a_Callback 
)

Calls the callback for each chest in the specified chunk; returns true if all chests processed, false if the callback aborted by returning true.

Definition at line 1354 of file World.cpp.

bool cWorld::ForEachChunkInRect ( int  a_MinChunkX,
int  a_MaxChunkX,
int  a_MinChunkZ,
int  a_MaxChunkZ,
cChunkDataCallback &  a_Callback 
)
overridevirtual

Calls the callback for each chunk in the coords specified (all cords are inclusive).

Returns true if all chunks have been processed successfully

Implements cForEachChunkProvider.

Definition at line 2970 of file World.cpp.

bool cWorld::ForEachDispenserInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cDispenserCallback  a_Callback 
)

Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true.

Definition at line 1363 of file World.cpp.

bool cWorld::ForEachDropperInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cDropperCallback  a_Callback 
)

Calls the callback for each dropper in the specified chunk; returns true if all droppers processed, false if the callback aborted by returning true.

Definition at line 1372 of file World.cpp.

bool cWorld::ForEachDropSpenserInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cDropSpenserCallback  a_Callback 
)

Calls the callback for each dropspenser in the specified chunk; returns true if all dropspensers processed, false if the callback aborted by returning true.

Definition at line 1381 of file World.cpp.

bool cWorld::ForEachEntity ( cEntityCallback  a_Callback)

Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true.

Definition at line 2711 of file World.cpp.

bool cWorld::ForEachEntityInBox ( const cBoundingBox a_Box,
cEntityCallback  a_Callback 
)
overridevirtual

Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.

Returns true if all entities processed, false if the callback aborted by returning true. If any chunk in the box is missing, ignores the entities in that chunk silently.

Implements cWorldInterface.

Definition at line 2729 of file World.cpp.

bool cWorld::ForEachEntityInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cEntityCallback  a_Callback 
)

Calls the callback for each entity in the specified chunk; returns true if all entities processed, false if the callback aborted by returning true.

Definition at line 2720 of file World.cpp.

bool cWorld::ForEachFurnaceInChunk ( int  a_ChunkX,
int  a_ChunkZ,
cFurnaceCallback  a_Callback 
)

Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true.

Definition at line 1390 of file World.cpp.

bool cWorld::ForEachLoadedChunk ( cFunctionRef< bool(int, int)>  a_Callback)

Calls the callback for each loaded chunk.

Returns true if all chunks have been processed successfully

Definition at line 2979 of file World.cpp.

bool cWorld::ForEachPlayer ( cPlayerListCallback  a_Callback)
overridevirtual

Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true.

Implements cWorldInterface.

Definition at line 2549 of file World.cpp.

void cWorld::GenerateChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Generates the given chunk.

Definition at line 2943 of file World.cpp.

void cWorld::GenerateRandomSpawn ( int  a_MaxSpawnRadius)
private

Generates a random spawnpoint on solid land by walking chunks and finding their biomes.

Definition at line 667 of file World.cpp.

EMCSBiome cWorld::GetBiomeAt ( int  a_BlockX,
int  a_BlockZ 
)

Returns the biome at the specified coords.

Reads the biome from the chunk, if loaded, otherwise uses the world generator to provide the biome value

Definition at line 1824 of file World.cpp.

BLOCKTYPE cWorld::GetBlock ( Vector3i  a_BlockPos)
inline

Returns the block type at the specified position.

Returns 0 if the chunk is not valid.

Definition at line 416 of file World.h.

BLOCKTYPE cWorld::GetBlock ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Returns the block type at the specified position. Returns 0 if the chunk is not valid.

Definition at line 424 of file World.h.

NIBBLETYPE cWorld::GetBlockBlockLight ( Vector3i  a_BlockPos)

Returns the block-light value at the specified block position.

Returns 0 if chunk not valid.

Definition at line 1900 of file World.cpp.

NIBBLETYPE cWorld::GetBlockBlockLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Returns the block-light value at the specified block position. Returns 0 if chunk not valid.

Definition at line 481 of file World.h.

bool cWorld::GetBlockInfo ( Vector3i  a_BlockPos,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_Meta,
NIBBLETYPE a_SkyLight,
NIBBLETYPE a_BlockLight 
)

Queries the whole block specification from the world.

Returns true if all block info was retrieved successfully, false if not (invalid chunk / bad position). Exported in ManualBindings_World.cpp.

Definition at line 1918 of file World.cpp.

bool cWorld::GetBlockInfo ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_Meta,
NIBBLETYPE a_SkyLight,
NIBBLETYPE a_BlockLight 
)
inline

Queries the whole block specification from the world.

Returns true if all block info was retrieved successfully, false if not (invalid chunk / bad position). Exported in ManualBindings_World.cpp.

Definition at line 512 of file World.h.

NIBBLETYPE cWorld::GetBlockMeta ( Vector3i  a_BlockPos)
inline

Returns the block meta at the specified position.

Returns 0 if the chunk is not valid.

Definition at line 431 of file World.h.

NIBBLETYPE cWorld::GetBlockMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Returns the block meta at the specified position. Returns 0 if the chunk is not valid.

Definition at line 439 of file World.h.

bool cWorld::GetBlocks ( sSetBlockVector a_Blocks,
bool  a_ContinueOnFailure 
)

Retrieves block types of the specified blocks.

If a chunk is not loaded, doesn't modify the block. Returns true if all blocks were read.

Definition at line 2171 of file World.cpp.

NIBBLETYPE cWorld::GetBlockSkyLight ( Vector3i  a_BlockPos)

Returns the sky light value at the specified block position.

The sky light is "raw" - not affected by time-of-day. Returns 0 if chunk not valid.

Definition at line 1891 of file World.cpp.

NIBBLETYPE cWorld::GetBlockSkyLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Returns the sky light value at the specified block position. The sky light is "raw" - not affected by time-of-day. Returns 0 if chunk not valid.

Definition at line 469 of file World.h.

bool cWorld::GetBlockTypeMeta ( Vector3i  a_BlockPos,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_BlockMeta 
)

Retrieves the block type and meta at the specified coords.

Stores the result into a_BlockType and a_BlockMeta. Returns true if successful, false if chunk not present. TODO: Export in ManualBindings_World.cpp.

Definition at line 1909 of file World.cpp.

bool cWorld::GetBlockTypeMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_BlockMeta 
)
inline

OBSOLETE, use the Vector3i-based overload instead.

Retrieves the block type and meta at the specified coords. Stores the result into a_BlockType and a_BlockMeta. Returns true if successful, false if chunk not present. Exported in ManualBindings_World.cpp.

Definition at line 499 of file World.h.

virtual cBroadcastInterface& cWorld::GetBroadcastManager ( void  )
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 215 of file World.h.

bool cWorld::GetChunkBlockTypes ( int  a_ChunkX,
int  a_ChunkZ,
BLOCKTYPE a_BlockTypes 
)

Gets the chunk's blocks, only the block types.

Definition at line 2383 of file World.cpp.

bool cWorld::GetChunkData ( cChunkCoords  a_Coords,
cChunkDataCallback &  a_Callback 
) const

Calls the callback with the chunk's data, if available (with ChunkCS locked).

Returns true if the chunk was reported successfully, false if not (chunk not present or callback failed).

Definition at line 2374 of file World.cpp.

cChunkMap* cWorld::GetChunkMap ( void  )
inline

Definition at line 1044 of file World.h.

void cWorld::GetChunkStats ( int &  a_NumValid,
int &  a_NumDirty,
int &  a_NumInLightingQueue 
)

Returns the number of chunks loaded and dirty, and in the lighting queue.

Definition at line 3121 of file World.cpp.

static const char* cWorld::GetClassStatic ( void  )
inlinestatic

Definition at line 84 of file World.h.

const AString& cWorld::GetDataPath ( void  ) const
inline

Returns the data path to the world data.

Definition at line 877 of file World.h.

int cWorld::GetDefaultWeatherInterval ( eWeather  a_Weather)

Returns the default weather interval for the specific weather type.

Returns -1 for any unknown weather.

Definition at line 497 of file World.cpp.

virtual eDimension cWorld::GetDimension ( void  ) const
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 151 of file World.h.

eGameMode cWorld::GetGameMode ( void  ) const
inline

Returns the current game mode.

Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable

Definition at line 129 of file World.h.

cChunkGeneratorThread& cWorld::GetGenerator ( void  )
inline

Definition at line 1042 of file World.h.

int cWorld::GetGeneratorQueueLength ( void  )
inline

Definition at line 949 of file World.h.

int cWorld::GetHeight ( int  a_BlockX,
int  a_BlockZ 
)
overridevirtual

Returns the world height at the specified coords; waits for the chunk to get loaded / generated.

Implements cWorldInterface.

Definition at line 2233 of file World.cpp.

const AString& cWorld::GetIniFileName ( void  ) const
inline

Returns the name of the world.ini file used by this world.

Definition at line 880 of file World.h.

bool cWorld::GetLargeTreeAdjustment ( int &  a_BlockX,
int &  a_BlockY,
int &  a_BlockZ,
NIBBLETYPE  a_SaplingMeta 
)
private

Checks if the sapling at the specified block coord is a part of a large-tree sapling (2x2).

If so, adjusts the X and Z coords so that they point to the northwest (XM ZM) corner of the sapling area and returns true. Returns false if not a part of large-tree sapling.

Definition at line 1631 of file World.cpp.

cFluidSimulator* cWorld::GetLavaSimulator ( void  )
inline

Definition at line 716 of file World.h.

size_t cWorld::GetLightingQueueLength ( void  )
inline

Definition at line 950 of file World.h.

cLightingThread& cWorld::GetLightingThread ( void  )
inline

Definition at line 954 of file World.h.

AString cWorld::GetLinkedEndWorldName ( void  ) const
inline

Definition at line 907 of file World.h.

AString cWorld::GetLinkedNetherWorldName ( void  ) const
inline

Definition at line 904 of file World.h.

AString cWorld::GetLinkedOverworldName ( void  ) const
inline

Definition at line 910 of file World.h.

cMapManager& cWorld::GetMapManager ( void  )
inline

Returns the associated map manager instance.

Definition at line 886 of file World.h.

int cWorld::GetMaxCactusHeight ( void  ) const
inline

Definition at line 1050 of file World.h.

virtual int cWorld::GetMaxNetherPortalHeight ( void  ) const
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 921 of file World.h.

virtual int cWorld::GetMaxNetherPortalWidth ( void  ) const
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 915 of file World.h.

int cWorld::GetMaxSugarcaneHeight ( void  ) const
inline

Definition at line 1049 of file World.h.

int cWorld::GetMaxViewDistance ( void  ) const
inline

Definition at line 894 of file World.h.

virtual int cWorld::GetMinNetherPortalHeight ( void  ) const
inlineoverridevirtual

Returns or sets the minumim or maximum netherportal height.

Implements cWorldInterface.

Definition at line 920 of file World.h.

virtual int cWorld::GetMinNetherPortalWidth ( void  ) const
inlineoverridevirtual

Returns or sets the minumim or maximum netherportal width.

Implements cWorldInterface.

Definition at line 914 of file World.h.

const AString& cWorld::GetName ( void  ) const
inline

Returns the name of the world.

Definition at line 874 of file World.h.

size_t cWorld::GetNumChunks ( void  ) const

Returns the number of chunks loaded.

Definition at line 3103 of file World.cpp.

size_t cWorld::GetNumUnusedDirtyChunks ( void  ) const

Returns the number of unused dirty chunks.

That's the number of chunks that we can save and then unload.

Definition at line 3112 of file World.cpp.

cRedstoneSimulator* cWorld::GetRedstoneSimulator ( void  )
inline

Definition at line 717 of file World.h.

cScoreboard& cWorld::GetScoreBoard ( void  )
inline

Returns the associated scoreboard instance.

Definition at line 883 of file World.h.

int cWorld::GetSeed ( void  )
inline

Returns the seed of the world.

Definition at line 1038 of file World.h.

bool cWorld::GetSignLines ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
AString a_Line1,
AString a_Line2,
AString a_Line3,
AString a_Line4 
)

Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found.

Definition at line 1549 of file World.cpp.

cSimulatorManager* cWorld::GetSimulatorManager ( void  )
inline

Definition at line 713 of file World.h.

NIBBLETYPE cWorld::GetSkyDarkness ( )
inline

Get the current darkness level based on the time.

Definition at line 1077 of file World.h.

double cWorld::GetSpawnX ( void  ) const
inline

Definition at line 691 of file World.h.

double cWorld::GetSpawnY ( void  ) const
inline

Definition at line 692 of file World.h.

double cWorld::GetSpawnZ ( void  ) const
inline

Definition at line 693 of file World.h.

cWorldStorage& cWorld::GetStorage ( void  )
inline

Definition at line 1043 of file World.h.

size_t cWorld::GetStorageLoadQueueLength ( void  )
inline

Definition at line 951 of file World.h.

size_t cWorld::GetStorageSaveQueueLength ( void  )
inline

Definition at line 952 of file World.h.

int cWorld::GetTickRandomNumber ( int  a_Range)

Returns a random number in range [0 .

. a_Range].

Definition at line 3271 of file World.cpp.

int cWorld::GetTicksUntilWeatherChange ( void  ) const
inline

Definition at line 97 of file World.h.

virtual int cWorld::GetTimeOfDay ( void  ) const
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 110 of file World.h.

eShrapnelLevel cWorld::GetTNTShrapnelLevel ( void  ) const
inline

Definition at line 891 of file World.h.

cFluidSimulator* cWorld::GetWaterSimulator ( void  )
inline

Definition at line 715 of file World.h.

eWeather cWorld::GetWeather ( void  ) const
inline

Returns the current weather.

Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible

Definition at line 991 of file World.h.

virtual Int64 cWorld::GetWorldAge ( void  ) const
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 109 of file World.h.

int cWorld::GrowCactus ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
int  a_NumBlocksToGrow 
)

Grows a cactus present at the block specified by the amount of blocks specified, up to the max height specified in the config; returns the amount of blocks the cactus grew inside this call.

Definition at line 1794 of file World.cpp.

bool cWorld::GrowMelonPumpkin ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType 
)

Grows a melon or a pumpkin next to the block specified (assumed to be the stem); returns true if the pumpkin or melon sucessfully grew.

Definition at line 1804 of file World.cpp.

int cWorld::GrowPlantAt ( Vector3i  a_BlockPos,
int  a_NumStages = 1 
)

Grows the plant at the specified position by at most a_NumStages.

The block's Grow handler is invoked. Returns the number of stages the plant has grown, 0 if not a plant.

Definition at line 1776 of file World.cpp.

bool cWorld::GrowRipePlant ( Vector3i  a_BlockPos)

Grows the plant at the specified block to its ripe stage.

Returns true if grown, false if not (invalid chunk, non-growable block, already ripe).

Definition at line 1785 of file World.cpp.

bool cWorld::GrowRipePlant ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
bool  a_IsByBonemeal = false 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Grows the plant at the specified block to its ripe stage. a_IsByBonemeal is obsolete, do not use. Returns true if grown, false if not (invalid chunk, non-growable block, already ripe).

Definition at line 842 of file World.h.

int cWorld::GrowSugarcane ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
int  a_NumBlocksToGrow 
)

Grows a sugarcane present at the block specified by the amount of blocks specified, up to the max height specified in the config; returns the amount of blocks the sugarcane grew inside this call.

Definition at line 1814 of file World.cpp.

bool cWorld::GrowTree ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Grows a tree at the specified coords.

If the specified block is a sapling, the tree is grown from that sapling. Otherwise a tree is grown based on the biome. Returns true if the tree was grown, false if not (invalid chunk, insufficient space).

Definition at line 1576 of file World.cpp.

bool cWorld::GrowTreeByBiome ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Grows a tree at the specified coords, based on the biome in the place.

Returns true if the tree was grown, false if not (invalid chunk, insufficient space).

Definition at line 1717 of file World.cpp.

bool cWorld::GrowTreeFromSapling ( Vector3i  a_BlockPos,
NIBBLETYPE  a_SaplingMeta 
)
inline

Grows a tree at the specified coords, based on the sapling meta provided.

Returns true if the tree was grown, false if not (invalid chunk, insufficient space).

Definition at line 814 of file World.h.

bool cWorld::GrowTreeFromSapling ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_SaplingMeta 
)

OBSOLETE, use the Vector3-based overload instead.

Grows a tree at the specified coords, based on the sapling meta provided. Returns true if the tree was grown, false if not (invalid chunk, insufficient space).

Definition at line 1594 of file World.cpp.

bool cWorld::GrowTreeImage ( const sSetBlockVector a_Blocks)

Imprints the specified blocks into the world, as long as each log block replaces only allowed blocks.

a_Blocks specifies the logs, leaves, vines and possibly other blocks that comprise a single tree. Returns true if the tree is imprinted successfully, false otherwise.

Definition at line 1731 of file World.cpp.

bool cWorld::HasChunkAnyClients ( int  a_ChunkX,
int  a_ChunkZ 
) const

Definition at line 2410 of file World.cpp.

bool cWorld::HasEntity ( UInt32  a_UniqueID)

Returns true if an entity with the specified UniqueID exists in the world.

Note: Only loaded chunks are considered.

Definition at line 3046 of file World.cpp.

void cWorld::InitializeAndLoadMobSpawningValues ( cIniFile a_IniFile)
private

Sets mob spawning values if nonexistant to their dimension specific defaults.

Definition at line 887 of file World.cpp.

cFluidSimulator * cWorld::InitializeFluidSimulator ( cIniFile a_IniFile,
const char *  a_FluidName,
BLOCKTYPE  a_SimulateBlock,
BLOCKTYPE  a_StationaryBlock 
)
private

Creates a new fluid simulator, loads its settings from the inifile (a_FluidName section)

Definition at line 3378 of file World.cpp.

cRedstoneSimulator * cWorld::InitializeRedstoneSimulator ( cIniFile a_IniFile)
private

Creates a new redstone simulator.

Definition at line 3343 of file World.cpp.

void cWorld::InitializeSpawn ( void  )

Definition at line 625 of file World.cpp.

bool cWorld::IsBlockDirectlyWatered ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Definition at line 3176 of file World.cpp.

bool cWorld::IsChunkLighted ( int  a_ChunkX,
int  a_ChunkZ 
)

Definition at line 2961 of file World.cpp.

bool cWorld::IsChunkQueued ( int  a_ChunkX,
int  a_ChunkZ 
) const

Returns true iff the chunk is in the loader / generator queue.

Definition at line 2392 of file World.cpp.

bool cWorld::IsChunkValid ( int  a_ChunkX,
int  a_ChunkZ 
) const

Returns true iff the chunk is present and valid.

Definition at line 2401 of file World.cpp.

virtual bool cWorld::IsDaylightCycleEnabled ( void  ) const
inlinevirtual

Is the daylight cycle enabled?

Definition at line 100 of file World.h.

bool cWorld::IsDeepSnowEnabled ( void  ) const
inline

Definition at line 145 of file World.h.

bool cWorld::IsGameModeAdventure ( void  ) const
inline

Returns true if the world is in Adventure mode.

Definition at line 138 of file World.h.

bool cWorld::IsGameModeCreative ( void  ) const
inline

Returns true if the world is in Creative mode.

Definition at line 132 of file World.h.

bool cWorld::IsGameModeSpectator ( void  ) const
inline

Returns true if the world is in Spectator mode.

Definition at line 141 of file World.h.

bool cWorld::IsGameModeSurvival ( void  ) const
inline

Returns true if the world is in Survival mode.

Definition at line 135 of file World.h.

bool cWorld::IsPVPEnabled ( void  ) const
inline

Definition at line 143 of file World.h.

bool cWorld::IsSavingEnabled ( void  ) const
inline

Get whether saving chunks is enabled.

Definition at line 92 of file World.h.

bool cWorld::IsTrapdoorOpen ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Is the trapdoor open? Returns false if there is no trapdoor at the specified coords.

Definition at line 2891 of file World.cpp.

bool cWorld::IsWeatherRain ( void  ) const
inline

Returns true if the current weather is rainy.

Definition at line 1003 of file World.h.

bool cWorld::IsWeatherRainAt ( int  a_BlockX,
int  a_BlockZ 
)
inline

Returns true if it is raining at the specified location.

This takes into account biomes.

Definition at line 1006 of file World.h.

bool cWorld::IsWeatherStorm ( void  ) const
inline

Returns true if the current weather is stormy.

Definition at line 1012 of file World.h.

bool cWorld::IsWeatherStormAt ( int  a_BlockX,
int  a_BlockZ 
)
inline

Returns true if the weather is stormy at the specified location.

This takes into account biomes.

Definition at line 1015 of file World.h.

bool cWorld::IsWeatherSunny ( void  ) const
inline

Returns true if the current weather is sunny.

Definition at line 994 of file World.h.

bool cWorld::IsWeatherSunnyAt ( int  a_BlockX,
int  a_BlockZ 
)
inline

Returns true if it is sunny at the specified location.

This takes into account biomes.

Definition at line 997 of file World.h.

bool cWorld::IsWeatherWet ( void  ) const
inline

Returns true if the world currently has any precipitation - rain, storm or snow.

Definition at line 1021 of file World.h.

virtual bool cWorld::IsWeatherWetAt ( int  a_BlockX,
int  a_BlockZ 
)
inlineoverridevirtual

Returns true if it is raining or storming at the specified location.

This takes into account biomes.

Implements cWorldInterface.

Definition at line 1025 of file World.h.

bool cWorld::IsWeatherWetAtXYZ ( Vector3i  a_Pos)
virtual

Returns true if the specified location has wet weather (rain or storm), using the same logic as IsWeatherWetAt, except that any rain-blocking blocks above the specified position will block the precipitation and this function will return false.

Definition at line 561 of file World.cpp.

void cWorld::MarkChunkDirty ( int  a_ChunkX,
int  a_ChunkZ 
)

Definition at line 2260 of file World.cpp.

void cWorld::MarkChunkSaved ( int  a_ChunkX,
int  a_ChunkZ 
)

Definition at line 2278 of file World.cpp.

void cWorld::MarkChunkSaving ( int  a_ChunkX,
int  a_ChunkZ 
)

Definition at line 2269 of file World.cpp.

cItems cWorld::PickupsFromBlock ( Vector3i  a_BlockPos,
const cEntity a_Digger = nullptr,
const cItem a_Tool = nullptr 
)

Returns all the pickups that would result if the a_Digger dug up the block at a_BlockPos using a_Tool a_Digger is usually a player, but can be nullptr for natural causes.

a_Tool is an optional item used to dig up the block, used by the handlers (empty hand vs shears produce different pickups from leaves). An empty hand is assumed if a_Tool is nullptr. Returns an empty cItems object if the chunk is not present.

Definition at line 2215 of file World.cpp.

void cWorld::PrepareChunk ( int  a_ChunkX,
int  a_ChunkZ,
std::unique_ptr< cChunkCoordCallback a_CallAfter = {} 
)

Queues the chunk for preparing - making sure that it's generated and lit.

The specified chunk is queued to be loaded or generated, and lit if needed. The specified callback is called after the chunk has been prepared. If there's no preparation to do, only the callback is called. It is legal to call with no callback.

Definition at line 2834 of file World.cpp.

void cWorld::QueueBlockForTick ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
int  a_TicksToWait 
)

Queues the block to be ticked after the specified number of game ticks.

Definition at line 3161 of file World.cpp.

void cWorld::QueueLightChunk ( int  a_ChunkX,
int  a_ChunkZ,
std::unique_ptr< cChunkCoordCallback a_Callback = {} 
)

Queues a chunk for lighting; a_Callback is called after the chunk is lighted.

Definition at line 2952 of file World.cpp.

void cWorld::QueueSaveAllChunks ( void  )

Queues a task to save all chunks onto the tick thread.

The prefferred way of saving chunks from external sources

Definition at line 3001 of file World.cpp.

void cWorld::QueueSetChunkData ( cSetChunkDataPtr  a_SetChunkData)

Puts the chunk data into a queue to be set into the chunkmap in the tick thread.

If the chunk data doesn't contain valid biomes, the biomes are calculated before adding the data into the queue.

Definition at line 2287 of file World.cpp.

void cWorld::QueueTask ( std::function< void(cWorld &)>  a_Task)

Queues a task onto the tick thread.

The task object will be deleted once the task is finished

Definition at line 3010 of file World.cpp.

void cWorld::QueueUnloadUnusedChunks ( void  )

Queues a task to unload unused chunks onto the tick thread.

The prefferred way of unloading.

Definition at line 2429 of file World.cpp.

void cWorld::RegenerateChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Regenerate the given chunk:

Definition at line 2932 of file World.cpp.

void cWorld::RemoveChunkClient ( int  a_ChunkX,
int  a_ChunkZ,
cClientHandle a_Client 
)

Removes client from the chunk specified.

Definition at line 2779 of file World.cpp.

void cWorld::RemoveClientFromChunks ( cClientHandle a_Client)

Removes the client from all chunks it is present in.

Definition at line 2788 of file World.cpp.

void cWorld::RemoveClientFromChunkSender ( cClientHandle a_Client)

Removes client from ChunkSender's queue of chunks to be sent.

Definition at line 2816 of file World.cpp.

OwnedEntity cWorld::RemoveEntity ( cEntity a_Entity)

Removes the entity from the world.

Returns an owning reference to the found entity.

Definition at line 3073 of file World.cpp.

std::unique_ptr< cPlayer > cWorld::RemovePlayer ( cPlayer a_Player,
bool  a_RemoveFromChunk 
)

Removes the player from the world.

Removes the player from the addition queue, too, if appropriate. If the player has a ClientHandle, the ClientHandle is removed from all chunks in the world and will not be ticked by this world anymore.

Parameters
a_RemoveFromChunkdetermines if the entity should be removed from its chunk as well. Should be false when ticking from cChunk.
Returns
An owning reference to the given player.

Definition at line 2457 of file World.cpp.

void cWorld::ReplaceBlocks ( const sSetBlockVector a_Blocks,
BLOCKTYPE  a_FilterBlockType 
)

Replaces world blocks with a_Blocks, if they are of type a_FilterBlockType.

Definition at line 2162 of file World.cpp.

void cWorld::SaveAllChunks ( void  )

Saves all chunks immediately.

Dangerous interface, may deadlock, use QueueSaveAllChunks() instead

Definition at line 2988 of file World.cpp.

void cWorld::ScheduleTask ( int  a_DelayTicks,
std::function< void(cWorld &)>  a_Task 
)

Queues a lambda task onto the tick thread, with the specified delay.

Definition at line 3020 of file World.cpp.

void cWorld::SendBlockEntity ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cClientHandle a_Client 
)

If there is a block entity at the specified coords, sends it to the client specified.

Definition at line 2251 of file World.cpp.

void cWorld::SendBlockTo ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
cPlayer a_Player 
)
overridevirtual

Sends the block on those coords to the player.

Implements cWorldInterface.

Definition at line 2224 of file World.cpp.

void cWorld::SendChunkTo ( int  a_ChunkX,
int  a_ChunkZ,
cChunkSender::eChunkPriority  a_Priority,
cClientHandle a_Client 
)

Sends the chunk to the client specified, if the client doesn't have the chunk yet.

If chunk not valid, the request is postponed (ChunkSender will send that chunk when it becomes valid + lighted).

Definition at line 2797 of file World.cpp.

void cWorld::SendPlayerList ( cPlayer a_DestPlayer)

Definition at line 2693 of file World.cpp.

bool cWorld::SetAreaBiome ( int  a_MinX,
int  a_MaxX,
int  a_MinZ,
int  a_MaxZ,
EMCSBiome  a_Biome 
)

Sets the biome at the area.

Returns true if successful, false if any subarea failed (chunk not loaded). (Re)sends the chunks to their relevant clients if successful.

Definition at line 1842 of file World.cpp.

bool cWorld::SetAreaBiome ( const cCuboid a_Area,
EMCSBiome  a_Biome 
)

Sets the biome at the area.

Returns true if successful, false if any subarea failed (chunk not loaded). (Re)sends the chunks to their relevant clients if successful. The cuboid needn't be sorted.

Definition at line 1851 of file World.cpp.

bool cWorld::SetBiomeAt ( int  a_BlockX,
int  a_BlockZ,
EMCSBiome  a_Biome 
)

Sets the biome at the specified coords.

Returns true if successful, false if not (chunk not loaded). Doesn't resend the chunk to clients, use ForceSendChunkTo() for that.

Definition at line 1833 of file World.cpp.

void cWorld::SetBlock ( Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Sets the block at the specified coords to the specified value.

Full processing, incl. updating neighbors, is performed.

Definition at line 1873 of file World.cpp.

void cWorld::SetBlock ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Sets the block at the specified coords to the specified value. Full processing, incl. updating neighbors, is performed.

Definition at line 392 of file World.h.

void cWorld::SetBlockMeta ( Vector3i  a_BlockPos,
NIBBLETYPE  a_MetaData,
bool  a_ShouldMarkDirty = true,
bool  a_ShouldInformClients = true 
)

Sets the meta for the specified block, while keeping the blocktype.

If a_ShouldMarkDirty is true, the chunk is marked dirty by this change (false is used eg. by water turning still). If a_ShouldInformClients is true, the change is broadcast to all clients of the chunk. Ignored if the chunk is invalid.

Definition at line 1882 of file World.cpp.

void cWorld::SetBlockMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_MetaData,
bool  a_ShouldMarkDirty = true,
bool  a_ShouldInformClients = true 
)
inline

OBSOLETE, use the Vector3-based overload instead.

Sets the meta for the specified block, while keeping the blocktype. If a_ShouldMarkDirty is true, the chunk is marked dirty by this change (false is used eg. by water turning still). If a_ShouldInformClients is true, the change is broadcast to all clients of the chunk. Ignored if the chunk is invalid.

Definition at line 455 of file World.h.

void cWorld::SetBlocks ( const sSetBlockVector a_Blocks)

Performs the specified single-block set operations simultaneously, as if SetBlock() was called for each item.

Is more efficient than calling SetBlock() multiple times. If the chunk for any of the blocks is not loaded, the set operation is ignored silently.

Definition at line 2153 of file World.cpp.

void cWorld::SetChunkAlwaysTicked ( int  a_ChunkX,
int  a_ChunkZ,
bool  a_AlwaysTicked = true 
)

Increments (a_AlwaysTicked == true) or decrements (false) the m_AlwaysTicked counter for the specified chunk.

If the m_AlwaysTicked counter is greater than zero, the chunk is ticked in the tick-thread regardless of whether it has any clients or not. This function allows nesting and task-concurrency (multiple separate tasks can request ticking and as long as at least one requests is active the chunk will be ticked).

Definition at line 3334 of file World.cpp.

void cWorld::SetChunkData ( cSetChunkData a_SetChunkData)
private

Sets the specified chunk data into the chunkmap.

Called in the tick thread. Modifies the a_SetChunkData - moves the entities contained in it into the chunk.

Definition at line 2313 of file World.cpp.

bool cWorld::SetCommandBlockCommand ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
const AString a_Command 
)

Sets the command block command.

Returns true if command changed.

Definition at line 2877 of file World.cpp.

void cWorld::SetCommandBlocksEnabled ( bool  a_Flag)
inline

Definition at line 889 of file World.h.

virtual void cWorld::SetDaylightCycleEnabled ( bool  a_IsDaylightCycleEnabled)
inlinevirtual

Sets the daylight cycle to true / false.

Definition at line 103 of file World.h.

void cWorld::SetLinkedEndWorldName ( const AString a_Name)
inline

Definition at line 908 of file World.h.

void cWorld::SetLinkedNetherWorldName ( const AString a_Name)
inline

Definition at line 905 of file World.h.

void cWorld::SetLinkedOverworldName ( const AString a_Name)
inline

Definition at line 911 of file World.h.

virtual void cWorld::SetMaxNetherPortalHeight ( int  a_NewMaxHeight)
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 923 of file World.h.

virtual void cWorld::SetMaxNetherPortalWidth ( int  a_NewMaxWidth)
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 917 of file World.h.

void cWorld::SetMaxViewDistance ( int  a_MaxViewDistance)

Definition at line 1864 of file World.cpp.

virtual void cWorld::SetMinNetherPortalHeight ( int  a_NewMinHeight)
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 922 of file World.h.

virtual void cWorld::SetMinNetherPortalWidth ( int  a_NewMinWidth)
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 916 of file World.h.

void cWorld::SetNextBlockTick ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Sets the blockticking to start at the specified block.

Only one blocktick per chunk may be set, second call overwrites the first call

Definition at line 589 of file World.cpp.

void cWorld::SetSavingEnabled ( bool  a_IsSavingEnabled)
inline

Set whether saving chunks is enabled.

Definition at line 95 of file World.h.

void cWorld::SetShouldUseChatPrefixes ( bool  a_Flag)
inline

Definition at line 898 of file World.h.

bool cWorld::SetSignLines ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
const AString a_Line1,
const AString a_Line2,
const AString a_Line3,
const AString a_Line4,
cPlayer a_Player = nullptr 
)

Sets the sign text, asking plugins for permission first.

a_Player is the player who this change belongs to, may be nullptr. Returns true if sign text changed.

Definition at line 2852 of file World.cpp.

bool cWorld::SetSpawn ( double  a_X,
double  a_Y,
double  a_Z 
)

Set default spawn at the given coordinates.

Returns false if the new spawn couldn't be stored in the INI file.

Definition at line 598 of file World.cpp.

void cWorld::SetTicksUntilWeatherChange ( int  a_WeatherInterval)
inline

Definition at line 112 of file World.h.

virtual void cWorld::SetTimeOfDay ( int  a_TimeOfDay)
inlineoverridevirtual

Implements cWorldInterface.

Definition at line 117 of file World.h.

void cWorld::SetTNTShrapnelLevel ( eShrapnelLevel  a_Flag)
inline

Definition at line 892 of file World.h.

bool cWorld::SetTrapdoorOpen ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
bool  a_Open 
)

Set the state of a trapdoor.

Returns true if the trapdoor was updated, false if there was no trapdoor at those coords.

Definition at line 2908 of file World.cpp.

void cWorld::SetWeather ( eWeather  a_NewWeather)

Sets the specified weather; resets weather interval; asks and notifies plugins of the change.

Definition at line 522 of file World.cpp.

bool cWorld::ShouldBroadcastAchievementMessages ( void  ) const
inline

Definition at line 901 of file World.h.

bool cWorld::ShouldBroadcastDeathMessages ( void  ) const
inline

Definition at line 900 of file World.h.

bool cWorld::ShouldLavaSpawnFire ( void  ) const
inline

Definition at line 147 of file World.h.

bool cWorld::ShouldUseChatPrefixes ( void  ) const
inline

Definition at line 897 of file World.h.

UInt32 cWorld::SpawnBoat ( double  a_X,
double  a_Y,
double  a_Z,
cBoat::eMaterial  a_Material 
)
inline

Definition at line 590 of file World.h.

UInt32 cWorld::SpawnBoat ( Vector3d  a_Pos,
cBoat::eMaterial  a_Material 
)

Spawns a boat at the given coordinates.

Returns the UniqueID of the spawned boat, or cEntity::INVALID_ID on failure.

Definition at line 2116 of file World.cpp.

UInt32 cWorld::SpawnExperienceOrb ( Vector3d  a_Pos,
int  a_Reward 
)

Spawns an experience orb at the given location with the given reward.

Returns the UniqueID of the spawned experience orb, or cEntity::INVALID_ID on failure.

Definition at line 2024 of file World.cpp.

virtual UInt32 cWorld::SpawnExperienceOrb ( double  a_X,
double  a_Y,
double  a_Z,
int  a_Reward 
)
inlineoverridevirtual

OBSOLETE, use the Vector3d-based overload instead.

Spawns an experience orb at the given location with the given reward. Returns the UniqueID of the spawned experience orb, or cEntity::INVALID_ID on failure.

Implements cWorldInterface.

Definition at line 607 of file World.h.

UInt32 cWorld::SpawnFallingBlock ( Vector3i  a_Pos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Spawns an falling block entity at the given position.

Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure.

Definition at line 2008 of file World.cpp.

UInt32 cWorld::SpawnFallingBlock ( int  a_X,
int  a_Y,
int  a_Z,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inline

OBSOLETE, use the Vector3i-based overload instead.

Spawns an falling block entity at the given position. Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure.

Definition at line 572 of file World.h.

UInt32 cWorld::SpawnItemPickup ( Vector3d  a_Pos,
const cItem a_Item,
Vector3f  a_Speed,
int  a_LifetimeTicks = 6000,
bool  a_CanCombine = true 
)

Spawns a single pickup containing the specified item.

Definition at line 1993 of file World.cpp.

virtual UInt32 cWorld::SpawnItemPickup ( double  a_PosX,
double  a_PosY,
double  a_PosZ,
const cItem a_Item,
float  a_SpeedX = 0.f,
float  a_SpeedY = 0.f,
float  a_SpeedZ = 0.f,
int  a_LifetimeTicks = 6000,
bool  a_CanCombine = true 
)
inlineoverridevirtual

OBSOLETE, use the Vector3d-based overload instead.

Spawns a single pickup containing the specified item.

Implements cWorldInterface.

Definition at line 560 of file World.h.

void cWorld::SpawnItemPickups ( const cItems a_Pickups,
Vector3i  a_BlockPos,
double  a_FlyAwaySpeed = 1.0,
bool  a_IsPlayerCreated = false 
)

Spawns item pickups for each item in the list.

The initial position of the pickups is at the center of the specified block, with a small random offset. May compress pickups if too many entities.

Definition at line 1936 of file World.cpp.

void cWorld::SpawnItemPickups ( const cItems a_Pickups,
Vector3d  a_Pos,
double  a_FlyAwaySpeed = 1.0,
bool  a_IsPlayerCreated = false 
)

Spawns item pickups for each item in the list.

May compress pickups if too many entities.

Definition at line 1948 of file World.cpp.

virtual void cWorld::SpawnItemPickups ( const cItems a_Pickups,
double  a_BlockX,
double  a_BlockY,
double  a_BlockZ,
double  a_FlyAwaySpeed = 1.0,
bool  a_IsPlayerCreated = false 
)
inlineoverridevirtual

OBSOLETE, use the Vector3d-based overload instead.

Spawns item pickups for each item in the list. May compress pickups if too many entities.

Implements cWorldInterface.

Definition at line 540 of file World.h.

void cWorld::SpawnItemPickups ( const cItems a_Pickups,
Vector3d  a_Pos,
Vector3d  a_Speed,
bool  a_IsPlayerCreated = false 
)

Spawns item pickups for each item in the list.

May compress pickups if too many entities. All pickups get the speed specified.

Definition at line 1974 of file World.cpp.

virtual void cWorld::SpawnItemPickups ( const cItems a_Pickups,
double  a_BlockX,
double  a_BlockY,
double  a_BlockZ,
double  a_SpeedX,
double  a_SpeedY,
double  a_SpeedZ,
bool  a_IsPlayerCreated = false 
)
inlineoverridevirtual

OBSOLETE, use the Vector3d-based overload instead.

Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified.

Implements cWorldInterface.

Definition at line 550 of file World.h.

UInt32 cWorld::SpawnMinecart ( Vector3d  a_Pos,
int  a_MinecartType,
const cItem a_Content = cItem(),
int  a_BlockHeight = 1 
)

Spawns an minecart at the given coordinates.

Returns the UniqueID of the spawned minecart, or cEntity::INVALID_ID on failure.

Definition at line 2088 of file World.cpp.

UInt32 cWorld::SpawnMinecart ( double  a_X,
double  a_Y,
double  a_Z,
int  a_MinecartType,
const cItem a_Content = cItem(),
int  a_BlockHeight = 1 
)
inline

OBSOLETE, use the Vector3d-based overload instead.

Spawns an minecart at the given coordinates. Returns the UniqueID of the spawned minecart, or cEntity::INVALID_ID on failure.

Definition at line 584 of file World.h.

UInt32 cWorld::SpawnMob ( double  a_PosX,
double  a_PosY,
double  a_PosZ,
eMonsterType  a_MonsterType,
bool  a_Baby = false 
)
overridevirtual

Spawns a mob of the specified type.

Returns the mob's UniqueID if recognized and spawned, cEntity::INVALID_ID otherwise

Implements cWorldInterface.

Definition at line 3190 of file World.cpp.

UInt32 cWorld::SpawnMobFinalize ( std::unique_ptr< cMonster a_Monster)

Wraps cEntity::Initialize, doing Monster-specific things before spawning the monster.

Takes ownership of the given Monster reference.

Definition at line 3211 of file World.cpp.

UInt32 cWorld::SpawnPrimedTNT ( double  a_X,
double  a_Y,
double  a_Z,
int  a_FuseTimeInSec = 80,
double  a_InitialVelocityCoeff = 1 
)
inline

Definition at line 629 of file World.h.

UInt32 cWorld::SpawnPrimedTNT ( Vector3d  a_Pos,
int  a_FuseTimeInSec = 80,
double  a_InitialVelocityCoeff = 1 
)

Spawns a new primed TNT entity at the specified block coords and specified fuse duration.

Initial velocity is given based on the relative coefficient provided. Returns the UniqueID of the created entity, or cEntity::INVALID_ID on failure.

Definition at line 2131 of file World.cpp.

std::vector< UInt32 > cWorld::SpawnSplitExperienceOrbs ( Vector3d  a_Pos,
int  a_Reward 
)
overridevirtual

Spawns experience orbs of the specified total value at the given location.

The orbs' values are split according to regular Minecraft rules. Returns an vector of UniqueID of all the orbs.

Implements cWorldInterface.

Definition at line 2045 of file World.cpp.

std::vector<UInt32> cWorld::SpawnSplitExperienceOrbs ( double  a_X,
double  a_Y,
double  a_Z,
int  a_Reward 
)
inline

OBSOLETE, use the Vector3d-based overload instead.

Spawns experience orbs of the specified total value at the given location. The orbs' values are split according to regular Minecraft rules. Returns an vector of UniqueID of all the orbs.

Definition at line 621 of file World.h.

void cWorld::Start ( void  )

Starts threads that belong to this world.

Definition at line 654 of file World.cpp.

void cWorld::Stop ( cDeadlockDetect a_DeadlockDetect)

Stops threads that belong to this world (part of deinit).

a_DeadlockDetect is used for tracking this world's age, detecting a possible deadlock.

Definition at line 926 of file World.cpp.

void cWorld::TabCompleteUserName ( const AString a_Text,
AStringVector a_Results 
)

Appends all usernames starting with a_Text (case-insensitive) into Results.

Definition at line 3280 of file World.cpp.

void cWorld::Tick ( std::chrono::milliseconds  a_Dt,
std::chrono::milliseconds  a_LastTickDurationMSec 
)
private

Definition at line 975 of file World.cpp.

void cWorld::TickClients ( float  a_Dt)
private

Ticks all clients that are in this world.

Definition at line 1232 of file World.cpp.

void cWorld::TickMobs ( std::chrono::milliseconds  a_Dt)
private

Handles the mob spawning / moving / destroying each tick.

Definition at line 1103 of file World.cpp.

void cWorld::TickQueuedBlocks ( void  )

Processes the blocks queued for ticking with a delay (m_BlockTickQueue[])

Definition at line 3131 of file World.cpp.

void cWorld::TickQueuedTasks ( void  )
private

Executes all tasks queued onto the tick thread.

Definition at line 1190 of file World.cpp.

void cWorld::TickWeather ( float  a_Dt)
private

Handles the weather in each tick.

Definition at line 1069 of file World.cpp.

void cWorld::TouchChunk ( int  a_ChunkX,
int  a_ChunkZ 
)

Touches the chunk, causing it to be loaded or generated.

Definition at line 2825 of file World.cpp.

bool cWorld::TryGetHeight ( int  a_BlockX,
int  a_BlockZ,
int &  a_Height 
)

Retrieves the world height at the specified coords; returns false if chunk not loaded / generated.

Definition at line 2242 of file World.cpp.

void cWorld::UnloadUnusedChunks ( void  )
private

Unloads all chunks immediately.

Definition at line 2419 of file World.cpp.

void cWorld::UpdateSkyDarkness ( void  )
private

Definition at line 1283 of file World.cpp.

void cWorld::UseBlockEntity ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

a_Player is using block entity at [x, y, z], handle that:

Definition at line 789 of file World.h.

bool cWorld::VillagersShouldHarvestCrops ( void  ) const
inline

Definition at line 149 of file World.h.

void cWorld::WakeUpSimulators ( Vector3i  a_Block)
overridevirtual

Wakes up the simulators for the specified block.

Implements cWorldInterface.

Definition at line 1308 of file World.cpp.

void cWorld::WakeUpSimulators ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

Definition at line 702 of file World.h.

void cWorld::WakeUpSimulatorsInArea ( const cCuboid a_Area)

Wakes up the simulators for the specified area of blocks.

Definition at line 1327 of file World.cpp.

void cWorld::WakeUpSimulatorsInArea ( int  a_MinBlockX,
int  a_MaxBlockX,
int  a_MinBlockY,
int  a_MaxBlockY,
int  a_MinBlockZ,
int  a_MaxBlockZ 
)

Definition at line 1317 of file World.cpp.

bool cWorld::WriteBlockArea ( cBlockArea a_Area,
int  a_MinBlockX,
int  a_MinBlockY,
int  a_MinBlockZ,
int  a_DataTypes 
)
overridevirtual

Writes the block area into the specified coords.

Returns true if all chunks have been processed. Prefer cBlockArea::Write() instead, this is the internal implementation; cBlockArea does error checking, too. a_DataTypes is a bitmask of cBlockArea::baXXX constants ORed together. Doesn't wake up simulators, use WakeUpSimulatorsInArea() for that.

Implements cForEachChunkProvider.

Definition at line 1927 of file World.cpp.

Friends And Related Function Documentation

friend class cRoot
friend

Definition at line 1088 of file World.h.

Member Data Documentation

std::set<eMonsterType> cWorld::m_AllowedMobs
private

Definition at line 1207 of file World.h.

bool cWorld::m_bAnimals
private

Definition at line 1206 of file World.h.

bool cWorld::m_bCommandBlocksEnabled
private

Whether command blocks are enabled or not.

Definition at line 1233 of file World.h.

bool cWorld::m_bEnabledPVP
private

Definition at line 1182 of file World.h.

std::vector<BlockTickQueueItem *> cWorld::m_BlockTickQueue
private

Definition at line 1187 of file World.h.

std::vector<BlockTickQueueItem *> cWorld::m_BlockTickQueueCopy
private

Definition at line 1188 of file World.h.

bool cWorld::m_BroadcastAchievementMessages
private

Definition at line 1165 of file World.h.

bool cWorld::m_BroadcastDeathMessages
private

Definition at line 1164 of file World.h.

bool cWorld::m_bUseChatPrefixes
private

Whether prefixes such as [INFO] are prepended to SendMessageXXX() / BroadcastChatXXX() functions.

Definition at line 1236 of file World.h.

std::unique_ptr<cChunkMap> cWorld::m_ChunkMap
private

Definition at line 1204 of file World.h.

cChunkSender cWorld::m_ChunkSender
private

Definition at line 1263 of file World.h.

cClientHandlePtrs cWorld::m_Clients
private

List of clients in this world, these will be ticked by this world.

Definition at line 1277 of file World.h.

cClientHandlePtrs cWorld::m_ClientsToAdd
private

Clients that are scheduled for adding, waiting for TickClients to add them.

Definition at line 1283 of file World.h.

cClientHandles cWorld::m_ClientsToRemove
private

Clients that are scheduled for removal (ticked in another world), waiting for TickClients() to remove them.

Definition at line 1280 of file World.h.

cCriticalSection cWorld::m_CSClients
private

Guards m_Clients.

Definition at line 1274 of file World.h.

cCriticalSection cWorld::m_CSEntitiesToAdd
private

Guards m_EntitiesToAdd.

Definition at line 1286 of file World.h.

cCriticalSection cWorld::m_CSPlayers
private

Definition at line 1197 of file World.h.

cCriticalSection cWorld::m_CSPlayersToAdd
private

Guards m_PlayersToAdd.

Definition at line 1292 of file World.h.

cCriticalSection cWorld::m_CSSetChunkDataQueue
private

CS protecting m_SetChunkDataQueue.

Definition at line 1298 of file World.h.

cCriticalSection cWorld::m_CSTasks
private

Guards the m_Tasks.

Definition at line 1268 of file World.h.

AString cWorld::m_DataPath
private

The path to the root directory for the world files.

Does not including trailing path specifier.

Definition at line 1134 of file World.h.

eDimension cWorld::m_Dimension
private

The dimension of the world, used by the client to provide correct lighting scheme.

Definition at line 1151 of file World.h.

cEntityList cWorld::m_EntitiesToAdd
private

List of entities that are scheduled for adding, waiting for the Tick thread to add them.

Definition at line 1289 of file World.h.

std::unique_ptr<cFireSimulator> cWorld::m_FireSimulator
private

Definition at line 1194 of file World.h.

eGameMode cWorld::m_GameMode
private

Definition at line 1181 of file World.h.

cChunkGeneratorThread cWorld::m_Generator
private

The thread responsible for generating chunks.

Definition at line 1255 of file World.h.

cChunkGeneratorCallbacks cWorld::m_GeneratorCallbacks
private

The callbacks that the ChunkGenerator uses to store new chunks and interface to plugins.

Definition at line 1261 of file World.h.

AString cWorld::m_IniFileName
private

Definition at line 1140 of file World.h.

bool cWorld::m_IsBeetrootsBonemealable
private

Definition at line 1217 of file World.h.

bool cWorld::m_IsBigFlowerBonemealable
private

Definition at line 1229 of file World.h.

bool cWorld::m_IsCactusBonemealable
private

Definition at line 1218 of file World.h.

bool cWorld::m_IsCarrotsBonemealable
private

Definition at line 1219 of file World.h.

bool cWorld::m_IsCropsBonemealable
private

Definition at line 1220 of file World.h.

bool cWorld::m_IsDaylightCycleEnabled
private

Definition at line 1167 of file World.h.

bool cWorld::m_IsDeepSnowEnabled
private

Definition at line 1183 of file World.h.

bool cWorld::m_IsGrassBonemealable
private

Definition at line 1221 of file World.h.

bool cWorld::m_IsMelonBonemealable
private

Definition at line 1223 of file World.h.

bool cWorld::m_IsMelonStemBonemealable
private

Definition at line 1222 of file World.h.

bool cWorld::m_IsPotatoesBonemealable
private

Definition at line 1224 of file World.h.

bool cWorld::m_IsPumpkinBonemealable
private

Definition at line 1226 of file World.h.

bool cWorld::m_IsPumpkinStemBonemealable
private

Definition at line 1225 of file World.h.

bool cWorld::m_IsSaplingBonemealable
private

Definition at line 1227 of file World.h.

std::atomic<bool> cWorld::m_IsSavingEnabled
private

Whether or not writing chunks to disk is currently enabled.

Definition at line 1148 of file World.h.

bool cWorld::m_IsSpawnExplicitlySet
private

Definition at line 1153 of file World.h.

bool cWorld::m_IsSugarcaneBonemealable
private

Definition at line 1228 of file World.h.

bool cWorld::m_IsTallGrassBonemealable
private

Definition at line 1230 of file World.h.

cTickTimeLong cWorld::m_LastChunkCheck
private

Definition at line 1175 of file World.h.

cTickTimeLong cWorld::m_LastSave
private

Definition at line 1176 of file World.h.

std::map<cMonster::eFamily, cTickTimeLong> cWorld::m_LastSpawnMonster
private

Definition at line 1177 of file World.h.

cTickTimeLong cWorld::m_LastTimeUpdate
private

Definition at line 1174 of file World.h.

cFluidSimulator* cWorld::m_LavaSimulator
private

Definition at line 1193 of file World.h.

cLightingThread cWorld::m_Lighting
private

Definition at line 1264 of file World.h.

AString cWorld::m_LinkedEndWorldName
private

Name of the End world - where End portals should teleport.

Only used when this world is an Overworld.

Definition at line 1252 of file World.h.

AString cWorld::m_LinkedNetherWorldName
private

Name of the nether world - where Nether portals should teleport.

Only used when this world is an Overworld.

Definition at line 1248 of file World.h.

AString cWorld::m_LinkedOverworldName
private

The name of the overworld that portals in this world should link to.

Only has effect if this world is a Nether or End world.

Definition at line 1138 of file World.h.

cMapManager cWorld::m_MapManager
private

Definition at line 1258 of file World.h.

int cWorld::m_MaxCactusHeight
private

Definition at line 1215 of file World.h.

int cWorld::m_MaxNetherPortalHeight
private

Definition at line 1162 of file World.h.

int cWorld::m_MaxNetherPortalWidth
private

Definition at line 1160 of file World.h.

unsigned int cWorld::m_MaxPlayers
private

Definition at line 1202 of file World.h.

int cWorld::m_MaxRainTicks
private

Definition at line 1212 of file World.h.

int cWorld::m_MaxSugarcaneHeight
private

Definition at line 1216 of file World.h.

int cWorld::m_MaxSunnyTicks
private

Definition at line 1211 of file World.h.

int cWorld::m_MaxThunderStormTicks
private

Definition at line 1213 of file World.h.

int cWorld::m_MaxViewDistance
private

The maximum view distance that a player can have in this world.

Definition at line 1244 of file World.h.

int cWorld::m_MinNetherPortalHeight
private

Definition at line 1161 of file World.h.

int cWorld::m_MinNetherPortalWidth
private

Definition at line 1159 of file World.h.

int cWorld::m_MinRainTicks
private

Definition at line 1212 of file World.h.

int cWorld::m_MinSunnyTicks
private

Definition at line 1211 of file World.h.

int cWorld::m_MinThunderStormTicks
private

Definition at line 1213 of file World.h.

cPlayerList cWorld::m_Players
private

Definition at line 1198 of file World.h.

cAwaitingPlayerList cWorld::m_PlayersToAdd
private

List of players that are scheduled for adding, waiting for the Tick thread to add them.

Definition at line 1295 of file World.h.

cRedstoneSimulator* cWorld::m_RedstoneSimulator
private

Definition at line 1195 of file World.h.

std::unique_ptr<cSandSimulator> cWorld::m_SandSimulator
private

Definition at line 1191 of file World.h.

cScoreboard cWorld::m_Scoreboard
private

Definition at line 1257 of file World.h.

cSetChunkDataPtrs cWorld::m_SetChunkDataQueue
private

Queue for the chunk data to be set into m_ChunkMap by the tick thread.

Protected by m_CSSetChunkDataQueue

Definition at line 1301 of file World.h.

bool cWorld::m_ShouldLavaSpawnFire
private

Definition at line 1184 of file World.h.

std::unique_ptr<cSimulatorManager> cWorld::m_SimulatorManager
private

Definition at line 1190 of file World.h.

NIBBLETYPE cWorld::m_SkyDarkness
private

Definition at line 1179 of file World.h.

double cWorld::m_SpawnX
private

Definition at line 1154 of file World.h.

double cWorld::m_SpawnY
private

Definition at line 1155 of file World.h.

double cWorld::m_SpawnZ
private

Definition at line 1156 of file World.h.

cWorldStorage cWorld::m_Storage
private

Definition at line 1200 of file World.h.

int cWorld::m_StorageCompressionFactor
private

Definition at line 1145 of file World.h.

AString cWorld::m_StorageSchema
private

Name of the storage schema used to load and save chunks.

Definition at line 1143 of file World.h.

std::vector<std::pair<Int64, std::function<void(cWorld &)> > > cWorld::m_Tasks
private

Tasks that have been queued onto the tick thread, possibly to be executed at target tick in the future; guarded by m_CSTasks.

Definition at line 1271 of file World.h.

cTickThread cWorld::m_TickThread
private

Definition at line 1265 of file World.h.

std::chrono::milliseconds cWorld::m_TimeOfDay
private

Definition at line 1173 of file World.h.

eShrapnelLevel cWorld::m_TNTShrapnelLevel
private

The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities See the eShrapnelLevel enumeration for details.

Definition at line 1241 of file World.h.

size_t cWorld::m_UnusedDirtyChunksCap
private

The maximum number of allowed unused dirty chunks for this world.

Loaded from config, enforced every 10 seconds by freeing some unused dirty chunks if this was exceeded.

Definition at line 1129 of file World.h.

bool cWorld::m_VillagersShouldHarvestCrops
private

Definition at line 1185 of file World.h.

cFluidSimulator* cWorld::m_WaterSimulator
private

Definition at line 1192 of file World.h.

eWeather cWorld::m_Weather
private

Definition at line 1209 of file World.h.

int cWorld::m_WeatherInterval
private

Definition at line 1210 of file World.h.

std::chrono::milliseconds cWorld::m_WorldAge
private

The age of the world.

Monotonic, always increasing each game tick, persistent across server restart.

Definition at line 1171 of file World.h.

AString cWorld::m_WorldName
private

Definition at line 1131 of file World.h.


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