Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <World.h>
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, cWorld *a_OldWorld=nullptr) |
Adds the entity into its appropriate chunk; takes ownership of the entity ptr. 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 | BroadcastBossBarUpdateHealth (const cEntity &a_Entity, UInt32 a_UniqueID, float a_FractionFilled) override |
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_Collected, const cEntity &a_Collector, unsigned 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, EntityAnimation 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 | BroadcastEntityPosition (const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override |
void | BroadcastEntityProperties (const cEntity &a_Entity) |
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 | BroadcastPlayerListHeaderFooter (const cCompositeChat &a_Header, const cCompositeChat &a_Footer) 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 () 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 | 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 | BroadcastWeather (eWeather a_Weather, const cClientHandle *a_Exclude=nullptr) override |
void | CastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) |
void | CastThunderbolt (Vector3i a_Block) |
Casts a thunderbolt at the specified coords. More... | |
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 | CollectPickupsByEntity (cEntity &a_Entity) |
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 (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... | |
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... | |
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... | |
bool | DigBlock (int a_X, int a_Y, int a_Z, cEntity *a_Digger=nullptr) |
OBSOLETE, use the Vector3-based overload instead. More... | |
bool | DigBlock (Vector3i a_BlockPos, const cEntity *a_Digger=nullptr) |
Replaces the specified block with air, and calls the OnBroken block handler. 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... | |
virtual bool | DoWithBlockEntityAt (Vector3i a_Position, 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, and whatever the callback returns 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 | 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 | 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 | 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... | |
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::Priority 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... | |
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 | 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 | 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) const |
Returns the block type at the specified position. More... | |
NIBBLETYPE | GetBlockBlockLight (Vector3i a_BlockPos) const |
Returns the block-light value at the specified block position. More... | |
bool | GetBlockInfo (Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_Meta, NIBBLETYPE &a_SkyLight, NIBBLETYPE &a_BlockLight) const |
Queries the whole block specification from the world. More... | |
NIBBLETYPE | GetBlockMeta (Vector3i a_BlockPos) const |
Returns the block meta at the specified position. More... | |
bool | GetBlocks (sSetBlockVector &a_Blocks, bool a_ContinueOnFailure) |
Retrieves block types of the specified blocks. More... | |
NIBBLETYPE | GetBlockSkyLight (Vector3i a_BlockPos) const |
Returns the sky light value at the specified block position. More... | |
bool | GetBlockTypeMeta (Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const |
Retrieves the block type and meta at the specified coords. More... | |
virtual cBroadcastInterface & | GetBroadcastManager (void) override |
bool | GetChunkData (cChunkCoords a_Coords, cChunkDataCallback &a_Callback) const |
Calls the callback with the chunk's data, if available (with ChunkCS locked). More... | |
cChunkMap * | GetChunkMap (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 AString & | GetDataPath (void) const |
Returns the data path to the world data. More... | |
int | GetDefaultWeatherInterval (eWeather a_Weather) const |
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... | |
cChunkGeneratorThread & | GetGenerator (void) |
size_t | 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 AString & | GetIniFileName (void) const |
Returns the name of the world.ini file used by this world. More... | |
cFluidSimulator * | GetLavaSimulator (void) |
size_t | GetLightingQueueLength (void) |
cLightingThread & | GetLightingThread (void) |
AString | GetLinkedEndWorldName (void) const |
AString | GetLinkedNetherWorldName (void) const |
AString | GetLinkedOverworldName (void) const |
cMapManager & | GetMapManager (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 AString & | GetName (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... | |
size_t | GetPlayerCount () const |
Returns the number of players currently in this world. More... | |
cRedstoneSimulator * | GetRedstoneSimulator (void) |
cScoreboard & | GetScoreBoard (void) |
Returns the associated scoreboard instance. More... | |
int | GetSeed (void) const |
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... | |
cSimulatorManager * | GetSimulatorManager (void) |
NIBBLETYPE | GetSkyDarkness () |
Get the current darkness level based on the time. More... | |
int | GetSpawnX (void) const |
int | GetSpawnY (void) const |
int | GetSpawnZ (void) const |
cWorldStorage & | GetStorage (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 cTickTime | GetTimeOfDay (void) const override |
eShrapnelLevel | GetTNTShrapnelLevel (void) const |
cFluidSimulator * | GetWaterSimulator (void) |
eWeather | GetWeather (void) const |
Returns the current weather. More... | |
virtual cTickTimeLong | GetWorldAge (void) const override |
cTickTimeLong | GetWorldDate () const |
cTickTimeLong | GetWorldTickAge () const |
int | GrowPlantAt (Vector3i a_BlockPos, int a_NumStages=1) |
Grows the plant at the specified position by at most a_NumStages. More... | |
bool | GrowRipePlant (int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal=false) |
OBSOLETE, use the Vector3-based overload instead. More... | |
bool | GrowRipePlant (Vector3i a_BlockPos) |
Grows the plant at the specified block to its ripe stage. More... | |
bool | GrowTree (Vector3i a_BlockPos) |
Grows a tree at the specified coords. More... | |
bool | GrowTreeByBiome (Vector3i a_BlockPos) |
Grows a tree at the specified coords, based on the biome in the place. More... | |
bool | GrowTreeFromSapling (Vector3i a_BlockPos) |
Grows a tree from the sapling at the specified coords. 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 |
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 | IsFarmlandTramplingEnabled (void) const |
Returns true if farmland trampling is enabled. More... | |
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 | IsSlimeChunk (int a_ChunkX, int a_ChunkZ) const |
Returns true if slimes should spawn in the chunk. 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) const |
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_Position) override |
Returns true if it is raining or storming at the specified location, and the rain reaches (the bottom of) the specified block position. 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 | PlaceBlock (const Vector3i a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta) |
Replaces the specified block with another, and calls the OnPlaced block handler. 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 (SetChunkData &&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... | |
OwnedEntity | RemoveEntity (cEntity &a_Entity) |
Removes the entity from the world. More... | |
void | SaveAllChunks (void) |
Saves all chunks immediately. More... | |
void | ScheduleTask (cTickTime 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... | |
void | SendBlockTo (const Vector3i a_BlockPos, const cPlayer &a_Player) |
Sends the block on those coords to the player. More... | |
virtual void | SendBlockTo (int a_BlockX, int a_BlockY, int a_BlockZ, const cPlayer &a_Player)=0 |
Sends the block on those coords to the player. More... | |
virtual void | SendBlockTo (int a_X, int a_Y, int a_Z, const cPlayer &a_Player) override |
Sends the block at the specified coords to the player. More... | |
void | SendChunkTo (int a_ChunkX, int a_ChunkZ, cChunkSender::Priority 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 (const cCuboid &a_Area, EMCSBiome a_Biome) |
Sets the biome at the area. More... | |
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 | 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 | SetBlockMeta (Vector3i a_BlockPos, NIBBLETYPE a_MetaData) |
Sets the meta for the specified block, while keeping the blocktype. 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... | |
bool | SetCommandBlockCommand (Vector3i a_BlockPos, const AString &a_Command) |
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 | SetNextBlockToTick (const Vector3i a_BlockPos) |
Causes the specified block to be ticked on the next Tick() call. More... | |
void | SetSavingEnabled (bool a_IsSavingEnabled) |
Set whether saving chunks is enabled. More... | |
void | SetShouldUseChatPrefixes (bool a_Flag) |
bool | SetSignLines (Vector3i a_BlockPos, 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 (int a_X, int a_Y, int a_Z) |
Set default spawn at the given coordinates. More... | |
void | SetTicksUntilWeatherChange (int a_WeatherInterval) |
virtual void | SetTimeOfDay (cTickTime 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 | SpawnEnderCrystal (Vector3d a_Pos, bool a_ShowBottom) |
Spawns a new ender crystal at the specified block coords. 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 | SpawnExperienceOrb (Vector3d a_Pos, int a_Reward) |
Spawns an experience orb at the given location with the given reward. More... | |
UInt32 | SpawnFallingBlock (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
OBSOLETE, use the Vector3-based overload instead. More... | |
UInt32 | SpawnFallingBlock (Vector3d a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
Spawns an falling block entity at the given position. More... | |
UInt32 | SpawnFallingBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
Spawns an falling block entity at the given position. 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... | |
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 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... | |
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... | |
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... | |
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... | |
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... | |
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... | |
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... | |
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, bool a_ShouldPlayFuseSound=true) |
UInt32 | SpawnPrimedTNT (Vector3d a_Pos, int a_FuseTimeInSec=80, double a_InitialVelocityCoeff=1, bool a_ShouldPlayFuseSound=true) |
Spawns a new primed TNT entity at the specified block coords and specified fuse duration. More... | |
std::vector< UInt32 > | SpawnSplitExperienceOrbs (double a_X, double a_Y, double a_Z, int a_Reward) |
OBSOLETE, use the Vector3d-based overload instead. More... | |
virtual std::vector< UInt32 > | SpawnSplitExperienceOrbs (Vector3d a_Pos, int a_Reward) override |
Spawns experience orbs of the specified total value at the given location. 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... | |
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 | WakeUpSimulatorsInArea (const cCuboid &a_Area) |
Wakes up the simulators for the specified area of blocks. More... | |
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... | |
virtual | ~cWorld () override |
Public Member Functions inherited from cForEachChunkProvider | |
virtual | ~cForEachChunkProvider () |
Public Member Functions inherited from cWorldInterface | |
void | SendBlockTo (const Vector3i a_BlockPos, const cPlayer &a_Player) |
Sends the block on those coords to the player. More... | |
virtual | ~cWorldInterface () |
Public Member Functions inherited from cBroadcastInterface | |
virtual | ~cBroadcastInterface () |
Private Member Functions | |
bool | CanSpawnAt (int a_X, int &a_Y, int 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... | |
bool | CheckPlayerSpawnPoint (Vector3i a_Pos) |
eWeather | ChooseNewWeather (void) |
Chooses a reasonable transition from the current weather to a new weather. More... | |
void | GenerateRandomSpawn (int a_MaxSpawnRadius) |
Generates a random spawnpoint on solid land by walking chunks and finding their biomes. More... | |
bool | GetLargeTreeAdjustment (Vector3i &a_BlockPos, 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... | |
cFluidSimulator * | InitializeFluidSimulator (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... | |
cRedstoneSimulator * | InitializeRedstoneSimulator (cIniFile &a_IniFile) |
Creates a new redstone simulator. More... | |
void | Tick (std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec) |
void | TickClients (std::chrono::milliseconds 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 | TickQueuedChunkDataSets () |
Sets the chunk data queued in the m_SetChunkDataQueue queue into their chunk. More... | |
void | TickQueuedEntityAdditions (void) |
Adds the entities queued in the m_EntitiesToAdd queue into their chunk. 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) |
Private Attributes | |
std::set< eMonsterType > | m_AllowedMobs |
bool | m_bAnimals |
bool | m_bCommandBlocksEnabled |
Whether command blocks are enabled or not. More... | |
bool | m_bEnabledPVP |
bool | m_bFarmlandTramplingEnabled |
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... | |
cChunkMap | m_ChunkMap |
cChunkSender | m_ChunkSender |
cCriticalSection | m_CSEntitiesToAdd |
Guards m_EntitiesToAdd. 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... | |
std::vector< std::pair< OwnedEntity, cWorld * > > | m_EntitiesToAdd |
List of entities that are scheduled for adding, waiting for the Tick thread to add them. More... | |
std::unique_ptr< cFireSimulator > | m_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_IsDaylightCycleEnabled |
bool | m_IsDeepSnowEnabled |
std::atomic< bool > | m_IsSavingEnabled |
Whether or not writing chunks to disk is currently enabled. More... | |
bool | m_IsSpawnExplicitlySet |
std::chrono::milliseconds | m_LastChunkCheck |
std::chrono::milliseconds | m_LastSave |
std::map< cMonster::eFamily, cTickTimeLong > | m_LastSpawnMonster |
cFluidSimulator * | m_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 |
std::vector< cPlayer * > | m_Players |
cRedstoneSimulator * | m_RedstoneSimulator |
std::unique_ptr< cSandSimulator > | m_SandSimulator |
cScoreboard | m_Scoreboard |
std::vector< SetChunkData > | m_SetChunkDataQueue |
Queue for the chunk data to be set into m_ChunkMap by the tick thread. More... | |
bool | m_ShouldLavaSpawnFire |
std::unique_ptr< cSimulatorManager > | m_SimulatorManager |
NIBBLETYPE | m_SkyDarkness |
int | m_SpawnX |
int | m_SpawnY |
int | 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< std::chrono::milliseconds, 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 |
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 |
cFluidSimulator * | m_WaterSimulator |
eWeather | m_Weather |
int | m_WeatherInterval |
std::chrono::milliseconds | m_WorldAge |
The age of the world. More... | |
std::chrono::milliseconds | m_WorldDate |
The fully controllable age of the world. More... | |
AString | m_WorldName |
cTickTimeLong | m_WorldTickAge |
The time since this world began, in ticks. More... | |
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 = {} |
||
) |
bool cWorld::AddChunkClient | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cClientHandle * | a_Client | ||
) |
void cWorld::AddEntity | ( | OwnedEntity | a_Entity, |
cWorld * | a_OldWorld = nullptr |
||
) |
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. If a_OldWorld is provided, a corresponding ENTITY_CHANGED_WORLD event is triggerred after the addition.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 109 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 122 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 135 of file Broadcaster.cpp.
|
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.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 174 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 187 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 205 of file Broadcaster.cpp.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
inlineoverridevirtual |
Implements cBroadcastInterface.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 218 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 231 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 244 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 257 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 374 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 270 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 283 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 296 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 309 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 322 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 335 of file Broadcaster.cpp.
void cWorld::BroadcastEntityProperties | ( | const cEntity & | a_Entity | ) |
Definition at line 348 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 361 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 387 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 400 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 413 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 426 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 439 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 452 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 465 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 478 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 491 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 504 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 517 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 530 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 543 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 556 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 569 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 582 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 595 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 608 of file Broadcaster.cpp.
|
overridevirtual |
Implements cBroadcastInterface.
Definition at line 621 of file Broadcaster.cpp.
|
private |
void cWorld::CastThunderbolt | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) |
void cWorld::CastThunderbolt | ( | Vector3i | a_Block | ) |
void cWorld::ChangeWeather | ( | void | ) |
|
inlineprivate |
|
private |
|
private |
void cWorld::ChunkLighted | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
const cChunkDef::BlockNibbles & | a_BlockLight, | ||
const cChunkDef::BlockNibbles & | a_SkyLight | ||
) |
void cWorld::ChunkLoadFailed | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
void cWorld::CollectPickupsByEntity | ( | cEntity & | a_Entity | ) |
void cWorld::CompareChunkClients | ( | int | a_ChunkX1, |
int | a_ChunkZ1, | ||
int | a_ChunkX2, | ||
int | a_ChunkZ2, | ||
cClientDiffCallback & | a_Callback | ||
) |
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.
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.
|
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.
Replaces the specified block with air, and calls the OnBroken block handler.
Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead. Returns true on success, false if the chunk is not loaded.
|
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 Defines.h for details. Exported to Lua manually in ManualBindings_World.cpp in order to support the variable a_SourceData param.
Implements cWorldInterface.
|
overridevirtual |
Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, and whatever the callback returns if found.
Implements cWorldInterface.
bool cWorld::DoWithChunk | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cChunkCallback | a_Callback | ||
) |
bool cWorld::DoWithChunkAt | ( | Vector3i | a_BlockPos, |
cChunkCallback | a_Callback | ||
) |
bool cWorld::DoWithEntityByID | ( | UInt32 | a_UniqueID, |
cEntityCallback | a_Callback | ||
) |
bool cWorld::DoWithNearestPlayer | ( | Vector3d | a_Pos, |
double | a_RangeLimit, | ||
cPlayerListCallback | a_Callback, | ||
bool | a_CheckLineOfSight = true , |
||
bool | a_IgnoreSpectator = true |
||
) |
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.
bool cWorld::DoWithPlayerByUUID | ( | const cUUID & | a_PlayerUUID, |
cPlayerListCallback | a_Callback | ||
) |
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.
|
inline |
bool cWorld::FindAndDoWithPlayer | ( | const AString & | a_PlayerNameHint, |
cPlayerListCallback | a_Callback | ||
) |
void cWorld::ForceSendChunkTo | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cChunkSender::Priority | a_Priority, | ||
cClientHandle * | a_Client | ||
) |
bool cWorld::ForEachBlockEntityInChunk | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cBlockEntityCallback | 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.
bool cWorld::ForEachEntity | ( | 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.
bool cWorld::ForEachEntityInChunk | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cEntityCallback | a_Callback | ||
) |
bool cWorld::ForEachLoadedChunk | ( | cFunctionRef< bool(int, int)> | 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.
void cWorld::GenerateChunk | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
|
private |
EMCSBiome cWorld::GetBiomeAt | ( | int | a_BlockX, |
int | a_BlockZ | ||
) |
NIBBLETYPE cWorld::GetBlockBlockLight | ( | Vector3i | a_BlockPos | ) | const |
bool cWorld::GetBlockInfo | ( | Vector3i | a_BlockPos, |
BLOCKTYPE & | a_BlockType, | ||
NIBBLETYPE & | a_Meta, | ||
NIBBLETYPE & | a_SkyLight, | ||
NIBBLETYPE & | a_BlockLight | ||
) | const |
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.
|
inline |
bool cWorld::GetBlocks | ( | sSetBlockVector & | a_Blocks, |
bool | a_ContinueOnFailure | ||
) |
NIBBLETYPE cWorld::GetBlockSkyLight | ( | Vector3i | a_BlockPos | ) | const |
bool cWorld::GetBlockTypeMeta | ( | Vector3i | a_BlockPos, |
BLOCKTYPE & | a_BlockType, | ||
NIBBLETYPE & | a_BlockMeta | ||
) | const |
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.
|
inlineoverridevirtual |
Implements cWorldInterface.
bool cWorld::GetChunkData | ( | cChunkCoords | a_Coords, |
cChunkDataCallback & | a_Callback | ||
) | const |
void cWorld::GetChunkStats | ( | int & | a_NumValid, |
int & | a_NumDirty, | ||
int & | a_NumInLightingQueue | ||
) |
|
inline |
int cWorld::GetDefaultWeatherInterval | ( | eWeather | a_Weather | ) | const |
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inline |
|
inline |
|
overridevirtual |
Returns the world height at the specified coords; waits for the chunk to get loaded / generated.
Implements cWorldInterface.
|
inline |
|
private |
Checks if the sapling at the specified block coord is a part of a large-tree sapling (2x2).
If so, adjusts the 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.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inlineoverridevirtual |
Returns or sets the minumim or maximum netherportal height.
Implements cWorldInterface.
|
inlineoverridevirtual |
Returns or sets the minumim or maximum netherportal width.
Implements cWorldInterface.
|
inline |
size_t cWorld::GetNumChunks | ( | void | ) | const |
size_t cWorld::GetNumUnusedDirtyChunks | ( | void | ) | const |
size_t cWorld::GetPlayerCount | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int cWorld::GetTickRandomNumber | ( | int | a_Range | ) |
|
overridevirtual |
Implements cWorldInterface.
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Implements cWorldInterface.
cTickTimeLong cWorld::GetWorldDate | ( | ) | const |
cTickTimeLong cWorld::GetWorldTickAge | ( | ) | const |
int cWorld::GrowPlantAt | ( | Vector3i | a_BlockPos, |
int | a_NumStages = 1 |
||
) |
|
inline |
bool cWorld::GrowRipePlant | ( | Vector3i | a_BlockPos | ) |
bool cWorld::GrowTree | ( | Vector3i | a_BlockPos | ) |
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). Exported in DeprecatedBindings due to the obsolete int-based overload.
bool cWorld::GrowTreeByBiome | ( | Vector3i | a_BlockPos | ) |
bool cWorld::GrowTreeFromSapling | ( | Vector3i | a_BlockPos | ) |
Grows a tree from the sapling at the specified coords.
If the sapling is a part of a large-tree sapling (2x2), a large tree growth is attempted. Returns true if the tree was grown, false if not (invalid chunk, insufficient space). Exported in DeprecatedBindings due to the obsolete int-based overload and obsolete additional SaplingMeta param.
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.
bool cWorld::HasChunkAnyClients | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) | const |
|
private |
|
private |
|
private |
bool cWorld::IsBlockDirectlyWatered | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) |
bool cWorld::IsChunkLighted | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
bool cWorld::IsChunkQueued | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) | const |
bool cWorld::IsChunkValid | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) | const |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool cWorld::IsSlimeChunk | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) | const |
bool cWorld::IsTrapdoorOpen | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool cWorld::IsWeatherSunnyAt | ( | int | a_BlockX, |
int | a_BlockZ | ||
) | const |
|
inline |
|
overridevirtual |
Returns true if it is raining or storming at the specified location.
This takes into account biomes.
Implements cWorldInterface.
|
overridevirtual |
Returns true if it is raining or storming at the specified location, and the rain reaches (the bottom of) the specified block position.
Implements cWorldInterface.
void cWorld::MarkChunkDirty | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
void cWorld::MarkChunkSaved | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
void cWorld::MarkChunkSaving | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
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.
void cWorld::PlaceBlock | ( | const Vector3i | a_Position, |
const BLOCKTYPE | a_BlockType, | ||
const NIBBLETYPE | a_BlockMeta | ||
) |
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.
void cWorld::QueueBlockForTick | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
int | a_TicksToWait | ||
) |
void cWorld::QueueLightChunk | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
std::unique_ptr< cChunkCoordCallback > | a_Callback = {} |
||
) |
void cWorld::QueueSaveAllChunks | ( | void | ) |
void cWorld::QueueSetChunkData | ( | SetChunkData && | a_SetChunkData | ) |
void cWorld::QueueTask | ( | std::function< void(cWorld &)> | a_Task | ) |
void cWorld::QueueUnloadUnusedChunks | ( | void | ) |
void cWorld::RegenerateChunk | ( | int | a_ChunkX, |
int | a_ChunkZ | ||
) |
void cWorld::RemoveChunkClient | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cClientHandle * | a_Client | ||
) |
void cWorld::RemoveClientFromChunks | ( | cClientHandle * | a_Client | ) |
OwnedEntity cWorld::RemoveEntity | ( | cEntity & | a_Entity | ) |
void cWorld::SaveAllChunks | ( | void | ) |
Saves all chunks immediately.
Dangerous interface, may deadlock, use QueueSaveAllChunks() instead
void cWorld::SendBlockEntity | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
cClientHandle & | a_Client | ||
) |
|
inline |
Sends the block on those coords to the player.
Definition at line 60 of file WorldInterface.h.
virtual void cWorldInterface::SendBlockTo |
Sends the block on those coords to the player.
|
overridevirtual |
Sends the block at the specified coords to the player.
Used mainly when plugins disable block-placing or block-breaking, to restore the previous block.
Implements cWorldInterface.
void cWorld::SendChunkTo | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
cChunkSender::Priority | a_Priority, | ||
cClientHandle * | a_Client | ||
) |
bool cWorld::SetAreaBiome | ( | int | a_MinX, |
int | a_MaxX, | ||
int | a_MinZ, | ||
int | a_MaxZ, | ||
EMCSBiome | a_Biome | ||
) |
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.
void cWorld::SetBlock | ( | Vector3i | a_BlockPos, |
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
void cWorld::SetBlockMeta | ( | Vector3i | a_BlockPos, |
NIBBLETYPE | a_MetaData | ||
) |
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).
bool cWorld::SetCommandBlockCommand | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
const AString & | a_Command | ||
) |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inlineoverridevirtual |
Implements cWorldInterface.
|
inlineoverridevirtual |
Implements cWorldInterface.
void cWorld::SetNextBlockToTick | ( | const Vector3i | a_BlockPos | ) |
|
inline |
bool cWorld::SetSpawn | ( | int | a_X, |
int | a_Y, | ||
int | a_Z | ||
) |
|
inline |
|
overridevirtual |
Implements cWorldInterface.
|
inline |
bool cWorld::SetTrapdoorOpen | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
bool | a_Open | ||
) |
void cWorld::SetWeather | ( | eWeather | a_NewWeather | ) |
|
inline |
|
inline |
|
inline |
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.
Spawns a new ender crystal at the specified block coords.
Returns the UniqueID of the created entity, or cEntity::INVALID_ID on failure.
|
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.
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.
|
inline |
OBSOLETE, use the Vector3-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.
UInt32 cWorld::SpawnFallingBlock | ( | Vector3d | 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.
|
inline |
Spawns an falling block entity at the given position.
Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure.
|
inlineoverridevirtual |
OBSOLETE, use the Vector3d-based overload instead.
Spawns a single pickup containing the specified item.
Implements cWorldInterface.
|
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.
|
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.
|
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.
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.
|
overridevirtual |
Spawns a mob of the specified type.
Returns the mob's UniqueID if recognized and spawned, cEntity::INVALID_ID otherwise
Implements cWorldInterface.
Wraps cEntity::Initialize, doing Monster-specific things before spawning the monster.
Takes ownership of the given Monster reference.
|
inline |
UInt32 cWorld::SpawnPrimedTNT | ( | Vector3d | a_Pos, |
int | a_FuseTimeInSec = 80 , |
||
double | a_InitialVelocityCoeff = 1 , |
||
bool | a_ShouldPlayFuseSound = true |
||
) |
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.
|
inline |
|
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.
void cWorld::Start | ( | void | ) |
void cWorld::Stop | ( | cDeadlockDetect & | a_DeadlockDetect | ) |
void cWorld::TabCompleteUserName | ( | const AString & | a_Text, |
AStringVector & | a_Results | ||
) |
|
private |
|
private |
|
private |
void cWorld::TickQueuedBlocks | ( | void | ) |
|
private |
|
private |
|
private |
|
private |
bool cWorld::TryGetHeight | ( | int | a_BlockX, |
int | a_BlockZ, | ||
int & | a_Height | ||
) |
|
private |
|
inline |
|
inline |
|
overridevirtual |
Wakes up the simulators for the specified block.
Implements cWorldInterface.
void cWorld::WakeUpSimulatorsInArea | ( | const cCuboid & | a_Area | ) |
|
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.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities See the eShrapnelLevel enumeration for details.
|
private |
|
private |
|
private |
|
private |
|
private |