24 template <
typename Func>
45 template <
typename Func>
51 for (auto * Client : a_Chunk.GetAllClients())
53 if (Client != a_Exclude)
70 template <
typename Func>
83 template <
typename Func>
90 for (
auto * Client : Chunk->GetAllClients())
92 if (Client != a_Exclude)
100 ForClientsWithChunk({ a_Entity.
GetChunkX(), a_Entity.
GetChunkZ() }, a_World, a_Exclude, std::move(a_Func));
111 ForClientsWithEntity(a_Entity, *
this,
nullptr, [&](
cClientHandle & a_Client)
124 ForClientsWithChunkAtPos(a_BlockPos, *
this, a_Exclude, [&](
cClientHandle & a_Client)
126 a_Client.
SendBlockAction(a_BlockPos.
x, a_BlockPos.
y, a_BlockPos.
z, static_cast<char>(a_Byte1), static_cast<char>(a_Byte2), a_BlockType);
137 ForClientsWithChunkAtPos(a_BlockPos, *
this, a_Exclude, [&](
cClientHandle & a_Client)
153 if (Entity ==
nullptr)
160 if (Client != a_Exclude)
176 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
178 a_Client.
SendChat(a_Message, a_ChatPrefix);
189 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
202 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
215 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
228 ForClientsWithEntity(a_Entity, *
this,
nullptr, [&](
cClientHandle & a_Client)
241 ForClientsInWorld(*
this,
nullptr, [&](
cClientHandle & a_Client)
254 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
267 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
280 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
293 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
306 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
319 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
332 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
345 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
358 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
371 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
384 ForClientsWithEntity(a_Entity, *
this,
nullptr, [&](
cClientHandle & a_Client)
397 ForClientsWithChunkAtPos(a_Src, *
this, a_Exclude, [&](
cClientHandle & a_Client)
399 a_Client.
SendParticleEffect(a_ParticleName, a_Src.
x, a_Src.
y, a_Src.
z, a_Offset.
x, a_Offset.
y, a_Offset.
z, a_ParticleData, a_ParticleAmount);
410 ForClientsWithChunkAtPos(a_Src, *
this, a_Exclude, [&](
cClientHandle & a_Client)
412 a_Client.
SendParticleEffect(a_ParticleName, a_Src, a_Offset, a_ParticleData, a_ParticleAmount, a_Data);
423 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
436 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
449 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
462 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
475 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
488 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
501 ForClientsInWorld(*
this,
nullptr, [&](
cClientHandle & a_Client)
514 ForClientsInWorld(*
this,
nullptr, [&](
cClientHandle & a_Client)
527 ForClientsWithChunkAtPos(a_Position, *
this, a_Exclude, [&](
cClientHandle & a_Client)
540 ForClientsWithChunkAtPos(a_SrcPos, *
this, a_Exclude, [&](
cClientHandle & a_Client)
553 ForClientsWithEntity(a_Entity, *
this, a_Exclude, [&](
cClientHandle & a_Client)
566 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
579 ForClientsWithChunkAtPos(a_BlockPos, *
this, a_Exclude, [&](
cClientHandle & a_Client)
592 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
605 ForClientsWithEntity(a_Entity, *
this,
nullptr, [&](
cClientHandle & a_Client)
618 ForClientsWithChunkAtPos(a_BedPos, *
this,
nullptr, [&](
cClientHandle & a_Client)
620 a_Client.
SendUseBed(a_Entity, a_BedPos.
x, a_BedPos.
y, a_BedPos.
z);
631 ForClientsInWorld(*
this, a_Exclude, [&](
cClientHandle & a_Client)
int GetChunkZ(void) const
virtual bool IsDaylightCycleEnabled(void) const
Is the daylight cycle enabled?
virtual void BroadcastEntityEffect(const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityRelMove(const cEntity &a_Entity, Vector3< Int8 > a_RelMove, const cClientHandle *a_Exclude=nullptr) override
void SendParticleEffect(const AString &a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
virtual void BroadcastEntityAnimation(const cEntity &a_Entity, Int8 a_Animation, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
void SendAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle)
virtual void BroadcastSpawnEntity(cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
void SendEntityVelocity(const cEntity &a_Entity)
virtual void BroadcastPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName, const cClientHandle *a_Exclude=nullptr) override
void SendDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display)
cChunk * GetParentChunk()
Returns the chunk responsible for ticking this entity.
void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode)
virtual void BroadcastEntityEquipment(const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item, const cClientHandle *a_Exclude=nullptr) override
unsigned char BLOCKTYPE
The datatype used by blockdata.
void SendEntityLook(const cEntity &a_Entity)
bool DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback)
Calls the callback for the chunk at the block position specified, with ChunkMapCS locked...
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
void SendDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle)
void SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage)
void SendLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo)
virtual void BroadcastPlayerListUpdatePing(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
virtual void SpawnOn(cClientHandle &a_Client)=0
Descendants override this function to send a command to the specified client to spawn the entity on t...
void SendPlayerListRemovePlayer(const cPlayer &a_Player)
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback)
Calls the callback for the chunk specified, with ChunkMapCS locked.
virtual void BroadcastRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID, const cClientHandle *a_Exclude=nullptr) override
void SendSoundEffect(const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
virtual void BroadcastDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display) override
virtual void SendTo(cClientHandle &a_Client)=0
Sends the packet defining the block entity to the client specified.
void SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data)
virtual void BroadcastDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle) override
void SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
cBlockEntity * GetBlockEntity(Vector3i a_AbsPos)
Returns the block entity at the specified (absolute) coords.
void SendWeather(eWeather a_Weather)
virtual void BroadcastEntityRelMoveLook(const cEntity &a_Entity, Vector3< Int8 > a_RelMove, const cClientHandle *a_Exclude=nullptr) override
void SendTeleportEntity(const cEntity &a_Entity)
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
static void BlockToChunk(int a_X, int a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords to chunk coords:
void SendPlayerListAddPlayer(const cPlayer &a_Player)
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...
Container for a single chat message composed of multiple functional parts.
void SendEntityStatus(const cEntity &a_Entity, char a_Status)
void SendScoreUpdate(const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode)
virtual void BroadcastDestroyEntity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
void SendEntityRelMoveLook(const cEntity &a_Entity, char a_RelX, char a_RelY, char a_RelZ)
void SendPlayerListUpdateGameMode(const cPlayer &a_Player)
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle) override
void SendEntityHeadLook(const cEntity &a_Entity)
virtual void BroadcastTimeUpdate(const cClientHandle *a_Exclude=nullptr) override
void SendCollectEntity(const cEntity &a_Entity, const cPlayer &a_Player, int a_Count)
void SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
virtual int GetTimeOfDay(void) const override
void SendUseBed(const cEntity &a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
virtual void BroadcastBlockAction(Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle *a_Exclude=nullptr) override
virtual Int64 GetWorldAge(void) const override
void SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
virtual void BroadcastPlayerListAddPlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
void SendEntityAnimation(const cEntity &a_Entity, char a_Animation)
virtual void BroadcastPlayerListUpdateGameMode(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
bool IsDestroyed(void) const
void SendEntityEquipment(const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item)
void SendRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID)
virtual void BroadcastLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo) override
void SendChat(const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
void SendEntityRelMove(const cEntity &a_Entity, char a_RelX, char a_RelY, char a_RelZ)
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 BroadcastTeleportEntity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastPlayerListRemovePlayer(const cPlayer &a_Player, 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 BroadcastScoreUpdate(const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode) override
bool IsLoggedIn(void) const
int GetChunkX(void) const
void SendEntityEffect(const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration)
virtual void BroadcastEntityHeadLook(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastUnleashEntity(const cEntity &a_Entity) override
virtual void BroadcastEntityVelocity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
void SendUnleashEntity(const cEntity &a_Entity)
virtual void BroadcastWeather(eWeather a_Weather, const cClientHandle *a_Exclude=nullptr) override
void SendPlayerListUpdatePing(const cPlayer &a_Player)
cChunkClientHandles GetAllClients(void) const
virtual void BroadcastUseBed(const cEntity &a_Entity, Vector3i a_BlockPos) override
virtual void BroadcastEntityLook(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastThunderbolt(Vector3i a_BlockPos, const cClientHandle *a_Exclude=nullptr) override
void SendEntityMetadata(const cEntity &a_Entity)
void SendPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName)
void SendDestroyEntity(const cEntity &a_Entity)
A simple RAII locker for the chunkmap - locks the chunkmap in its constructor, unlocks it in the dest...
virtual void BroadcastEntityStatus(const cEntity &a_Entity, Int8 a_Status, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastChat(const AString &a_Message, const cClientHandle *a_Exclude=nullptr, eMessageType a_ChatPrefix=mtCustom) override
cClientHandle * GetClientHandle(void) const
Returns the raw client handle associated with the player.
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.