Cuberite
A lightweight, fast and extensible game server for Minecraft
World.h
Go to the documentation of this file.
1 
2 #pragma once
3 
5 #include "ChunkMap.h"
7 #include "ChunkGeneratorThread.h"
8 #include "ChunkSender.h"
9 #include "Defines.h"
10 #include "LightingThread.h"
11 #include "IniFile.h"
12 #include "Item.h"
13 #include "Mobs/Monster.h"
15 #include "Entities/Boat.h"
16 #include "ForEachChunkProvider.h"
17 #include "Scoreboard.h"
18 #include "MapManager.h"
19 #include "Blocks/WorldInterface.h"
21 #include "EffectID.h"
22 
23 
24 
25 
26 
27 class cFireSimulator;
28 class cFluidSimulator;
29 class cSandSimulator;
30 class cRedstoneSimulator;
31 class cItem;
32 class cPlayer;
33 class cClientHandle;
34 class cEntity;
35 class cChunkGenerator; // The thread responsible for generating chunks
36 class cCuboid;
37 class cCompositeChat;
38 class cDeadlockDetect;
39 class cUUID;
40 
41 struct SetChunkData;
42 
43 
44 
45 
46 
47 class cWorld // tolua_export
48  final:
49  public cForEachChunkProvider,
50  public cWorldInterface,
51  public cBroadcastInterface
52 // tolua_begin
53 {
54 public:
55  // tolua_end
56 
58  class cLock:
59  public cCSLock
60  {
61  using Super = cCSLock;
62  public:
63  cLock(const cWorld & a_World);
64  };
65 
70  cWorld(
71  const AString & a_WorldName, const AString & a_DataPath,
72  cDeadlockDetect & a_DeadlockDetect, const AStringVector & a_WorldNames,
73  eDimension a_Dimension = dimOverworld, const AString & a_LinkedOverworldName = {}
74  );
75 
76  virtual ~cWorld() override;
77 
78  // tolua_begin
79 
81  bool IsSavingEnabled(void) const { return m_IsSavingEnabled; }
82 
84  void SetSavingEnabled(bool a_IsSavingEnabled) { m_IsSavingEnabled = a_IsSavingEnabled; }
85 
86  int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; }
87 
89  virtual bool IsDaylightCycleEnabled(void) const { return m_IsDaylightCycleEnabled; }
90 
92  virtual void SetDaylightCycleEnabled(bool a_IsDaylightCycleEnabled)
93  {
94  m_IsDaylightCycleEnabled = a_IsDaylightCycleEnabled;
96  }
97 
98  void SetTicksUntilWeatherChange(int a_WeatherInterval)
99  {
100  m_WeatherInterval = a_WeatherInterval;
101  }
102 
105  int GetDefaultWeatherInterval(eWeather a_Weather) const;
106 
108  eGameMode GetGameMode(void) const { return m_GameMode; }
109 
111  bool IsGameModeCreative(void) const { return (m_GameMode == gmCreative); }
112 
114  bool IsGameModeSurvival(void) const { return (m_GameMode == gmSurvival); }
115 
117  bool IsGameModeAdventure(void) const { return (m_GameMode == gmAdventure); }
118 
120  bool IsGameModeSpectator(void) const { return (m_GameMode == gmSpectator); }
121 
122  bool IsPVPEnabled(void) const { return m_bEnabledPVP; }
123 
126 
127  bool IsDeepSnowEnabled(void) const { return m_IsDeepSnowEnabled; }
128 
129  bool ShouldLavaSpawnFire(void) const { return m_ShouldLavaSpawnFire; }
130 
132 
133  virtual eDimension GetDimension(void) const override { return m_Dimension; }
134 
136  virtual int GetHeight(int a_BlockX, int a_BlockZ) override;
137 
138  // tolua_end
139 
140  virtual cTickTime GetTimeOfDay(void) const override;
141  virtual cTickTimeLong GetWorldAge(void) const override;
142  cTickTimeLong GetWorldDate() const;
144 
145  virtual void SetTimeOfDay(cTickTime a_TimeOfDay) override;
146 
148  bool TryGetHeight(int a_BlockX, int a_BlockZ, int & a_Height); // Exported in ManualBindings.cpp
149 
150  // Broadcast respective packets to all clients of the chunk where the event is taking place
151  // Implemented in Broadcaster.cpp
152  // (Please keep these alpha-sorted)
153  virtual void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
154  virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
155  virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle * a_Exclude = nullptr) override;
156  virtual void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override;
157  virtual void BroadcastBossBarUpdateHealth(const cEntity & a_Entity, UInt32 a_UniqueID, float a_FractionFilled) override;
158 
159  // tolua_begin
160  virtual void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = nullptr, eMessageType a_ChatPrefix = mtCustom) override;
161  virtual void BroadcastChatInfo (const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtInformation); }
162  virtual void BroadcastChatFailure(const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtFailure); }
163  virtual void BroadcastChatSuccess(const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtSuccess); }
164  virtual void BroadcastChatWarning(const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtWarning); }
165  virtual void BroadcastChatFatal (const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtFailure); }
166  virtual void BroadcastChatDeath (const AString & a_Message, const cClientHandle * a_Exclude = nullptr) override { BroadcastChat(a_Message, a_Exclude, mtDeath); }
167  virtual void BroadcastChat (const cCompositeChat & a_Message, const cClientHandle * a_Exclude = nullptr) override;
168  // tolua_end
169 
170  virtual void BroadcastCollectEntity (const cEntity & a_Collected, const cEntity & a_Collector, unsigned a_Count, const cClientHandle * a_Exclude = nullptr) override;
171  virtual void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
172  virtual void BroadcastDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override;
173  virtual void BroadcastEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration, const cClientHandle * a_Exclude = nullptr) override;
174  virtual void BroadcastEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude = nullptr) override;
175  virtual void BroadcastEntityHeadLook (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
176  virtual void BroadcastEntityLook (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
177  virtual void BroadcastEntityMetadata (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
178  virtual void BroadcastEntityPosition (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
179  void BroadcastEntityProperties (const cEntity & a_Entity);
180  virtual void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
181  virtual void BroadcastEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
182  virtual void BroadcastLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
183  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; // Exported in ManualBindings_World.cpp
184  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; // Exported in ManualBindings_World.cpp
185  virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
186  virtual void BroadcastPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) override; // tolua_export
187  virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
188  virtual void BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName, const cClientHandle * a_Exclude = nullptr) override;
189  virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
190  virtual void BroadcastPlayerListUpdatePing () override;
191  virtual void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = nullptr) override;
192  virtual void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
193  virtual void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
194  virtual void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
195  virtual void BroadcastSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
196  virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
197  virtual void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
198  virtual void BroadcastThunderbolt (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override;
199  virtual void BroadcastTimeUpdate (const cClientHandle * a_Exclude = nullptr) override;
200  virtual void BroadcastUnleashEntity (const cEntity & a_Entity) override;
201  virtual void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = nullptr) override;
202 
203  virtual cBroadcastInterface & GetBroadcastManager(void) override
204  {
205  return *this;
206  }
207 
209  void SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
210 
211  void MarkChunkDirty (int a_ChunkX, int a_ChunkZ);
212  void MarkChunkSaving(int a_ChunkX, int a_ChunkZ);
213  void MarkChunkSaved (int a_ChunkX, int a_ChunkZ);
214 
217  void QueueSetChunkData(SetChunkData && a_SetChunkData);
218 
219  void ChunkLighted(
220  int a_ChunkX, int a_ChunkZ,
221  const cChunkDef::BlockNibbles & a_BlockLight,
222  const cChunkDef::BlockNibbles & a_SkyLight
223  );
224 
227  bool GetChunkData(cChunkCoords a_Coords, cChunkDataCallback & a_Callback) const;
228 
230  bool IsChunkQueued(int a_ChunkX, int a_ChunkZ) const;
231 
233  bool IsChunkValid(int a_ChunkX, int a_ChunkZ) const;
234 
235  bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const;
236 
238  void QueueUnloadUnusedChunks(void); // tolua_export
239 
240  void CollectPickupsByEntity(cEntity & a_Entity);
241 
243  virtual bool ForEachPlayer(cPlayerListCallback a_Callback) override; // >> EXPORTED IN MANUALBINDINGS <<
244 
247  bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
248 
250  bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
251 
253  bool DoWithNearestPlayer(Vector3d a_Pos, double a_RangeLimit, cPlayerListCallback a_Callback, bool a_CheckLineOfSight = true, bool a_IgnoreSpectator = true);
254 
256  bool DoWithPlayerByUUID(const cUUID & a_PlayerUUID, cPlayerListCallback a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
257 
258  void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player
259 
263  void AddEntity(OwnedEntity a_Entity, cWorld * a_OldWorld = nullptr);
264 
267  OwnedEntity RemoveEntity(cEntity & a_Entity);
268 
270  bool ForEachEntity(cEntityCallback a_Callback); // Exported in ManualBindings.cpp
271 
273  bool ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback a_Callback); // Exported in ManualBindings.cpp
274 
278  virtual bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback) override; // Exported in ManualBindings.cpp
279 
281  size_t GetPlayerCount() const;
282 
285  bool DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback a_Callback); // Exported in ManualBindings.cpp
286 
288  void CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback);
289 
291  bool AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
292 
294  void RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
295 
297  void RemoveClientFromChunks(cClientHandle * a_Client);
298 
301  void SendChunkTo(int a_ChunkX, int a_ChunkZ, cChunkSender::Priority a_Priority, cClientHandle * a_Client);
302 
305  void ForceSendChunkTo(int a_ChunkX, int a_ChunkZ, cChunkSender::Priority a_Priority, cClientHandle * a_Client);
306 
311  void PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallAfter = {});
312 
314  void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ);
315 
317  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); // Exported in ManualBindings.cpp
318 
320  bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command); // tolua_export
321  bool SetCommandBlockCommand(Vector3i a_BlockPos, const AString & a_Command)
322  {
323  return SetCommandBlockCommand(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Command);
324  }
325 
327  bool IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
328 
330  bool SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open); // tolua_export
331 
333  void RegenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
334 
336  void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
337 
339  void QueueLightChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_Callback = {});
340 
341  bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
342 
344  virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) override;
345 
347  bool ForEachLoadedChunk(cFunctionRef<bool(int, int)> a_Callback);
348 
351  void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
352 
356  void FastSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
357  {
358  m_ChunkMap.FastSetBlock(a_BlockPos, a_BlockType, a_BlockMeta);
359  }
360 
363  BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
364  {
365  return m_ChunkMap.GetBlock(a_BlockPos);
366  }
367 
370  NIBBLETYPE GetBlockMeta(Vector3i a_BlockPos) const
371  {
372  return m_ChunkMap.GetBlockMeta(a_BlockPos);
373  }
374 
377  void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_MetaData);
378 
382  NIBBLETYPE GetBlockSkyLight(Vector3i a_BlockPos) const;
383 
386  NIBBLETYPE GetBlockBlockLight(Vector3i a_BlockPos) const;
387 
392  bool GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
393 
397  bool GetBlockInfo(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) const;
398 
399  // TODO: NIBBLETYPE GetBlockActualLight(int a_BlockX, int a_BlockY, int a_BlockZ);
400 
406  virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override;
407 
408  // tolua_begin
409 
413  void SpawnItemPickups(const cItems & a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed = 1.0, bool a_IsPlayerCreated = false);
414 
417  void SpawnItemPickups(const cItems & a_Pickups, Vector3d a_Pos, double a_FlyAwaySpeed = 1.0, bool a_IsPlayerCreated = false);
418 
422  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
423  {
424  return SpawnItemPickups(a_Pickups, Vector3d{a_BlockX, a_BlockY, a_BlockZ}, a_FlyAwaySpeed, a_IsPlayerCreated);
425  }
426 
428  void SpawnItemPickups(const cItems & a_Pickups, Vector3d a_Pos, Vector3d a_Speed, bool a_IsPlayerCreated = false);
429 
432  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
433  {
434  return SpawnItemPickups(a_Pickups, {a_BlockX, a_BlockY, a_BlockZ}, {a_SpeedX, a_SpeedY, a_SpeedZ}, a_IsPlayerCreated);
435  }
436 
438  UInt32 SpawnItemPickup(Vector3d a_Pos, const cItem & a_Item, Vector3f a_Speed, int a_LifetimeTicks = 6000, bool a_CanCombine = true);
439 
442  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
443  {
444  return SpawnItemPickup({a_PosX, a_PosY, a_PosZ}, a_Item, {a_SpeedX, a_SpeedY, a_SpeedZ}, a_LifetimeTicks, a_CanCombine);
445  }
446 
449  UInt32 SpawnFallingBlock(Vector3d a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
450 
453  UInt32 SpawnFallingBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
454  {
455  // When creating from a block position (Vector3i), move the spawn point to the middle of the block by adding (0.5, 0, 0.5)
456  return SpawnFallingBlock(Vector3d(0.5, 0, 0.5) + a_BlockPos, a_BlockType, a_BlockMeta);
457  }
458 
462  UInt32 SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
463  {
464  return SpawnFallingBlock(Vector3i{a_X, a_Y, a_Z}, a_BlockType, a_BlockMeta);
465  }
466 
469  UInt32 SpawnMinecart(Vector3d a_Pos, int a_MinecartType, const cItem & a_Content = cItem(), int a_BlockHeight = 1);
470 
474  UInt32 SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, const cItem & a_Content = cItem(), int a_BlockHeight = 1)
475  {
476  return SpawnMinecart({a_X, a_Y, a_Z}, a_MinecartType, a_Content, a_BlockHeight);
477  }
478 
479  // DEPRECATED, use the vector-parametered version instead.
480  UInt32 SpawnBoat(double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material)
481  {
482  LOGWARNING("cWorld::SpawnBoat(double, double, double) is deprecated, use cWorld::SpawnBoat(Vector3d) instead.");
483  return SpawnBoat({a_X, a_Y, a_Z}, a_Material);
484  }
485 
488  UInt32 SpawnBoat(Vector3d a_Pos, cBoat::eMaterial a_Material);
489 
492  UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward);
493 
497  virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) override
498  {
499  return SpawnExperienceOrb({a_X, a_Y, a_Z}, a_Reward);
500  }
501 
502  // tolua_end
503 
506  virtual std::vector<UInt32> SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward) override; // Exported in ManualBindings_World.cpp
507 
511  std::vector<UInt32> SpawnSplitExperienceOrbs(double a_X, double a_Y, double a_Z, int a_Reward)
512  {
513  return SpawnSplitExperienceOrbs({a_X, a_Y, a_Z}, a_Reward);
514  }
515 
516  // tolua_begin
517 
518  // DEPRECATED, use the vector-parametered version instead.
519  UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1, bool a_ShouldPlayFuseSound = true)
520  {
521  LOGWARNING("cWorld::SpawnPrimedTNT(double, double, double) is deprecated, use cWorld::SpawnPrimedTNT(Vector3d) instead.");
522  return SpawnPrimedTNT({a_X, a_Y, a_Z}, a_FuseTimeInSec, a_InitialVelocityCoeff, a_ShouldPlayFuseSound);
523  }
524 
528  UInt32 SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1, bool a_ShouldPlayFuseSound = true);
529 
532  UInt32 SpawnEnderCrystal(Vector3d a_Pos, bool a_ShowBottom);
533 
534  // tolua_end
535 
539  void PlaceBlock(const Vector3i a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta);
540 
542  bool GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure);
543 
545 
546  // tolua_begin
547 
551  bool DigBlock(Vector3i a_BlockPos, const cEntity * a_Digger = nullptr);
552 
558  bool DigBlock(int a_X, int a_Y, int a_Z, cEntity * a_Digger = nullptr)
559  {
560  return DigBlock({a_X, a_Y, a_Z}, a_Digger);
561  }
562 
568  bool DropBlockAsPickups(Vector3i a_BlockPos, const cEntity * a_Digger = nullptr, const cItem * a_Tool = nullptr);
569 
575  cItems PickupsFromBlock(Vector3i a_BlockPos, const cEntity * a_Digger = nullptr, const cItem * a_Tool = nullptr);
576 
579  virtual void SendBlockTo(int a_X, int a_Y, int a_Z, const cPlayer & a_Player) override;
580 
583  bool SetSpawn(int a_X, int a_Y, int a_Z);
584 
585  int GetSpawnX(void) const { return m_SpawnX; }
586  int GetSpawnY(void) const { return m_SpawnY; }
587  int GetSpawnZ(void) const { return m_SpawnZ; }
588 
590  virtual void WakeUpSimulators(Vector3i a_Block) override;
591 
593  void WakeUpSimulatorsInArea(const cCuboid & a_Area);
594 
595  // tolua_end
596 
598 
602 
604  bool ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback a_Callback); // Exported in ManualBindings.cpp
605 
610  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;
611 
613  virtual bool DoWithBlockEntityAt(Vector3i a_Position, cBlockEntityCallback a_Callback) override; // Exported in ManualBindings.cpp
614 
616  bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Exported in ManualBindings.cpp
617 
619  void UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) { m_ChunkMap.UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); } // tolua_export
620 
623  bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback);
624 
627  bool DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback);
628 
632  bool GrowTreeImage(const sSetBlockVector & a_Blocks);
633 
639  bool GrowTree(Vector3i a_BlockPos);
640 
645  bool GrowTreeFromSapling(Vector3i a_BlockPos);
646 
650  bool GrowTreeByBiome(Vector3i a_BlockPos);
651 
652  // tolua_begin
653 
657  int GrowPlantAt(Vector3i a_BlockPos, int a_NumStages = 1);
658 
661  bool GrowRipePlant(Vector3i a_BlockPos);
662 
667  bool GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal = false)
668  {
669  UNUSED(a_IsByBonemeal);
670  LOGWARNING("Warning: cWorld:GrowRipePlant function expects Vector3i-based coords rather than int-based coords. Emulating old-style call.");
671  return GrowRipePlant({ a_BlockX, a_BlockY, a_BlockZ });
672  }
673 
675  EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ);
676 
679  bool SetBiomeAt(int a_BlockX, int a_BlockZ, EMCSBiome a_Biome);
680 
683  bool SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome);
684 
688  bool SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome);
689 
691  const AString & GetName(void) const { return m_WorldName; }
692 
694  const AString & GetDataPath(void) const { return m_DataPath; }
695 
697  const AString & GetIniFileName(void) const {return m_IniFileName; }
698 
701 
704 
706  void SetCommandBlocksEnabled(bool a_Flag) { m_bCommandBlocksEnabled = a_Flag; }
707 
710 
711  int GetMaxViewDistance(void) const { return m_MaxViewDistance; }
712  void SetMaxViewDistance(int a_MaxViewDistance);
713 
714  bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
715  void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
716 
719 
720 
722  void SetLinkedNetherWorldName(const AString & a_Name) { m_LinkedNetherWorldName = a_Name; }
723 
725  void SetLinkedEndWorldName(const AString & a_Name) { m_LinkedEndWorldName = a_Name; }
726 
728  void SetLinkedOverworldName(const AString & a_Name) { m_LinkedOverworldName = a_Name; }
729 
731  virtual int GetMinNetherPortalWidth(void) const override { return m_MinNetherPortalWidth; }
732  virtual int GetMaxNetherPortalWidth(void) const override { return m_MaxNetherPortalWidth; }
733  virtual void SetMinNetherPortalWidth(int a_NewMinWidth) override { m_MinNetherPortalWidth = a_NewMinWidth; }
734  virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) override { m_MaxNetherPortalWidth = a_NewMaxWidth; }
735 
737  virtual int GetMinNetherPortalHeight(void) const override { return m_MinNetherPortalHeight; }
738  virtual int GetMaxNetherPortalHeight(void) const override { return m_MaxNetherPortalHeight; }
739  virtual void SetMinNetherPortalHeight(int a_NewMinHeight) override { m_MinNetherPortalHeight = a_NewMinHeight; }
740  virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) override { m_MaxNetherPortalHeight = a_NewMaxHeight; }
741 
742  // tolua_end
743 
745  void SaveAllChunks(void);
746 
748  void QueueSaveAllChunks(void); // tolua_export
749 
751  void QueueTask(std::function<void(cWorld &)> a_Task); // Exported in ManualBindings.cpp
752 
754  void ScheduleTask(cTickTime a_DelayTicks, std::function<void(cWorld &)> a_Task);
755 
757  size_t GetNumChunks() const; // tolua_export
758 
760  size_t GetNumUnusedDirtyChunks(void) const; // tolua_export
761 
763  void GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue);
764 
765  // Various queues length queries (cannot be const, they lock their CS):
766  inline size_t GetGeneratorQueueLength (void) { return m_Generator.GetQueueLength(); } // tolua_export
767  inline size_t GetLightingQueueLength (void) { return m_Lighting.GetQueueLength(); } // tolua_export
768  inline size_t GetStorageLoadQueueLength(void) { return m_Storage.GetLoadQueueLength(); } // tolua_export
769  inline size_t GetStorageSaveQueueLength(void) { return m_Storage.GetSaveQueueLength(); } // tolua_export
770 
772 
773  void InitializeSpawn(void);
774 
776  void Start();
777 
780  void Stop(cDeadlockDetect & a_DeadlockDetect);
781 
783  void TickQueuedBlocks(void);
784 
786  {
787  int X;
788  int Y;
789  int Z;
791  };
792 
794  void QueueBlockForTick(int a_BlockX, int a_BlockY, int a_BlockZ, int a_TicksToWait); // tolua_export
795 
796  // tolua_begin
798  void CastThunderbolt(Vector3i a_Block);
799  void CastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ); // DEPRECATED, use vector-parametered version instead
800 
802  void SetWeather(eWeather a_NewWeather);
803 
805  void ChangeWeather(void);
806 
808  eWeather GetWeather(void) const { return m_Weather; }
809 
811  bool IsWeatherSunny(void) const { return (m_Weather == wSunny); }
812 
814  bool IsWeatherSunnyAt(int a_BlockX, int a_BlockZ) const;
815 
817  bool IsWeatherRain(void) const { return (m_Weather == wRain); }
818 
820  bool IsWeatherRainAt(int a_BlockX, int a_BlockZ)
821  {
822  return (IsWeatherRain() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ)));
823  }
824 
826  bool IsWeatherStorm(void) const { return (m_Weather == wStorm); }
827 
829  bool IsWeatherStormAt(int a_BlockX, int a_BlockZ)
830  {
831  return (IsWeatherStorm() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ)));
832  }
833 
835  bool IsWeatherWet(void) const { return !IsWeatherSunny(); }
836 
839  virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) override;
840 
843  virtual bool IsWeatherWetAtXYZ(Vector3i a_Position) override;
844 
846  int GetSeed(void) { return m_Generator.GetSeed(); }
847 
848  // tolua_end
849 
851  cWorldStorage & GetStorage (void) { return m_Storage; }
852  cChunkMap * GetChunkMap (void) { return &m_ChunkMap; }
853 
856  void SetNextBlockToTick(const Vector3i a_BlockPos); // tolua_export
857 
858  int GetMaxSugarcaneHeight(void) const { return m_MaxSugarcaneHeight; } // tolua_export
859  int GetMaxCactusHeight (void) const { return m_MaxCactusHeight; } // tolua_export
860 
861  bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
862 
864  virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby = false) override; // tolua_export
865 
868  UInt32 SpawnMobFinalize(std::unique_ptr<cMonster> a_Monster);
869 
872  UInt32 CreateProjectile(Vector3d a_Pos, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed = nullptr); // tolua_export
873 
877  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); // tolua_export
878 
880  int GetTickRandomNumber(int a_Range);
881 
883  void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
884 
887 
893  void SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked = true); // tolua_export
894 
895 private:
896 
897  class cTickThread:
898  public cIsThread
899  {
900  using Super = cIsThread;
901 
902  public:
903 
904  cTickThread(cWorld & a_World);
905 
906  protected:
908 
909  // cIsThread overrides:
910  virtual void Execute(void) override;
911  } ;
912 
913 
914 
919  {
921 
922  // cChunkSink overrides:
923  virtual void OnChunkGenerated (cChunkDesc & a_ChunkDesc) override;
924  virtual bool IsChunkValid (cChunkCoords a_Coords) override;
925  virtual bool HasChunkAnyClients(cChunkCoords a_Coords) override;
926  virtual bool IsChunkQueued (cChunkCoords a_Coords) override;
927 
928  // cPluginInterface overrides:
929  virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) override;
930  virtual void CallHookChunkGenerated (cChunkDesc & a_ChunkDesc) override;
931 
932  public:
933  cChunkGeneratorCallbacks(cWorld & a_World);
934  } ;
935 
936 
941 
943 
946 
950 
952 
955 
957 
959  std::atomic<bool> m_IsSavingEnabled;
960 
963 
965  int m_SpawnX;
966  int m_SpawnY;
967  int m_SpawnZ;
968 
969  // Variables defining the minimum and maximum size for a nether portal
974 
977 
979 
983  std::chrono::milliseconds m_WorldAge;
984 
988  std::chrono::milliseconds m_WorldDate;
989 
994 
995  std::chrono::milliseconds m_LastChunkCheck; // The last WorldAge in which unloading and possibly saving was triggered.
996  std::chrono::milliseconds m_LastSave; // The last WorldAge in which save-all was triggerred.
997  std::map<cMonster::eFamily, cTickTimeLong> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
998 
1000 
1007 
1008  std::vector<BlockTickQueueItem *> m_BlockTickQueue;
1009  std::vector<BlockTickQueueItem *> m_BlockTickQueueCopy; // Second is for safely removing the objects from the queue
1010 
1011  std::unique_ptr<cSimulatorManager> m_SimulatorManager;
1012  std::unique_ptr<cSandSimulator> m_SandSimulator;
1015  std::unique_ptr<cFireSimulator> m_FireSimulator;
1017 
1018  // Protect with chunk map CS
1019  std::vector<cPlayer *> m_Players;
1020 
1022 
1023  unsigned int m_MaxPlayers;
1024 
1026 
1028  std::set<eMonsterType> m_AllowedMobs;
1029 
1035 
1038  /* TODO: Enable when functionality exists again
1039  bool m_IsBeetrootsBonemealable;
1040  bool m_IsCactusBonemealable;
1041  bool m_IsCarrotsBonemealable;
1042  bool m_IsCropsBonemealable;
1043  bool m_IsGrassBonemealable;
1044  bool m_IsMelonStemBonemealable;
1045  bool m_IsMelonBonemealable;
1046  bool m_IsPotatoesBonemealable;
1047  bool m_IsPumpkinStemBonemealable;
1048  bool m_IsPumpkinBonemealable;
1049  bool m_IsSaplingBonemealable;
1050  bool m_IsSugarcaneBonemealable;
1051  bool m_IsBigFlowerBonemealable;
1052  bool m_IsTallGrassBonemealable;
1053  */
1054 
1057 
1060 
1065 
1068 
1072 
1076 
1079 
1082 
1085 
1089 
1092 
1094  std::vector<std::pair<std::chrono::milliseconds, std::function<void(cWorld &)>>> m_Tasks;
1095 
1098 
1100  std::vector<std::pair<OwnedEntity, cWorld *>> m_EntitiesToAdd;
1101 
1104 
1106  std::vector<SetChunkData> m_SetChunkDataQueue;
1107 
1108  void Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec);
1109 
1111  void TickWeather(float a_Dt);
1112 
1114  void TickMobs(std::chrono::milliseconds a_Dt);
1115 
1117  void TickQueuedChunkDataSets();
1118 
1121  void TickQueuedEntityAdditions(void);
1122 
1124  void TickQueuedTasks(void);
1125 
1127  void UnloadUnusedChunks(void);
1128 
1129  void UpdateSkyDarkness(void);
1130 
1132  void GenerateRandomSpawn(int a_MaxSpawnRadius);
1133 
1136  bool CanSpawnAt(int a_X, int & a_Y, int a_Z);
1137 
1139  bool CheckPlayerSpawnPoint(int a_PosX, int a_PosY, int a_PosZ)
1140  {
1141  return CheckPlayerSpawnPoint({a_PosX, a_PosY, a_PosZ});
1142  }
1143  bool CheckPlayerSpawnPoint(Vector3i a_Pos);
1144 
1146  eWeather ChooseNewWeather(void);
1147 
1149  cFluidSimulator * InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock);
1150 
1153 
1155  void InitializeAndLoadMobSpawningValues(cIniFile & a_IniFile);
1156 
1160  bool GetLargeTreeAdjustment(Vector3i & a_BlockPos, NIBBLETYPE a_SaplingMeta);
1161 }; // tolua_export
cWorld::cTickThread
Definition: World.h:897
cWorld::GetSpawnX
int GetSpawnX(void) const
Definition: World.h:585
cWorld::GetIniFileName
const AString & GetIniFileName(void) const
Returns the name of the world.ini file used by this world.
Definition: World.h:697
WorldStorage.h
cWorld::cChunkGeneratorCallbacks::IsChunkValid
virtual bool IsChunkValid(cChunkCoords a_Coords) override
Called just before the chunk generation is started, to verify that it hasn't been generated in the me...
Definition: World.cpp:3174
cWorld::RemoveClientFromChunks
void RemoveClientFromChunks(cClientHandle *a_Client)
Removes the client from all chunks it is present in.
Definition: World.cpp:2500
eShrapnelLevel
eShrapnelLevel
Definition: Defines.h:326
cClientHandle
Definition: ClientHandle.h:49
cWorld::m_WorldAge
std::chrono::milliseconds m_WorldAge
The age of the world.
Definition: World.h:983
cWorld::m_BlockTickQueue
std::vector< BlockTickQueueItem * > m_BlockTickQueue
Definition: World.h:1008
cWorld::BroadcastUnleashEntity
virtual void BroadcastUnleashEntity(const cEntity &a_Entity) override
Definition: Broadcaster.cpp:608
cWorld::BroadcastWeather
virtual void BroadcastWeather(eWeather a_Weather, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:621
cChunkDesc
Definition: ChunkDesc.h:27
cForEachChunkProvider
Definition: ForEachChunkProvider.h:24
cWorld::GetLightingQueueLength
size_t GetLightingQueueLength(void)
Definition: World.h:767
cWorld::SpawnMobFinalize
UInt32 SpawnMobFinalize(std::unique_ptr< cMonster > a_Monster)
Wraps cEntity::Initialize, doing Monster-specific things before spawning the monster.
Definition: World.cpp:2904
cWorld::m_bCommandBlocksEnabled
bool m_bCommandBlocksEnabled
Whether command blocks are enabled or not.
Definition: World.h:1056
cWorld::GetBroadcastManager
virtual cBroadcastInterface & GetBroadcastManager(void) override
Definition: World.h:203
cRedstoneSimulator
Definition: RedstoneSimulator.h:23
cWorld::GetChunkStats
void GetChunkStats(int &a_NumValid, int &a_NumDirty, int &a_NumInLightingQueue)
Returns the number of chunks loaded and dirty, and in the lighting queue.
Definition: World.cpp:2814
cUUID
Definition: UUID.h:10
cWorld::SetSavingEnabled
void SetSavingEnabled(bool a_IsSavingEnabled)
Set whether saving chunks is enabled.
Definition: World.h:84
cWorld::IsBlockDirectlyWatered
bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ)
Definition: World.cpp:2869
cWorld::FastSetBlock
void FastSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
Definition: World.h:356
Vector3::x
T x
Definition: Vector3.h:17
sSetBlockVector
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:424
cWorldStorage::GetSaveQueueLength
size_t GetSaveQueueLength(void)
Definition: WorldStorage.cpp:132
cWorld::GenerateRandomSpawn
void GenerateRandomSpawn(int a_MaxSpawnRadius)
Generates a random spawnpoint on solid land by walking chunks and finding their biomes.
Definition: World.cpp:700
cWorld::BroadcastBossBarUpdateHealth
virtual void BroadcastBossBarUpdateHealth(const cEntity &a_Entity, UInt32 a_UniqueID, float a_FractionFilled) override
Definition: Broadcaster.cpp:174
cWorld::SetTNTShrapnelLevel
void SetTNTShrapnelLevel(eShrapnelLevel a_Flag)
Definition: World.h:709
cWorld::m_EntitiesToAdd
std::vector< std::pair< OwnedEntity, cWorld * > > m_EntitiesToAdd
List of entities that are scheduled for adding, waiting for the Tick thread to add them.
Definition: World.h:1100
cWorld::IsWeatherStorm
bool IsWeatherStorm(void) const
Returns true if the current weather is stormy.
Definition: World.h:826
cCompositeChat
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:33
cWorld::BroadcastLeashEntity
virtual void BroadcastLeashEntity(const cEntity &a_Entity, const cEntity &a_EntityLeashedTo) override
Definition: Broadcaster.cpp:387
eExplosionSource
eExplosionSource
The source of an explosion.
Definition: Defines.h:308
cCSLock::cCSLock
cCSLock(cCriticalSection *a_CS)
Definition: CriticalSection.cpp:66
cWorld::GetNumUnusedDirtyChunks
size_t GetNumUnusedDirtyChunks(void) const
Returns the number of unused dirty chunks.
Definition: World.cpp:2805
cWorld::CastThunderbolt
void CastThunderbolt(Vector3i a_Block)
Casts a thunderbolt at the specified coords.
Definition: World.cpp:470
cChunkGeneratorThread::GetQueueLength
size_t GetQueueLength() const
Definition: ChunkGeneratorThread.cpp:124
cWorld::SpawnSplitExperienceOrbs
virtual std::vector< UInt32 > SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward) override
Spawns experience orbs of the specified total value at the given location.
Definition: World.cpp:1901
cWorld::PlaceBlock
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.
Definition: World.cpp:2029
cWorld::m_FireSimulator
std::unique_ptr< cFireSimulator > m_FireSimulator
Definition: World.h:1015
cWorld::QueueLightChunk
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.
Definition: World.cpp:2662
BroadcastInterface.h
cWorld::IsWeatherWet
bool IsWeatherWet(void) const
Returns true if the world currently has any precipitation - rain, storm or snow.
Definition: World.h:835
IsBiomeNoDownfall
bool IsBiomeNoDownfall(EMCSBiome a_Biome)
Returns true if the biome has no downfall - deserts and savannas.
Definition: BiomeDef.cpp:142
cWorld::SpawnEnderCrystal
UInt32 SpawnEnderCrystal(Vector3d a_Pos, bool a_ShowBottom)
Spawns a new ender crystal at the specified block coords.
Definition: World.cpp:2014
cWorld::BroadcastEntityEquipment
virtual void BroadcastEntityEquipment(const cEntity &a_Entity, short a_SlotNum, const cItem &a_Item, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:283
cWorld::m_MaxRainTicks
int m_MaxRainTicks
Definition: World.h:1033
cWorld::BroadcastScoreUpdate
virtual void BroadcastScoreUpdate(const AString &a_Objective, const AString &a_Player, cObjective::Score a_Score, Byte a_Mode) override
Definition: Broadcaster.cpp:530
cWorld::m_AllowedMobs
std::set< eMonsterType > m_AllowedMobs
Definition: World.h:1028
cWorld::ForEachEntity
bool ForEachEntity(cEntityCallback a_Callback)
Calls the callback for each entity in the entire world; returns true if all entities processed,...
Definition: World.cpp:2413
cWorld::SpawnItemPickup
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.
Definition: World.h:442
cWorld::ChunkLoadFailed
void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ)
Marks the chunk as failed-to-load:
Definition: World.cpp:2537
cWorld::cTickThread::m_World
cWorld & m_World
Definition: World.h:907
cWorld::BroadcastDisplayObjective
virtual void BroadcastDisplayObjective(const AString &a_Objective, cScoreboard::eDisplaySlot a_Display) override
Definition: Broadcaster.cpp:257
cWorld::SetDaylightCycleEnabled
virtual void SetDaylightCycleEnabled(bool a_IsDaylightCycleEnabled)
Sets the daylight cycle to true / false.
Definition: World.h:92
cMapManager
Manages the in-game maps of a single world - Thread safe.
Definition: MapManager.h:28
cWorld::BroadcastPlayerListUpdateDisplayName
virtual void BroadcastPlayerListUpdateDisplayName(const cPlayer &a_Player, const AString &a_CustomName, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:465
cWorld::m_Players
std::vector< cPlayer * > m_Players
Definition: World.h:1019
cWorld::CollectPickupsByEntity
void CollectPickupsByEntity(cEntity &a_Entity)
Definition: World.cpp:2243
cWorld::GetLightingThread
cLightingThread & GetLightingThread(void)
Definition: World.h:771
cLightingThread
Definition: LightingThread.h:48
mtInformation
@ mtInformation
Definition: Defines.h:357
cWorld::GetScoreBoard
cScoreboard & GetScoreBoard(void)
Returns the associated scoreboard instance.
Definition: World.h:700
cWorld::BlockTickQueueItem
Definition: World.h:785
cWorld::m_GameMode
eGameMode m_GameMode
Definition: World.h:1001
cWorld::cTickThread::Execute
virtual void Execute(void) override
This function, overloaded by the descendants, is called in the new thread.
Definition: World.cpp:108
cWorld::ForEachChunkInRect
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).
Definition: World.cpp:2680
cWorld::GetSignLines
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 coo...
Definition: World.cpp:1415
cWorld::QueueSaveAllChunks
void QueueSaveAllChunks(void)
Queues a task to save all chunks onto the tick thread.
Definition: World.cpp:2711
cWorld::GetTickRandomNumber
int GetTickRandomNumber(int a_Range)
Returns a random number in range [0 .
Definition: World.cpp:2964
cWorld::m_IsDeepSnowEnabled
bool m_IsDeepSnowEnabled
Definition: World.h:1004
cWorld::SetCommandBlockCommand
bool SetCommandBlockCommand(Vector3i a_BlockPos, const AString &a_Command)
Definition: World.h:321
cChunkSender
Definition: ChunkSender.h:50
cBoundingBox
Represents two sets of coords, minimum and maximum for each direction.
Definition: BoundingBox.h:23
cWorld::Stop
void Stop(cDeadlockDetect &a_DeadlockDetect)
Stops threads that belong to this world (part of deinit).
Definition: World.cpp:956
cWorld::m_SpawnZ
int m_SpawnZ
Definition: World.h:967
EffectID.h
cWorld::VillagersShouldHarvestCrops
bool VillagersShouldHarvestCrops(void) const
Definition: World.h:131
OwnedEntity
std::unique_ptr< cEntity > OwnedEntity
Definition: ChunkDef.h:32
cWorld::m_SkyDarkness
NIBBLETYPE m_SkyDarkness
Definition: World.h:999
cWorld::GetLinkedEndWorldName
AString GetLinkedEndWorldName(void) const
Definition: World.h:724
cWorld::SetAreaBiome
bool SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome)
Sets the biome at the area.
Definition: World.cpp:1698
cWorld::InitializeRedstoneSimulator
cRedstoneSimulator * InitializeRedstoneSimulator(cIniFile &a_IniFile)
Creates a new redstone simulator.
Definition: World.cpp:3032
cWorld::m_TNTShrapnelLevel
eShrapnelLevel m_TNTShrapnelLevel
The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities See the eShra...
Definition: World.h:1064
cWorld::m_IniFileName
AString m_IniFileName
Definition: World.h:951
cWorld::InitializeAndLoadMobSpawningValues
void InitializeAndLoadMobSpawningValues(cIniFile &a_IniFile)
Sets mob spawning values if nonexistant to their dimension specific defaults.
Definition: World.cpp:917
cWorld::GetWorldAge
virtual cTickTimeLong GetWorldAge(void) const override
Definition: World.cpp:491
cWorld::IsChunkQueued
bool IsChunkQueued(int a_ChunkX, int a_ChunkZ) const
Returns true iff the chunk is in the loader / generator queue.
Definition: World.cpp:2197
cWorld::GetLavaSimulator
cFluidSimulator * GetLavaSimulator(void)
Definition: World.h:600
cWorld::GetDefaultWeatherInterval
int GetDefaultWeatherInterval(eWeather a_Weather) const
Returns the default weather interval for the specific weather type.
Definition: World.cpp:531
cWorld::m_MinSunnyTicks
int m_MinSunnyTicks
Definition: World.h:1032
cWorld::CanSpawnAt
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 s...
Definition: World.cpp:782
cWorld::SendBlockTo
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.
Definition: World.cpp:2100
cWorld::BroadcastSoundParticleEffect
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:556
cWorld::SpawnMob
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.
Definition: World.cpp:2883
cWorld::AddChunkClient
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.
Definition: World.cpp:2482
cWorld::BlockTickQueueItem::Y
int Y
Definition: World.h:788
cWorld::GetSeed
int GetSeed(void)
Returns the seed of the world.
Definition: World.h:846
gmSpectator
@ gmSpectator
Definition: Defines.h:137
cFluidSimulator
Definition: FluidSimulator.h:37
cWorld::TickQueuedBlocks
void TickQueuedBlocks(void)
Processes the blocks queued for ticking with a delay (m_BlockTickQueue[])
Definition: World.cpp:2824
cWorld::SetBlockMeta
void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_MetaData)
Sets the meta for the specified block, while keeping the blocktype.
Definition: World.cpp:1738
cWorld::GetTimeOfDay
virtual cTickTime GetTimeOfDay(void) const override
Definition: World.cpp:480
cWorld::TickWeather
void TickWeather(float a_Dt)
Handles the weather in each tick.
Definition: World.cpp:1075
cWorld::DoExplosionAt
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.
Definition: World.cpp:1371
cWorld::SetChunkAlwaysTicked
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 specifie...
Definition: World.cpp:3023
cIsThread
Definition: IsThread.h:23
cWorld::IsSavingEnabled
bool IsSavingEnabled(void) const
Get whether saving chunks is enabled.
Definition: World.h:81
cWorld::m_BlockTickQueueCopy
std::vector< BlockTickQueueItem * > m_BlockTickQueueCopy
Definition: World.h:1009
cWorld::m_CSTasks
cCriticalSection m_CSTasks
Guards the m_Tasks.
Definition: World.h:1091
cWorld::BroadcastChatFailure
virtual void BroadcastChatFailure(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:162
cWorld::m_MaxNetherPortalHeight
int m_MaxNetherPortalHeight
Definition: World.h:973
cFireSimulator
The fire simulator takes care of the fire blocks.
Definition: FireSimulator.h:18
cWorld::WakeUpSimulators
virtual void WakeUpSimulators(Vector3i a_Block) override
Wakes up the simulators for the specified block.
Definition: World.cpp:1344
cWorld::GetTNTShrapnelLevel
eShrapnelLevel GetTNTShrapnelLevel(void) const
Definition: World.h:708
cWorld::SetTicksUntilWeatherChange
void SetTicksUntilWeatherChange(int a_WeatherInterval)
Definition: World.h:98
cChunkMap::GetBlockMeta
NIBBLETYPE GetBlockMeta(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:494
cWorld::GetPlayerCount
size_t GetPlayerCount() const
Returns the number of players currently in this world.
Definition: World.cpp:2440
cWorld::~cWorld
virtual ~cWorld() override
Definition: World.cpp:449
cWorld::BroadcastSpawnEntity
virtual void BroadcastSpawnEntity(cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:569
cWorld::m_bAnimals
bool m_bAnimals
Definition: World.h:1027
cChunkGeneratorThread::cPluginInterface
The interface through which the plugins are called for their OnChunkGenerating / OnChunkGenerated hoo...
Definition: ChunkGeneratorThread.h:32
gmSurvival
@ gmSurvival
Definition: Defines.h:134
ChunkSender.h
cWorld::IsWeatherStormAt
bool IsWeatherStormAt(int a_BlockX, int a_BlockZ)
Returns true if the weather is stormy at the specified location.
Definition: World.h:829
cWorldInterface
Definition: WorldInterface.h:19
cBoat::eMaterial
eMaterial
Definition: Boat.h:28
cWorld::IsWeatherRain
bool IsWeatherRain(void) const
Returns true if the current weather is rainy.
Definition: World.h:817
cWorld::SpawnPrimedTNT
UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec=80, double a_InitialVelocityCoeff=1, bool a_ShouldPlayFuseSound=true)
Definition: World.h:519
cWorld::m_VillagersShouldHarvestCrops
bool m_VillagersShouldHarvestCrops
Definition: World.h:1006
mtDeath
@ mtDeath
Definition: Defines.h:361
cWorld::cChunkGeneratorCallbacks::cChunkGeneratorCallbacks
cChunkGeneratorCallbacks(cWorld &a_World)
Definition: World.cpp:3140
cWorld::GrowPlantAt
int GrowPlantAt(Vector3i a_BlockPos, int a_NumStages=1)
Grows the plant at the specified position by at most a_NumStages.
Definition: World.cpp:1662
cWorld::SendPlayerList
void SendPlayerList(cPlayer *a_DestPlayer)
Definition: World.cpp:2396
UInt32
unsigned int UInt32
Definition: Globals.h:154
cWorld::BroadcastTimeUpdate
virtual void BroadcastTimeUpdate(const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:595
WorldInterface.h
cWorld::cChunkGeneratorCallbacks::HasChunkAnyClients
virtual bool HasChunkAnyClients(cChunkCoords a_Coords) override
Called when the generator is overloaded to skip chunks that are no longer needed.
Definition: World.cpp:3192
cWorld::RegenerateChunk
void RegenerateChunk(int a_ChunkX, int a_ChunkZ)
Regenerate the given chunk.
Definition: World.cpp:2643
cWorld::PickupsFromBlock
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...
Definition: World.cpp:2091
cWorld::GetRedstoneSimulator
cRedstoneSimulator * GetRedstoneSimulator(void)
Definition: World.h:601
cWorld::WriteBlockArea
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.
Definition: World.cpp:1783
cWorld::m_SimulatorManager
std::unique_ptr< cSimulatorManager > m_SimulatorManager
Definition: World.h:1011
cWorld::BlockTickQueueItem::Z
int Z
Definition: World.h:789
cWorld::IsGameModeAdventure
bool IsGameModeAdventure(void) const
Returns true if the world is in Adventure mode.
Definition: World.h:117
gmCreative
@ gmCreative
Definition: Defines.h:135
cWorld::m_MaxPlayers
unsigned int m_MaxPlayers
Definition: World.h:1023
cWorld::GetWorldTickAge
cTickTimeLong GetWorldTickAge() const
Definition: World.cpp:509
cWorld::SetCommandBlocksEnabled
void SetCommandBlocksEnabled(bool a_Flag)
Definition: World.h:706
cWorld::IsChunkValid
bool IsChunkValid(int a_ChunkX, int a_ChunkZ) const
Returns true iff the chunk is present and valid.
Definition: World.cpp:2206
NIBBLETYPE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
cWorld::SetLinkedOverworldName
void SetLinkedOverworldName(const AString &a_Name)
Definition: World.h:728
cWorld::m_WorldDate
std::chrono::milliseconds m_WorldDate
The fully controllable age of the world.
Definition: World.h:988
Scoreboard.h
cWorld::cTickThread::cTickThread
cTickThread(cWorld &a_World)
Definition: World.cpp:98
cWorld::SetMaxViewDistance
void SetMaxViewDistance(int a_MaxViewDistance)
Definition: World.cpp:1720
cWorld::ChooseNewWeather
eWeather ChooseNewWeather(void)
Chooses a reasonable transition from the current weather to a new weather.
Definition: World.cpp:894
cIsThread::cIsThread
cIsThread(AString &&a_ThreadName)
Definition: IsThread.cpp:16
cWorld::BroadcastPlayerListUpdateGameMode
virtual void BroadcastPlayerListUpdateGameMode(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:478
cWorld::m_SpawnY
int m_SpawnY
Definition: World.h:966
eGameMode
eGameMode
Definition: Defines.h:124
cWorld::cChunkGeneratorCallbacks::CallHookChunkGenerating
virtual void CallHookChunkGenerating(cChunkDesc &a_ChunkDesc) override
Called when the chunk is about to be generated.
Definition: World.cpp:3201
cWorld::GetMapManager
cMapManager & GetMapManager(void)
Returns the associated map manager instance.
Definition: World.h:703
cWorld::BroadcastEntityLook
virtual void BroadcastEntityLook(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:309
cWorld::SendChunkTo
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.
Definition: World.cpp:2509
Vector3::z
T z
Definition: Vector3.h:17
cBlockArea
Definition: BlockArea.h:37
cWorld::m_BroadcastDeathMessages
bool m_BroadcastDeathMessages
Definition: World.h:975
cWorld::GetDimension
virtual eDimension GetDimension(void) const override
Definition: World.h:133
cWorld::GetSpawnZ
int GetSpawnZ(void) const
Definition: World.h:587
cWorld::SetMinNetherPortalHeight
virtual void SetMinNetherPortalHeight(int a_NewMinHeight) override
Definition: World.h:739
cWorld::IsWeatherRainAt
bool IsWeatherRainAt(int a_BlockX, int a_BlockZ)
Returns true if it is raining at the specified location.
Definition: World.h:820
cWorld::m_bUseChatPrefixes
bool m_bUseChatPrefixes
Whether prefixes such as [INFO] are prepended to SendMessageXXX() / BroadcastChatXXX() functions.
Definition: World.h:1059
cWorld::cChunkGeneratorCallbacks::IsChunkQueued
virtual bool IsChunkQueued(cChunkCoords a_Coords) override
Called to check whether the specified chunk is in the queued state.
Definition: World.cpp:3183
cWorld::m_MaxNetherPortalWidth
int m_MaxNetherPortalWidth
Definition: World.h:971
cWorld::m_bEnabledPVP
bool m_bEnabledPVP
Definition: World.h:1002
cWorld::BroadcastPlayerListRemovePlayer
virtual void BroadcastPlayerListRemovePlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:452
cWorld::IsDaylightCycleEnabled
virtual bool IsDaylightCycleEnabled(void) const
Is the daylight cycle enabled?
Definition: World.h:89
cWorld::GetChunkData
bool GetChunkData(cChunkCoords a_Coords, cChunkDataCallback &a_Callback) const
Calls the callback with the chunk's data, if available (with ChunkCS locked).
Definition: World.cpp:2188
IniFile.h
cWorld::m_bFarmlandTramplingEnabled
bool m_bFarmlandTramplingEnabled
Definition: World.h:1003
cChunkGeneratorThread
Takes requests for generating chunks and processes them in a separate thread one by one.
Definition: ChunkGeneratorThread.h:24
cWorld::IsGameModeCreative
bool IsGameModeCreative(void) const
Returns true if the world is in Creative mode.
Definition: World.h:111
cChunkMap::FastSetBlock
void FastSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
Definition: ChunkMap.cpp:425
cWorld::m_StorageCompressionFactor
int m_StorageCompressionFactor
Definition: World.h:956
cWorld::IsFarmlandTramplingEnabled
bool IsFarmlandTramplingEnabled(void) const
Returns true if farmland trampling is enabled.
Definition: World.h:125
cWorld::m_WaterSimulator
cFluidSimulator * m_WaterSimulator
Definition: World.h:1013
cWorld::GetLinkedOverworldName
AString GetLinkedOverworldName(void) const
Definition: World.h:727
cWorld::m_LastChunkCheck
std::chrono::milliseconds m_LastChunkCheck
Definition: World.h:995
cWorld::TickQueuedTasks
void TickQueuedTasks(void)
Executes all tasks queued onto the tick thread.
Definition: World.cpp:1276
cWorld::m_IsDaylightCycleEnabled
bool m_IsDaylightCycleEnabled
Definition: World.h:978
cWorld::m_RedstoneSimulator
cRedstoneSimulator * m_RedstoneSimulator
Definition: World.h:1016
cWorldInterface::SendBlockTo
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.
cWorld::BroadcastSoundEffect
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:543
cWorld::m_GeneratorCallbacks
cChunkGeneratorCallbacks m_GeneratorCallbacks
The callbacks that the ChunkGenerator uses to store new chunks and interface to plugins.
Definition: World.h:1084
cWorld::GenerateChunk
void GenerateChunk(int a_ChunkX, int a_ChunkZ)
Generates the given chunk.
Definition: World.cpp:2653
cWorld::IsDeepSnowEnabled
bool IsDeepSnowEnabled(void) const
Definition: World.h:127
cWorld::BroadcastPlayerListUpdatePing
virtual void BroadcastPlayerListUpdatePing() override
Definition: Broadcaster.cpp:491
cWorld::CompareChunkClients
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.
Definition: World.cpp:2473
cWorld::MarkChunkDirty
void MarkChunkDirty(int a_ChunkX, int a_ChunkZ)
Definition: World.cpp:2136
cWorld::m_WeatherInterval
int m_WeatherInterval
Definition: World.h:1031
cObjective::Score
int Score
Definition: Scoreboard.h:35
cWorld::SetWeather
void SetWeather(eWeather a_NewWeather)
Sets the specified weather; resets weather interval; asks and notifies plugins of the change.
Definition: World.cpp:556
cWorld::BlockTickQueueItem::TicksToWait
int TicksToWait
Definition: World.h:790
cWorld::ShouldUseChatPrefixes
bool ShouldUseChatPrefixes(void) const
Definition: World.h:714
cWorld::SetMinNetherPortalWidth
virtual void SetMinNetherPortalWidth(int a_NewMinWidth) override
Definition: World.h:733
eMonsterType
eMonsterType
Identifies individual monster type.
Definition: MonsterTypes.h:10
cWorld::m_DataPath
AString m_DataPath
The path to the root directory for the world files.
Definition: World.h:945
cWorld
Definition: World.h:47
cWorld::ChangeWeather
void ChangeWeather(void)
Forces a weather change in the next game tick.
Definition: World.cpp:585
cWorld::BroadcastChatWarning
virtual void BroadcastChatWarning(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:164
SimulatorManager.h
cWorld::Start
void Start()
Starts threads that belong to this world.
Definition: World.cpp:687
cWorld::BroadcastParticleEffect
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
Definition: Broadcaster.cpp:400
ForEachChunkProvider.h
cWorld::PrepareChunk
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.
Definition: World.cpp:2528
cWorld::IsGameModeSpectator
bool IsGameModeSpectator(void) const
Returns true if the world is in Spectator mode.
Definition: World.h:120
cWorld::m_Dimension
eDimension m_Dimension
The dimension of the world, used by the client to provide correct lighting scheme.
Definition: World.h:962
cWorld::m_SandSimulator
std::unique_ptr< cSandSimulator > m_SandSimulator
Definition: World.h:1012
cWorld::UnloadUnusedChunks
void UnloadUnusedChunks(void)
Unloads all chunks immediately.
Definition: World.cpp:2224
cWorld::SpawnItemPickups
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.
Definition: World.h:432
cWorld::BlockTickQueueItem::X
int X
Definition: World.h:787
cWorld::SpawnExperienceOrb
UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward)
Spawns an experience orb at the given location with the given reward.
Definition: World.cpp:1880
cClientDiffCallback
Interface class used for comparing clients of two chunks.
Definition: ChunkDef.h:352
cWorld::m_MaxSunnyTicks
int m_MaxSunnyTicks
Definition: World.h:1032
cDeadlockDetect
Definition: DeadlockDetect.h:23
cWorld::GetDataPath
const AString & GetDataPath(void) const
Returns the data path to the world data.
Definition: World.h:694
cWorld::m_UnusedDirtyChunksCap
size_t m_UnusedDirtyChunksCap
The maximum number of allowed unused dirty chunks for this world.
Definition: World.h:940
cWorld::IsPVPEnabled
bool IsPVPEnabled(void) const
Definition: World.h:122
cWorld::InitializeFluidSimulator
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)
Definition: World.cpp:3067
cWorld::m_WorldTickAge
cTickTimeLong m_WorldTickAge
The time since this world began, in ticks.
Definition: World.h:993
cWorld::cChunkGeneratorCallbacks
Implementation of the callbacks that the ChunkGenerator uses to store new chunks and interface to plu...
Definition: World.h:916
cChunkGeneratorThread::cChunkSink
The interface through which the generated chunks are handed to the cWorld or whoever created us.
Definition: ChunkGeneratorThread.h:49
cWorld::m_SpawnX
int m_SpawnX
Definition: World.h:965
cWorld::SpawnFallingBlock
UInt32 SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
OBSOLETE, use the Vector3-based overload instead.
Definition: World.h:462
cWorld::BroadcastEntityProperties
void BroadcastEntityProperties(const cEntity &a_Entity)
Definition: Broadcaster.cpp:348
cWorld::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={})
Construct the world and read settings from its ini file.
Definition: World.cpp:137
cWorld::DigBlock
bool DigBlock(Vector3i a_BlockPos, const cEntity *a_Digger=nullptr)
Replaces the specified block with air, and calls the OnBroken block handler.
Definition: World.cpp:2055
cWorld::SetSignLines
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.
Definition: World.cpp:2546
EntityAnimation
EntityAnimation
Definition: Defines.h:456
cScoreboard
Definition: Scoreboard.h:199
cWorld::DoWithPlayerByUUID
bool DoWithPlayerByUUID(const cUUID &a_PlayerUUID, cPlayerListCallback a_Callback)
Finds the player over his uuid and calls the callback.
Definition: World.cpp:2325
cWorld::InitializeSpawn
void InitializeSpawn(void)
Definition: World.cpp:658
cWorld::BroadcastRemoveEntityEffect
virtual void BroadcastRemoveEntityEffect(const cEntity &a_Entity, int a_EffectID, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:504
cWorld::SetTrapdoorOpen
bool SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open)
Set the state of a trapdoor.
Definition: World.cpp:2619
cWorld::GetSkyDarkness
NIBBLETYPE GetSkyDarkness()
Get the current darkness level based on the time.
Definition: World.h:886
cLightingThread::GetQueueLength
size_t GetQueueLength(void)
Definition: LightingThread.cpp:180
cItem
Definition: Item.h:36
cWorld::GetMaxCactusHeight
int GetMaxCactusHeight(void) const
Definition: World.h:859
cWorld::GetChunkMap
cChunkMap * GetChunkMap(void)
Definition: World.h:852
cWorld::GrowTreeByBiome
bool GrowTreeByBiome(Vector3i a_BlockPos)
Grows a tree at the specified coords, based on the biome in the place.
Definition: World.cpp:1602
cWorld::m_LastSave
std::chrono::milliseconds m_LastSave
Definition: World.h:996
cWorld::QueueSetChunkData
void QueueSetChunkData(SetChunkData &&a_SetChunkData)
Puts the chunk data into a queue to be set into the chunkmap in the tick thread.
Definition: World.cpp:2163
Vector3d
Vector3< double > Vector3d
Definition: Vector3.h:485
wSunny
@ wSunny
Definition: Defines.h:166
SetChunkData
Definition: SetChunkData.h:15
cWorld::SetNextBlockToTick
void SetNextBlockToTick(const Vector3i a_BlockPos)
Causes the specified block to be ticked on the next Tick() call.
Definition: World.cpp:622
eWeather
eWeather
Definition: Defines.h:159
cWorld::m_MaxSugarcaneHeight
int m_MaxSugarcaneHeight
Definition: World.h:1037
cWorld::BroadcastPlayerListHeaderFooter
virtual void BroadcastPlayerListHeaderFooter(const cCompositeChat &a_Header, const cCompositeChat &a_Footer) override
Definition: Broadcaster.cpp:439
cWorld::RemoveChunkClient
void RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle *a_Client)
Removes client from the chunk specified.
Definition: World.cpp:2491
cWorld::cChunkGeneratorCallbacks::m_World
cWorld * m_World
Definition: World.h:920
cWorld::SetMaxNetherPortalWidth
virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) override
Definition: World.h:734
cWorld::GetSpawnY
int GetSpawnY(void) const
Definition: World.h:586
cWorld::ForEachEntityInChunk
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,...
Definition: World.cpp:2422
cWorld::BroadcastScoreboardObjective
virtual void BroadcastScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
Definition: Broadcaster.cpp:517
cWorld::GetBlock
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
Definition: World.h:363
EMCSBiome
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Definition: BiomeDef.h:17
cWorld::HasChunkAnyClients
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const
Definition: World.cpp:2215
cWorld::ShouldLavaSpawnFire
bool ShouldLavaSpawnFire(void) const
Definition: World.h:129
cWorld::m_MinThunderStormTicks
int m_MinThunderStormTicks
Definition: World.h:1034
cWorld::SpawnItemPickups
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.
Definition: World.cpp:1792
cWorld::ForEachBlockEntityInChunk
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 p...
Definition: World.cpp:1362
cWorld::m_BroadcastAchievementMessages
bool m_BroadcastAchievementMessages
Definition: World.h:976
mtWarning
@ mtWarning
Definition: Defines.h:359
mtSuccess
@ mtSuccess
Definition: Defines.h:358
cWorld::m_MaxViewDistance
int m_MaxViewDistance
The maximum view distance that a player can have in this world.
Definition: World.h:1067
cWorld::SendBlockEntity
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.
Definition: World.cpp:2127
cWorld::m_IsSpawnExplicitlySet
bool m_IsSpawnExplicitlySet
Definition: World.h:964
cWorld::FindAndDoWithPlayer
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.
Definition: World.cpp:2289
cWorld::m_LinkedNetherWorldName
AString m_LinkedNetherWorldName
Name of the nether world - where Nether portals should teleport.
Definition: World.h:1071
cWorld::GetBiomeAt
EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ)
Returns the biome at the specified coords.
Definition: World.cpp:1680
cWorld::m_ChunkSender
cChunkSender m_ChunkSender
Definition: World.h:1086
cWorld::DoWithPlayer
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 cal...
Definition: World.cpp:2270
cCSLock
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
Definition: CriticalSection.h:52
cWorld::SetCommandBlockCommand
bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString &a_Command)
Sets the command block command.
Definition: World.cpp:2584
cWorld::GrowRipePlant
bool GrowRipePlant(Vector3i a_BlockPos)
Grows the plant at the specified block to its ripe stage.
Definition: World.cpp:1671
cWorld::m_StorageSchema
AString m_StorageSchema
Name of the storage schema used to load and save chunks.
Definition: World.h:954
cWorld::SetMaxNetherPortalHeight
virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) override
Definition: World.h:740
cTickTime
std::chrono::duration< signed int, std::ratio_multiply< std::chrono::milliseconds::period, std::ratio< 50 > >> cTickTime
Definition: Globals.h:361
wStorm
@ wStorm
Definition: Defines.h:169
cWorld::SpawnBoat
UInt32 SpawnBoat(double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material)
Definition: World.h:480
cWorld::m_Generator
cChunkGeneratorThread m_Generator
The thread responsible for generating chunks.
Definition: World.h:1078
MapManager.h
cWorld::m_SetChunkDataQueue
std::vector< SetChunkData > m_SetChunkDataQueue
Queue for the chunk data to be set into m_ChunkMap by the tick thread.
Definition: World.h:1106
cWorld::GetWeather
eWeather GetWeather(void) const
Returns the current weather.
Definition: World.h:808
cItems
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:213
cChunkMap::GetBlock
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:475
cWorld::GetBlockMeta
NIBBLETYPE GetBlockMeta(Vector3i a_BlockPos) const
Returns the block meta at the specified position.
Definition: World.h:370
cWorld::GetSimulatorManager
cSimulatorManager * GetSimulatorManager(void)
Definition: World.h:597
cWorld::TickQueuedEntityAdditions
void TickQueuedEntityAdditions(void)
Adds the entities queued in the m_EntitiesToAdd queue into their chunk.
Definition: World.cpp:1237
cWorld::IsTrapdoorOpen
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.
Definition: World.cpp:2602
Byte
unsigned char Byte
Definition: Globals.h:158
cWorld::DoWithChunkAt
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:1446
cWorld::cLock::cLock
cLock(const cWorld &a_World)
Definition: World.cpp:86
cWorld::GetMinNetherPortalWidth
virtual int GetMinNetherPortalWidth(void) const override
Returns or sets the minumim or maximum netherportal width.
Definition: World.h:731
cWorld::GetBlockTypeMeta
bool GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Retrieves the block type and meta at the specified coords.
Definition: World.cpp:1765
dimOverworld
@ dimOverworld
Definition: Defines.h:233
Defines.h
cWorld::BroadcastEntityMetadata
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:322
cWorld::BroadcastEntityPosition
virtual void BroadcastEntityPosition(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:335
cWorld::GetBlockInfo
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.
Definition: World.cpp:1774
cWorld::GetWorldDate
cTickTimeLong GetWorldDate() const
Definition: World.cpp:500
cWorld::BroadcastChatSuccess
virtual void BroadcastChatSuccess(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:163
cWorld::TabCompleteUserName
void TabCompleteUserName(const AString &a_Text, AStringVector &a_Results)
Appends all usernames starting with a_Text (case-insensitive) into Results.
Definition: World.cpp:2973
cWorld::ShouldBroadcastDeathMessages
bool ShouldBroadcastDeathMessages(void) const
Definition: World.h:717
cWorld::DoWithChunk
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback)
Calls the callback for the chunk specified, with ChunkMapCS locked.
Definition: World.cpp:1437
cWorld::m_Storage
cWorldStorage m_Storage
Definition: World.h:1021
cWorld::GetMaxSugarcaneHeight
int GetMaxSugarcaneHeight(void) const
Definition: World.h:858
cWorld::GetMaxNetherPortalHeight
virtual int GetMaxNetherPortalHeight(void) const override
Definition: World.h:738
cWorld::m_MaxThunderStormTicks
int m_MaxThunderStormTicks
Definition: World.h:1034
BLOCKTYPE
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cWorldStorage
The actual world storage class.
Definition: WorldStorage.h:52
ChunkGeneratorThread.h
cWorld::MarkChunkSaving
void MarkChunkSaving(int a_ChunkX, int a_ChunkZ)
Definition: World.cpp:2145
cWorld::DoWithNearestPlayer
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,...
Definition: World.cpp:2342
cWorld::GetBlocks
bool GetBlocks(sSetBlockVector &a_Blocks, bool a_ContinueOnFailure)
Retrieves block types of the specified blocks.
Definition: World.cpp:2046
cWorld::GetBlockBlockLight
NIBBLETYPE GetBlockBlockLight(Vector3i a_BlockPos) const
Returns the block-light value at the specified block position.
Definition: World.cpp:1756
Int8
signed char Int8
Definition: Globals.h:151
cWorld::QueueUnloadUnusedChunks
void QueueUnloadUnusedChunks(void)
Queues a task to unload unused chunks onto the tick thread.
Definition: World.cpp:2234
Monster.h
cWorld::Tick
void Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec)
Definition: World.cpp:1002
wRain
@ wRain
Definition: Defines.h:167
cWorld::IsWeatherSunnyAt
bool IsWeatherSunnyAt(int a_BlockX, int a_BlockZ) const
Returns true if it is sunny at the specified location.
Definition: World.cpp:595
LOGWARNING
void LOGWARNING(std::string_view a_Format, const Args &... args)
Definition: LoggerSimple.h:67
cWorld::RemoveEntity
OwnedEntity RemoveEntity(cEntity &a_Entity)
Removes the entity from the world.
Definition: World.cpp:2755
Item.h
cWorld::BroadcastEntityAnimation
virtual void BroadcastEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:374
cWorld::m_LinkedEndWorldName
AString m_LinkedEndWorldName
Name of the End world - where End portals should teleport.
Definition: World.h:1075
cWorld::ScheduleTask
void ScheduleTask(cTickTime a_DelayTicks, std::function< void(cWorld &)> a_Task)
Queues a lambda task onto the tick thread, with the specified delay.
Definition: World.cpp:2730
cWorld::cChunkGeneratorCallbacks::OnChunkGenerated
virtual void OnChunkGenerated(cChunkDesc &a_ChunkDesc) override
Called after the chunk has been generated The interface may store the chunk, send it over network,...
Definition: World.cpp:3149
mtFailure
@ mtFailure
Definition: Defines.h:356
eDimension
eDimension
Dimension of a world.
Definition: Defines.h:230
cWorld::ShouldBroadcastAchievementMessages
bool ShouldBroadcastAchievementMessages(void) const
Definition: World.h:718
cSimulatorManager
Definition: SimulatorManager.h:28
cWorld::cLock
A simple RAII locker for the chunkmap - locks the chunkmap in its constructor, unlocks it in the dest...
Definition: World.h:58
cWorld::UseBlockEntity
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:
Definition: World.h:619
cWorld::GetGenerator
cChunkGeneratorThread & GetGenerator(void)
Definition: World.h:850
cWorld::BroadcastAttachEntity
virtual void BroadcastAttachEntity(const cEntity &a_Entity, const cEntity &a_Vehicle) override
Definition: Broadcaster.cpp:109
cWorld::GrowTree
bool GrowTree(Vector3i a_BlockPos)
Grows a tree at the specified coords.
Definition: World.cpp:1455
cWorld::TickQueuedChunkDataSets
void TickQueuedChunkDataSets()
Sets the chunk data queued in the m_SetChunkDataQueue queue into their chunk.
Definition: World.cpp:1195
cWorld::GetGameMode
eGameMode GetGameMode(void) const
Returns the current game mode.
Definition: World.h:108
cProjectileEntity::eKind
eKind
The kind of the projectile.
Definition: ProjectileEntity.h:33
cWorld::AddEntity
void AddEntity(OwnedEntity a_Entity, cWorld *a_OldWorld=nullptr)
Adds the entity into its appropriate chunk; takes ownership of the entity ptr.
Definition: World.cpp:2745
LightingThread.h
cWorld::GetStorageLoadQueueLength
size_t GetStorageLoadQueueLength(void)
Definition: World.h:768
cWorld::SpawnFallingBlock
UInt32 SpawnFallingBlock(Vector3d a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Spawns an falling block entity at the given position.
Definition: World.cpp:1864
cWorld::BroadcastCollectEntity
virtual void BroadcastCollectEntity(const cEntity &a_Collected, const cEntity &a_Collector, unsigned a_Count, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:218
cIniFile
Definition: IniFile.h:33
cWorld::TickMobs
void TickMobs(std::chrono::milliseconds a_Dt)
Handles the mob spawning / moving / destroying each tick.
Definition: World.cpp:1109
cChunkSender::Priority
Priority
Tag indicating urgency of chunk to be sent.
Definition: ChunkSender.h:63
cWorld::GrowTreeFromSapling
bool GrowTreeFromSapling(Vector3i a_BlockPos)
Grows a tree from the sapling at the specified coords.
Definition: World.cpp:1473
cWorld::AreCommandBlocksEnabled
bool AreCommandBlocksEnabled(void) const
Definition: World.h:705
cChunkGeneratorThread::GetSeed
int GetSeed() const
Definition: ChunkGeneratorThread.cpp:134
cCriticalSection
Definition: CriticalSection.h:8
cWorld::DoWithBlockEntityAt
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 en...
Definition: World.cpp:1406
cWorld::GetName
const AString & GetName(void) const
Returns the name of the world.
Definition: World.h:691
cWorld::m_CSEntitiesToAdd
cCriticalSection m_CSEntitiesToAdd
Guards m_EntitiesToAdd.
Definition: World.h:1097
gmAdventure
@ gmAdventure
Definition: Defines.h:136
cWorld::SaveAllChunks
void SaveAllChunks(void)
Saves all chunks immediately.
Definition: World.cpp:2698
cEntity
Definition: Entity.h:75
cWorld::IsWeatherWetAtXYZ
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...
Definition: World.cpp:613
cChunkCoords
Definition: ChunkDef.h:55
cWorld::GetWaterSimulator
cFluidSimulator * GetWaterSimulator(void)
Definition: World.h:599
cWorld::IsWeatherSunny
bool IsWeatherSunny(void) const
Returns true if the current weather is sunny.
Definition: World.h:811
cWorld::m_Weather
eWeather m_Weather
Definition: World.h:1030
cPlayer
Definition: Player.h:27
cWorld::GetLinkedNetherWorldName
AString GetLinkedNetherWorldName(void) const
Definition: World.h:721
cWorld::GetMaxNetherPortalWidth
virtual int GetMaxNetherPortalWidth(void) const override
Definition: World.h:732
cWorld::BroadcastEntityHeadLook
virtual void BroadcastEntityHeadLook(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:296
cWorld::BroadcastEntityEffect
virtual void BroadcastEntityEffect(const cEntity &a_Entity, int a_EffectID, int a_Amplifier, int a_Duration, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:270
cWorld::UpdateSkyDarkness
void UpdateSkyDarkness(void)
Definition: World.cpp:1313
cWorld::m_MinNetherPortalWidth
int m_MinNetherPortalWidth
Definition: World.h:970
cWorld::SpawnMinecart
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.
Definition: World.h:474
cWorld::BroadcastBlockAction
virtual void BroadcastBlockAction(Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:122
cWorld::m_Lighting
cLightingThread m_Lighting
Definition: World.h:1087
cWorld::GetTicksUntilWeatherChange
int GetTicksUntilWeatherChange(void) const
Definition: World.h:86
ProjectileEntity.h
cWorld::ChunkLighted
void ChunkLighted(int a_ChunkX, int a_ChunkZ, const cChunkDef::BlockNibbles &a_BlockLight, const cChunkDef::BlockNibbles &a_SkyLight)
Definition: World.cpp:2175
cTickTimeLong
std::chrono::duration< signed long long int, cTickTime::period > cTickTimeLong
Definition: Globals.h:364
cWorld::CreateProjectile
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.
Definition: World.cpp:2934
cWorld::SpawnMinecart
UInt32 SpawnMinecart(Vector3d a_Pos, int a_MinecartType, const cItem &a_Content=cItem(), int a_BlockHeight=1)
Spawns an minecart at the given coordinates.
Definition: World.cpp:1944
cWorld::GetNumChunks
size_t GetNumChunks() const
Returns the number of chunks loaded
Definition: World.cpp:2796
cWorldStorage::GetLoadQueueLength
size_t GetLoadQueueLength(void)
Definition: WorldStorage.cpp:123
cWorld::ForEachLoadedChunk
bool ForEachLoadedChunk(cFunctionRef< bool(int, int)> a_Callback)
Calls the callback for each loaded chunk.
Definition: World.cpp:2689
cWorld::IsGameModeSurvival
bool IsGameModeSurvival(void) const
Returns true if the world is in Survival mode.
Definition: World.h:114
cWorld::m_IsSavingEnabled
std::atomic< bool > m_IsSavingEnabled
Whether or not writing chunks to disk is currently enabled.
Definition: World.h:959
Boat.h
cWorld::QueueBlockForTick
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.
Definition: World.cpp:2854
UNUSED
#define UNUSED
Definition: Globals.h:72
cWorld::m_WorldName
AString m_WorldName
Definition: World.h:942
cWorld::GetBlockSkyLight
NIBBLETYPE GetBlockSkyLight(Vector3i a_BlockPos) const
Returns the sky light value at the specified block position.
Definition: World.cpp:1747
Vector3::y
T y
Definition: Vector3.h:17
cWorld::m_LastSpawnMonster
std::map< cMonster::eFamily, cTickTimeLong > m_LastSpawnMonster
Definition: World.h:997
cWorld::SetLinkedEndWorldName
void SetLinkedEndWorldName(const AString &a_Name)
Definition: World.h:725
cWorld::m_ChunkMap
cChunkMap m_ChunkMap
Definition: World.h:1025
cWorld::BroadcastChat
virtual void BroadcastChat(const AString &a_Message, const cClientHandle *a_Exclude=nullptr, eMessageType a_ChatPrefix=mtCustom) override
Definition: Broadcaster.cpp:187
cWorld::m_MaxCactusHeight
int m_MaxCactusHeight
Definition: World.h:1036
cWorld::m_CSSetChunkDataQueue
cCriticalSection m_CSSetChunkDataQueue
CS protecting m_SetChunkDataQueue.
Definition: World.h:1103
cWorld::DoWithEntityByID
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 callba...
Definition: World.cpp:2450
eMessageType
eMessageType
Definition: Defines.h:350
cWorld::SetSpawn
bool SetSpawn(int a_X, int a_Y, int a_Z)
Set default spawn at the given coordinates.
Definition: World.cpp:631
cWorld::GetMinNetherPortalHeight
virtual int GetMinNetherPortalHeight(void) const override
Returns or sets the minumim or maximum netherportal height.
Definition: World.h:737
cWorld::IsWeatherWetAt
virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) override
Returns true if it is raining or storming at the specified location.
Definition: World.cpp:604
cWorld::BroadcastPlayerListAddPlayer
virtual void BroadcastPlayerListAddPlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:426
cWorld::SpawnFallingBlock
UInt32 SpawnFallingBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Spawns an falling block entity at the given position.
Definition: World.h:453
EffectID
EffectID
Definition: EffectID.h:5
cWorld::BroadcastChatInfo
virtual void BroadcastChatInfo(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:161
cWorld::GetStorage
cWorldStorage & GetStorage(void)
Definition: World.h:851
cChunkMap
Definition: ChunkMap.h:37
cWorld::SetShouldUseChatPrefixes
void SetShouldUseChatPrefixes(bool a_Flag)
Definition: World.h:715
cChunkDef::BlockNibbles
NIBBLETYPE BlockNibbles[NumBlocks/2]
The type used for block data in nibble format, AXIS_ORDER ordering.
Definition: ChunkDef.h:126
cWorld::m_LinkedOverworldName
AString m_LinkedOverworldName
The name of the overworld that portals in this world should link to.
Definition: World.h:949
cWorld::BroadcastChatFatal
virtual void BroadcastChatFatal(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:165
cWorld::BroadcastBlockEntity
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.
Definition: Broadcaster.cpp:148
cBroadcastInterface
Definition: BroadcastInterface.h:16
cChunkGenerator
The interface that all chunk generators must implement to provide the generated chunks.
Definition: ChunkGenerator.h:20
cFunctionRef
Definition: FunctionRef.h:6
cWorld::BroadcastChatDeath
virtual void BroadcastChatDeath(const AString &a_Message, const cClientHandle *a_Exclude=nullptr) override
Definition: World.h:166
cWorld::m_ShouldLavaSpawnFire
bool m_ShouldLavaSpawnFire
Definition: World.h:1005
cWorld::GetStorageSaveQueueLength
size_t GetStorageSaveQueueLength(void)
Definition: World.h:769
cWorld::SpawnSplitExperienceOrbs
std::vector< UInt32 > SpawnSplitExperienceOrbs(double a_X, double a_Y, double a_Z, int a_Reward)
OBSOLETE, use the Vector3d-based overload instead.
Definition: World.h:511
cWorld::m_MinRainTicks
int m_MinRainTicks
Definition: World.h:1033
cWorld::m_MinNetherPortalHeight
int m_MinNetherPortalHeight
Definition: World.h:972
cWorld::DropBlockAsPickups
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.
Definition: World.cpp:2076
cWorld::m_Scoreboard
cScoreboard m_Scoreboard
Definition: World.h:1080
cSandSimulator
Despite the class name, this simulator takes care of all blocks that fall when suspended in the air.
Definition: SandSimulator.h:26
cWorld::cChunkGeneratorCallbacks::CallHookChunkGenerated
virtual void CallHookChunkGenerated(cChunkDesc &a_ChunkDesc) override
Called after the chunk is generated, before it is handed to the chunk sink.
Definition: World.cpp:3212
cWorld::SpawnItemPickups
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.
Definition: World.h:422
cWorld::IsChunkLighted
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ)
Definition: World.cpp:2671
AString
std::string AString
Definition: StringUtils.h:11
cWorld::ForEachPlayer
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:2252
Vector3
Definition: Vector3.h:10
cWorld::SpawnItemPickup
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.
Definition: World.cpp:1849
mtCustom
@ mtCustom
Definition: Defines.h:355
cWorld::CheckPlayerSpawnPoint
bool CheckPlayerSpawnPoint(int a_PosX, int a_PosY, int a_PosZ)
Check if player starting point is acceptable.
Definition: World.h:1139
cWorld::ForEachEntityInBox
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.
Definition: World.cpp:2431
cWorld::ForceSendChunkTo
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.
Definition: World.cpp:2518
cWorld::m_MapManager
cMapManager m_MapManager
Definition: World.h:1081
cScoreboard::eDisplaySlot
eDisplaySlot
Definition: Scoreboard.h:203
cWorld::SetBlock
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
Definition: World.cpp:1729
cWorld::GetGeneratorQueueLength
size_t GetGeneratorQueueLength(void)
Definition: World.h:766
cWorld::TryGetHeight
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.
Definition: World.cpp:2118
cWorld::m_TickThread
cTickThread m_TickThread
Definition: World.h:1088
cWorld::SetLinkedNetherWorldName
void SetLinkedNetherWorldName(const AString &a_Name)
Definition: World.h:722
cChunkMap::UseBlockEntity
bool UseBlockEntity(cPlayer *a_Player, int a_X, int a_Y, int a_Z)
a_Player rclked block entity at the coords specified, handle it returns true if the use was successfu...
Definition: ChunkMap.cpp:110
ChunkMap.h
cWorld::GrowRipePlant
bool GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal=false)
OBSOLETE, use the Vector3-based overload instead.
Definition: World.h:667
cWorld::SetBiomeAt
bool SetBiomeAt(int a_BlockX, int a_BlockZ, EMCSBiome a_Biome)
Sets the biome at the specified coords.
Definition: World.cpp:1689
cWorld::MarkChunkSaved
void MarkChunkSaved(int a_ChunkX, int a_ChunkZ)
Definition: World.cpp:2154
cWorld::DigBlock
bool DigBlock(int a_X, int a_Y, int a_Z, cEntity *a_Digger=nullptr)
OBSOLETE, use the Vector3-based overload instead.
Definition: World.h:558
cWorld::m_LavaSimulator
cFluidSimulator * m_LavaSimulator
Definition: World.h:1014
cWorld::GetLargeTreeAdjustment
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).
Definition: World.cpp:1516
cWorld::GetMaxViewDistance
int GetMaxViewDistance(void) const
Definition: World.h:711
cWorld::QueueTask
void QueueTask(std::function< void(cWorld &)> a_Task)
Queues a task onto the tick thread.
Definition: World.cpp:2720
cWorld::SpawnExperienceOrb
virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) override
OBSOLETE, use the Vector3d-based overload instead.
Definition: World.h:497
cWorld::BroadcastDestroyEntity
virtual void BroadcastDestroyEntity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:231
cWorld::WakeUpSimulatorsInArea
void WakeUpSimulatorsInArea(const cCuboid &a_Area)
Wakes up the simulators for the specified area of blocks.
Definition: World.cpp:1353
cCuboid
Definition: Cuboid.h:9
cWorld::GetHeight
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.
Definition: World.cpp:2109
cWorld::SetTimeOfDay
virtual void SetTimeOfDay(cTickTime a_TimeOfDay) override
Definition: World.cpp:518
cWorld::m_Tasks
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 futur...
Definition: World.h:1094
cWorld::BroadcastThunderbolt
virtual void BroadcastThunderbolt(Vector3i a_BlockPos, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:582
cWorld::BroadcastBlockBreakAnimation
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:135
cWorld::GrowTreeImage
bool GrowTreeImage(const sSetBlockVector &a_Blocks)
Imprints the specified blocks into the world, as long as each log block replaces only allowed blocks.
Definition: World.cpp:1617
AStringVector
std::vector< AString > AStringVector
Definition: StringUtils.h:12
cWorld::BroadcastEntityVelocity
virtual void BroadcastEntityVelocity(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
Definition: Broadcaster.cpp:361
cWorld::BroadcastDetachEntity
virtual void BroadcastDetachEntity(const cEntity &a_Entity, const cEntity &a_PreviousVehicle) override
Definition: Broadcaster.cpp:244