Cuberite
A lightweight, fast and extensible game server for Minecraft
Broadcaster.cpp
Go to the documentation of this file.
1 // Broadcaster.cpp
2 
3 // Implements the broadcasting functions for cWorld
4 
5 #include "Globals.h"
6 #include "World.h"
7 #include "Chunk.h"
8 #include "ClientHandle.h"
9 #include "Entities/Entity.h"
10 #include "Entities/Player.h"
12 
13 
14 
15 
16 
17 namespace
18 {
19 
24  template <typename Func>
25  void ForClientsInWorld(cWorld & a_World, const cClientHandle * a_Exclude, Func a_Func)
26  {
27  a_World.ForEachPlayer([&](cPlayer & a_Player)
28  {
29  cClientHandle * Client = a_Player.GetClientHandle();
30  if ((Client != a_Exclude) && (Client != nullptr) && Client->IsLoggedIn() && !Client->IsDestroyed())
31  {
32  a_Func(*Client);
33  }
34  return false;
35  }
36  );
37  }
38 
39 
45  template <typename Func>
46  void ForClientsWithChunk(const cChunkCoords a_ChunkCoords, cWorld & a_World, const cClientHandle * a_Exclude, Func a_Func)
47  {
48  a_World.DoWithChunk(a_ChunkCoords.m_ChunkX, a_ChunkCoords.m_ChunkZ,
49  [&](cChunk & a_Chunk)
50  {
51  for (auto * Client : a_Chunk.GetAllClients())
52  {
53  if (Client != a_Exclude)
54  {
55  a_Func(*Client);
56  }
57  }
58  return true;
59  }
60  );
61  }
62 
63 
64 
70  template <typename Func>
71  void ForClientsWithChunkAtPos(const Vector3i a_WorldPos, cWorld & a_World, const cClientHandle * a_Exclude, Func a_Func)
72  {
73  ForClientsWithChunk(cChunkDef::BlockToChunk(a_WorldPos), a_World, a_Exclude, std::move(a_Func));
74  }
75 
76 
77 
83  template <typename Func>
84  void ForClientsWithEntity(const cEntity & a_Entity, cWorld & a_World, const cClientHandle * a_Exclude, Func a_Func)
85  {
86  cWorld::cLock Lock(a_World); // Lock world before accessing a_Entity
87  auto Chunk = a_Entity.GetParentChunk();
88  if (Chunk != nullptr)
89  {
90  for (auto * Client : Chunk->GetAllClients())
91  {
92  if (Client != a_Exclude)
93  {
94  a_Func(*Client);
95  }
96  }
97  }
98  else // Some broadcasts happen before the entity's first tick sets its ParentChunk
99  {
100  ForClientsWithChunk({ a_Entity.GetChunkX(), a_Entity.GetChunkZ() }, a_World, a_Exclude, std::move(a_Func));
101  }
102  }
103 } // namespace (anonymous)
104 
105 
106 
107 
108 
109 void cWorld::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle)
110 {
111  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
112  {
113  a_Client.SendAttachEntity(a_Entity, a_Vehicle);
114  }
115  );
116 }
117 
118 
119 
120 
121 
122 void cWorld::BroadcastBlockAction(Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
123 {
124  ForClientsWithChunkAtPos(a_BlockPos, *this, a_Exclude, [&](cClientHandle & a_Client)
125  {
126  a_Client.SendBlockAction(a_BlockPos, static_cast<char>(a_Byte1), static_cast<char>(a_Byte2), a_BlockType);
127  }
128  );
129 }
130 
131 
132 
133 
134 
135 void cWorld::BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle * a_Exclude)
136 {
137  ForClientsWithChunkAtPos(a_BlockPos, *this, a_Exclude, [&](cClientHandle & a_Client)
138  {
139  a_Client.SendBlockBreakAnim(a_EntityID, a_BlockPos, a_Stage);
140  }
141  );
142 }
143 
144 
145 
146 
147 
148 void cWorld::BroadcastBlockEntity(Vector3i a_BlockPos, const cClientHandle * a_Exclude)
149 {
150  DoWithChunkAt(a_BlockPos, [&](cChunk & a_Chunk)
151  {
152  cBlockEntity * Entity = a_Chunk.GetBlockEntity(a_BlockPos);
153  if (Entity == nullptr)
154  {
155  return false;
156  }
157 
158  for (auto * Client : a_Chunk.GetAllClients())
159  {
160  if (Client != a_Exclude)
161  {
162  Entity->SendTo(*Client);
163  }
164  }
165  return true;
166  }
167  );
168 }
169 
170 
171 
172 
173 
174 void cWorld::BroadcastBossBarUpdateHealth(const cEntity & a_Entity, UInt32 a_UniqueID, float a_FractionFilled)
175 {
176  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
177  {
178  a_Client.SendBossBarUpdateHealth(a_UniqueID, a_FractionFilled);
179  }
180  );
181 }
182 
183 
184 
185 
186 
187 void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude, eMessageType a_ChatPrefix)
188 {
189  if ((a_ChatPrefix == mtDeath) && !ShouldBroadcastDeathMessages())
190  {
191  return;
192  }
193 
194  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
195  {
196  a_Client.SendChat(a_Message, a_ChatPrefix);
197  }
198  );
199 }
200 
201 
202 
203 
204 
205 void cWorld::BroadcastChat(const cCompositeChat & a_Message, const cClientHandle * a_Exclude)
206 {
207  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
208  {
209  a_Client.SendChat(a_Message);
210  }
211  );
212 }
213 
214 
215 
216 
217 
218 void cWorld::BroadcastCollectEntity(const cEntity & a_Collected, const cEntity & a_Collector, unsigned a_Count, const cClientHandle * a_Exclude)
219 {
220  ForClientsWithEntity(a_Collected, *this, a_Exclude, [&](cClientHandle & a_Client)
221  {
222  a_Client.SendCollectEntity(a_Collected, a_Collector, a_Count);
223  }
224  );
225 }
226 
227 
228 
229 
230 
231 void cWorld::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
232 {
233  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
234  {
235  a_Client.SendDestroyEntity(a_Entity);
236  }
237  );
238 }
239 
240 
241 
242 
243 
244 void cWorld::BroadcastDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle)
245 {
246  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
247  {
248  a_Client.SendDetachEntity(a_Entity, a_PreviousVehicle);
249  }
250  );
251 }
252 
253 
254 
255 
256 
258 {
259  ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
260  {
261  a_Client.SendDisplayObjective(a_Objective, a_Display);
262  }
263  );
264 }
265 
266 
267 
268 
269 
270 void cWorld::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration, const cClientHandle * a_Exclude)
271 {
272  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
273  {
274  a_Client.SendEntityEffect(a_Entity, a_EffectID, a_Amplifier, a_Duration);
275  }
276  );
277 }
278 
279 
280 
281 
282 
283 void cWorld::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude)
284 {
285  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
286  {
287  a_Client.SendEntityEquipment(a_Entity, a_SlotNum, a_Item);
288  }
289  );
290 }
291 
292 
293 
294 
295 
296 void cWorld::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
297 {
298  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
299  {
300  a_Client.SendEntityHeadLook(a_Entity);
301  }
302  );
303 }
304 
305 
306 
307 
308 
309 void cWorld::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
310 {
311  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
312  {
313  a_Client.SendEntityLook(a_Entity);
314  }
315  );
316 }
317 
318 
319 
320 
321 
322 void cWorld::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude)
323 {
324  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
325  {
326  a_Client.SendEntityMetadata(a_Entity);
327  }
328  );
329 }
330 
331 
332 
333 
334 
335 void cWorld::BroadcastEntityPosition(const cEntity & a_Entity, const cClientHandle * a_Exclude)
336 {
337  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
338  {
339  a_Client.SendEntityPosition(a_Entity);
340  }
341  );
342 }
343 
344 
345 
346 
347 
349 {
350  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
351  {
352  a_Client.SendEntityProperties(a_Entity);
353  }
354  );
355 }
356 
357 
358 
359 
360 
361 void cWorld::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
362 {
363  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
364  {
365  a_Client.SendEntityVelocity(a_Entity);
366  }
367  );
368 }
369 
370 
371 
372 
373 
374 void cWorld::BroadcastEntityAnimation(const cEntity & a_Entity, EntityAnimation a_Animation, const cClientHandle * a_Exclude)
375 {
376  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
377  {
378  a_Client.SendEntityAnimation(a_Entity, a_Animation);
379  }
380  );
381 }
382 
383 
384 
385 
386 
387 void cWorld::BroadcastLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo)
388 {
389  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
390  {
391  a_Client.SendLeashEntity(a_Entity, a_EntityLeashedTo);
392  }
393  );
394 }
395 
396 
397 
398 
399 
400 void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude)
401 {
402  ForClientsWithChunkAtPos(a_Src, *this, a_Exclude, [&](cClientHandle & a_Client)
403  {
404  a_Client.SendParticleEffect(a_ParticleName, a_Src, a_Offset, a_ParticleData, a_ParticleAmount);
405  }
406  );
407 }
408 
409 
410 
411 
412 
413 void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude)
414 {
415  ForClientsWithChunkAtPos(a_Src, *this, a_Exclude, [&](cClientHandle & a_Client)
416  {
417  a_Client.SendParticleEffect(a_ParticleName, a_Src, a_Offset, a_ParticleData, a_ParticleAmount, a_Data);
418  }
419  );
420 }
421 
422 
423 
424 
425 
426 void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
427 {
428  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
429  {
430  a_Client.SendPlayerListAddPlayer(a_Player);
431  }
432  );
433 }
434 
435 
436 
437 
438 
440 {
441  ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
442  {
443  a_Client.SendPlayerListHeaderFooter(a_Header, a_Footer);
444  }
445  );
446 }
447 
448 
449 
450 
451 
452 void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
453 {
454  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
455  {
456  a_Client.SendPlayerListRemovePlayer(a_Player);
457  }
458  );
459 }
460 
461 
462 
463 
464 
465 void cWorld::BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName, const cClientHandle * a_Exclude)
466 {
467  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
468  {
469  a_Client.SendPlayerListUpdateDisplayName(a_Player, a_CustomName);
470  }
471  );
472 }
473 
474 
475 
476 
477 
478 void cWorld::BroadcastPlayerListUpdateGameMode(const cPlayer & a_Player, const cClientHandle * a_Exclude)
479 {
480  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
481  {
482  a_Client.SendPlayerListUpdateGameMode(a_Player);
483  }
484  );
485 }
486 
487 
488 
489 
490 
492 {
493  ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
494  {
495  a_Client.SendPlayerListUpdatePing();
496  }
497  );
498 }
499 
500 
501 
502 
503 
504 void cWorld::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude)
505 {
506  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
507  {
508  a_Client.SendRemoveEntityEffect(a_Entity, a_EffectID);
509  }
510  );
511 }
512 
513 
514 
515 
516 
517 void cWorld::BroadcastScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode)
518 {
519  ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
520  {
521  a_Client.SendScoreboardObjective(a_Name, a_DisplayName, a_Mode);
522  }
523  );
524 }
525 
526 
527 
528 
529 
530 void cWorld::BroadcastScoreUpdate(const AString & a_Objective, const AString & a_PlayerName, cObjective::Score a_Score, Byte a_Mode)
531 {
532  ForClientsInWorld(*this, nullptr, [&](cClientHandle & a_Client)
533  {
534  a_Client.SendScoreUpdate(a_Objective, a_PlayerName, a_Score, a_Mode);
535  }
536  );
537 }
538 
539 
540 
541 
542 
543 void cWorld::BroadcastSoundEffect(const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude)
544 {
545  ForClientsWithChunkAtPos(a_Position, *this, a_Exclude, [&](cClientHandle & a_Client)
546  {
547  a_Client.SendSoundEffect(a_SoundName, a_Position, a_Volume, a_Pitch);
548  }
549  );
550 }
551 
552 
553 
554 
555 
556 void cWorld::BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude)
557 {
558  ForClientsWithChunkAtPos(a_SrcPos, *this, a_Exclude, [&](cClientHandle & a_Client)
559  {
560  a_Client.SendSoundParticleEffect(a_EffectID, a_SrcPos, a_Data);
561  }
562  );
563 }
564 
565 
566 
567 
568 
569 void cWorld::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude)
570 {
571  ForClientsWithEntity(a_Entity, *this, a_Exclude, [&](cClientHandle & a_Client)
572  {
573  a_Entity.SpawnOn(a_Client);
574  }
575  );
576 }
577 
578 
579 
580 
581 
582 void cWorld::BroadcastThunderbolt(Vector3i a_BlockPos, const cClientHandle * a_Exclude)
583 {
584  ForClientsWithChunkAtPos(a_BlockPos, *this, a_Exclude, [&](cClientHandle & a_Client)
585  {
586  a_Client.SendThunderbolt(a_BlockPos);
587  }
588  );
589 }
590 
591 
592 
593 
594 
596 {
597  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
598  {
600  }
601  );
602 }
603 
604 
605 
606 
607 
609 {
610  ForClientsWithEntity(a_Entity, *this, nullptr, [&](cClientHandle & a_Client)
611  {
612  a_Client.SendUnleashEntity(a_Entity);
613  }
614  );
615 }
616 
617 
618 
619 
620 
621 void cWorld::BroadcastWeather(eWeather a_Weather, const cClientHandle * a_Exclude)
622 {
623  ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
624  {
625  a_Client.SendWeather(a_Weather);
626  }
627  );
628 }
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
eWeather
Definition: Defines.h:160
EntityAnimation
Definition: Defines.h:458
eMessageType
Definition: Defines.h:352
@ mtDeath
Definition: Defines.h:362
EffectID
Definition: EffectID.h:6
unsigned int UInt32
Definition: Globals.h:157
signed char Int8
Definition: Globals.h:154
unsigned char Byte
Definition: Globals.h:161
std::string AString
Definition: StringUtils.h:11
Definition: Chunk.h:36
cBlockEntity * GetBlockEntity(Vector3i a_AbsPos)
Returns the block entity at the specified (absolute) coords.
Definition: Chunk.cpp:1418
const auto & GetAllClients(void) const
Definition: Chunk.h:443
Wraps the chunk coords into a single structure.
Definition: ChunkDef.h:57
int m_ChunkZ
Definition: ChunkDef.h:60
int m_ChunkX
Definition: ChunkDef.h:59
static void BlockToChunk(int a_X, int a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords to chunk coords:
Definition: ChunkDef.h:210
bool IsLoggedIn(void) const
Definition: ClientHandle.h:137
void SendParticleEffect(const AString &a_ParticleName, Vector3f a_Source, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount)
void SendLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo)
void SendEntityProperties(const cEntity &a_Entity)
void SendEntityHeadLook(const cEntity &a_Entity)
void SendPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName)
void SendDestroyEntity(const cEntity &a_Entity)
void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode)
void SendThunderbolt(Vector3i a_BlockPos)
void SendPlayerListUpdateGameMode(const cPlayer &a_Player)
void SendEntityPosition(const cEntity &a_Entity)
void SendSoundParticleEffect(const EffectID a_EffectID, Vector3i a_Source, int a_Data)
void SendScoreUpdate(const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode)
void SendTimeUpdate(cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle)
bool IsDestroyed(void) const
Definition: ClientHandle.h:148
void SendUnleashEntity(const cEntity &a_Entity)
void SendWeather(eWeather a_Weather)
void SendPlayerListHeaderFooter(const cCompositeChat &a_Header, const cCompositeChat &a_Footer)
void SendBlockBreakAnim(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage)
void SendSoundEffect(const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
void SendEntityMetadata(const cEntity &a_Entity)
void SendRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID)
void SendPlayerListUpdatePing()
void SendEntityVelocity(const cEntity &a_Entity)
void SendEntityEquipment(const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item)
void SendEntityEffect(const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration)
void SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
void SendBossBarUpdateHealth(UInt32 a_UniqueID, float a_FractionFilled)
void SendDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle)
void SendPlayerListAddPlayer(const cPlayer &a_Player)
void SendEntityLook(const cEntity &a_Entity)
void SendCollectEntity(const cEntity &a_Collected, const cEntity &a_Collector, unsigned a_Count)
void SendDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display)
void SendChat(const AString &a_Message, eMessageType a_ChatPrefix, const AString &a_AdditionalData="")
void SendPlayerListRemovePlayer(const cPlayer &a_Player)
void SendEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation)
void SendAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle)
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:34
Definition: Entity.h:76
int GetChunkZ(void) const
Definition: Entity.h:208
cChunk * GetParentChunk()
Returns the chunk responsible for ticking this entity.
Definition: Entity.h:541
int GetChunkX(void) const
Definition: Entity.h:207
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...
Definition: Player.h:29
cClientHandle * GetClientHandle(void) const
Definition: Player.h:276
Definition: Item.h:37
Definition: World.h:53
virtual void BroadcastUnleashEntity(const cEntity &a_Entity) override
virtual void BroadcastScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
virtual void BroadcastThunderbolt(Vector3i a_BlockPos, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastPlayerListUpdateGameMode(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
void BroadcastEntityProperties(const cEntity &a_Entity)
virtual void BroadcastPlayerListUpdatePing() override
bool DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback)
Calls the callback for the chunk at the block position specified, with ChunkMapCS locked.
Definition: World.cpp:1460
virtual void BroadcastTimeUpdate(const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle) override
virtual void BroadcastAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle) override
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastPlayerListAddPlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation, const cClientHandle *a_Exclude=nullptr) override
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback)
Calls the callback for the chunk specified, with ChunkMapCS locked.
Definition: World.cpp:1451
virtual void BroadcastCollectEntity(const cEntity &a_Collected, const cEntity &a_Collector, unsigned a_Count, const cClientHandle *a_Exclude=nullptr) override
virtual cTickTimeLong GetWorldAge(void) const override
Definition: World.cpp:491
virtual void BroadcastPlayerListHeaderFooter(const cCompositeChat &a_Header, const cCompositeChat &a_Footer) override
virtual void BroadcastEntityHeadLook(const cEntity &a_Entity, 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, const cClientHandle *a_Exclude=nullptr) override
bool ShouldBroadcastDeathMessages(void) const
Definition: World.h:717
virtual void BroadcastBossBarUpdateHealth(const cEntity &a_Entity, UInt32 a_UniqueID, float a_FractionFilled) override
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, 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 BroadcastSpawnEntity(cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName, const cClientHandle *a_Exclude=nullptr) override
virtual bool IsDaylightCycleEnabled(void) const
Is the daylight cycle enabled?
Definition: World.h:89
virtual void BroadcastEntityLook(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityVelocity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastWeather(eWeather a_Weather, 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.
virtual void BroadcastLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo) override
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastChat(const AString &a_Message, const cClientHandle *a_Exclude=nullptr, eMessageType a_ChatPrefix=mtCustom) override
virtual void BroadcastBlockAction(Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityPosition(const cEntity &a_Entity, 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 BroadcastDestroyEntity(const cEntity &a_Entity, 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
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
cTickTimeLong GetWorldDate() const
Definition: World.cpp:500
virtual void BroadcastPlayerListRemovePlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display) override
virtual bool ForEachPlayer(cPlayerListCallback a_Callback) override
Calls the callback for each player in the list; returns true if all players processed,...
Definition: World.cpp:2266
virtual void BroadcastRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID, const cClientHandle *a_Exclude=nullptr) override
A simple RAII locker for the chunkmap - locks the chunkmap in its constructor, unlocks it in the dest...
Definition: World.h:60