Cuberite
A lightweight, fast and extensible game server for Minecraft
ChunkMap.h
Go to the documentation of this file.
1 
2 // cChunkMap.h
3 
4 // Interfaces to the cChunkMap class representing the chunk storage for a single world
5 
6 #pragma once
7 
8 #include "ChunkDataCallback.h"
9 #include "EffectID.h"
10 #include "FunctionRef.h"
11 
12 
13 
14 
15 class cWorld;
16 class cItem;
17 class cItems;
18 class cChunkStay;
19 class cChunk;
20 class cPlayer;
21 class cBlockArea;
22 class cMobCensus;
23 class cMobSpawner;
24 class cBoundingBox;
25 class cDeadlockDetect;
26 
27 struct SetChunkData;
28 
32 
33 
34 
35 
36 
37 class cChunkMap
38 {
39 public:
40 
41  cChunkMap(cWorld * a_World);
42 
44  void SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
45 
48  bool UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z);
49 
51  bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback);
52 
54  bool DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback);
55 
57  void WakeUpSimulators(Vector3i a_Block);
58 
59  // DEPRECATED, use the vector-parametered version instead.
60  void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
61  {
62  LOGWARNING("cChunkMap::WakeUpSimulators(int, int, int) is deprecated, use cChunkMap::WakeUpSimulators(Vector3i) instead.");
63  WakeUpSimulators(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
64  }
65 
66  void MarkChunkDirty (int a_ChunkX, int a_ChunkZ);
67  void MarkChunkSaving (int a_ChunkX, int a_ChunkZ);
68  void MarkChunkSaved (int a_ChunkX, int a_ChunkZ);
69 
75  void SetChunkData(SetChunkData && a_SetChunkData);
76 
77  void ChunkLighted(
78  int a_ChunkX, int a_ChunkZ,
79  const cChunkDef::BlockNibbles & a_BlockLight,
80  const cChunkDef::BlockNibbles & a_SkyLight
81  );
82 
85  bool GetChunkData(cChunkCoords a_Coords, cChunkDataCallback & a_Callback) const;
86 
88  bool IsChunkQueued(int a_ChunkX, int a_ChunkZ) const;
89 
90  bool IsWeatherSunnyAt(int a_BlockX, int a_BlockZ) const;
91  bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) const;
92  bool IsWeatherWetAt(Vector3i a_Position) const;
93 
94  bool IsChunkValid (int a_ChunkX, int a_ChunkZ) const;
95  bool HasChunkAnyClients (int a_ChunkX, int a_ChunkZ) const;
96  int GetHeight (int a_BlockX, int a_BlockZ); // Waits for the chunk to get loaded / generated
97  bool TryGetHeight (int a_BlockX, int a_BlockZ, int & a_Height); // Returns false if chunk not loaded / generated
98 
103  void FastSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
104 
106  void CollectPickupsByEntity(cEntity & a_Entity);
107 
108  BLOCKTYPE GetBlock (Vector3i a_BlockPos) const;
109  NIBBLETYPE GetBlockMeta (Vector3i a_BlockPos) const;
110  NIBBLETYPE GetBlockSkyLight (Vector3i a_BlockPos) const;
111  NIBBLETYPE GetBlockBlockLight(Vector3i a_BlockPos) const;
112 
115  void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_BlockMeta);
116 
117  void SetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
118  bool GetBlockTypeMeta (Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
119  bool GetBlockInfo (Vector3i, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) const;
120 
122  void ReplaceTreeBlocks(const sSetBlockVector & a_Blocks);
123 
125  EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ) const;
126 
129  bool SetBiomeAt(int a_BlockX, int a_BlockZ, EMCSBiome a_Biome);
130 
133  bool SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome);
134 
138  bool GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure);
139 
143  bool DigBlock(Vector3i a_BlockPos);
144 
150  cItems PickupsFromBlock(Vector3i a_BlockPos, const cEntity * a_Digger, const cItem * a_Tool);
151 
155  void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, const cPlayer & a_Player);
156 
158  void CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback);
159 
161  void CompareChunkClients(cChunk * a_Chunk1, cChunk * a_Chunk2, cClientDiffCallback & a_Callback);
162 
164  bool AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
165 
167  void RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
168 
170  void RemoveClientFromChunks(cClientHandle * a_Client);
171 
173  void AddEntity(OwnedEntity a_Entity);
174 
176  void AddPlayer(std::unique_ptr<cPlayer> a_Player);
177 
179  bool HasEntity(UInt32 a_EntityID) const;
180 
183  OwnedEntity RemoveEntity(cEntity & a_Entity);
184 
186  bool ForEachEntity(cEntityCallback a_Callback) const; // Lua-accessible
187 
189  bool ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback a_Callback); // Lua-accessible
190 
194  bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback); // Lua-accessible
195 
198  bool DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback) const; // Lua-accessible
199 
202  bool ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback a_Callback); // Lua-accessible
203 
206  bool DoWithBlockEntityAt(Vector3i a_Position, cBlockEntityCallback a_Callback); // Lua-acessible
207 
212  void PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallAfter = {}); // Lua-accessible
213 
216  void GenerateChunk(int a_ChunkX, int a_ChunkZ); // Lua-accessible
217 
219  void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ);
220 
222  void MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ);
223 
224  bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
225 
227  bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback);
228 
230  bool ForEachLoadedChunk(cFunctionRef<bool(int, int)> a_Callback) const;
231 
233  bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes);
234 
236  void GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty) const;
237 
241  int GrowPlantAt(Vector3i a_BlockPos, int a_NumStages = 1);
242 
246  void SetNextBlockToTick(const Vector3i a_BlockPos);
247 
249  void CollectMobCensus(cMobCensus & a_ToFill);
250 
252  void SpawnMobs(cMobSpawner & a_MobSpawner);
253 
254  void Tick(std::chrono::milliseconds a_Dt);
255 
257  void TickBlock(const Vector3i a_BlockPos);
258 
259  void UnloadUnusedChunks(void);
260  void SaveAllChunks(void) const;
261 
262  cWorld * GetWorld(void) const { return m_World; }
263 
264  size_t GetNumChunks(void) const;
265 
267  size_t GetNumUnusedDirtyChunks(void) const;
268 
269  void ChunkValidated(void); // Called by chunks that have become valid
270 
272  cCriticalSection & GetCS(void) const { return m_CSChunks; }
273 
279  void SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked);
280 
282  void TrackInDeadlockDetect(cDeadlockDetect & a_DeadlockDetect, const AString & a_WorldName);
283 
285  void UntrackInDeadlockDetect(cDeadlockDetect & a_DeadlockDetect);
286 
287 private:
288 
289  // Chunks query their neighbors using FindChunk(), while being ticked
290  friend class cChunk;
291 
292  // The chunkstay can (de-)register itself using AddChunkStay() and DelChunkStay()
293  friend class cChunkStay;
294 
295  typedef std::list<cChunkStay *> cChunkStays;
296 
298 
301  std::map<cChunkCoords, cChunk> m_Chunks;
302 
303  cEvent m_evtChunkValid; // Set whenever any chunk becomes valid, via ChunkValidated()
304 
306 
309 
312  cChunk & ConstructChunk(int a_ChunkX, int a_ChunkZ);
313 
315  cChunk & GetChunk(int a_ChunkX, int a_ChunkZ);
316 
318  cChunk * FindChunk(int a_ChunkX, int a_ChunkZ);
319 
321  const cChunk * FindChunk(int a_ChunkX, int a_ChunkZ) const;
322 
325  void AddChunkStay(cChunkStay & a_ChunkStay);
326 
329  void DelChunkStay(cChunkStay & a_ChunkStay);
330 
331 };
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Definition: BiomeDef.h:18
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:441
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
std::unique_ptr< cEntity > OwnedEntity
Definition: ChunkDef.h:32
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
unsigned int UInt32
Definition: Globals.h:157
void LOGWARNING(std::string_view a_Format, const Args &... args)
Definition: LoggerSimple.h:67
std::string AString
Definition: StringUtils.h:11
Vector3< int > Vector3i
Definition: Vector3.h:487
Represents two sets of coords, minimum and maximum for each direction.
Definition: BoundingBox.h:24
Definition: Chunk.h:36
Wraps the chunk coords into a single structure.
Definition: ChunkDef.h:57
NIBBLETYPE BlockNibbles[NumBlocks/2]
The type used for block data in nibble format, AXIS_ORDER ordering.
Definition: ChunkDef.h:143
Interface class used for comparing clients of two chunks.
Definition: ChunkDef.h:370
bool SetBiomeAt(int a_BlockX, int a_BlockZ, EMCSBiome a_Biome)
Sets the biome at the specified coords.
Definition: ChunkMap.cpp:678
bool ForEachLoadedChunk(cFunctionRef< bool(int, int)> a_Callback) const
Calls the callback for each loaded chunk.
Definition: ChunkMap.cpp:1196
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:475
bool GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Definition: ChunkMap.cpp:586
void UntrackInDeadlockDetect(cDeadlockDetect &a_DeadlockDetect)
Removes this chunkmap's CS from the DeadlockDetect's tracked CSs.
Definition: ChunkMap.cpp:1486
cChunk & GetChunk(int a_ChunkX, int a_ChunkZ)
Constructs a chunk and queues it for loading / generating if not valid, returning it.
Definition: ChunkMap.cpp:52
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: ChunkMap.cpp:1096
void SpawnMobs(cMobSpawner &a_MobSpawner)
Try to Spawn Monsters inside all Chunks.
Definition: ChunkMap.cpp:1326
bool SetAreaBiome(int a_MinX, int a_MaxX, int a_MinZ, int a_MaxZ, EMCSBiome a_Biome)
Sets the biome at the area.
Definition: ChunkMap.cpp:697
void ChunkValidated(void)
Definition: ChunkMap.cpp:1458
void SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked)
Increments (a_AlwaysTicked == true) or decrements (false) the m_AlwaysTicked counter for the specifie...
Definition: ChunkMap.cpp:1467
void SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle &a_Client)
Sends the block entity, if it is at the coords specified, to a_Client.
Definition: ChunkMap.cpp:93
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback a_Callback)
Calls the callback for the chunk specified, with ChunkMapCS locked; returns false if the chunk doesn'...
Definition: ChunkMap.cpp:128
NIBBLETYPE GetBlockMeta(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:494
NIBBLETYPE GetBlockSkyLight(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:513
void MarkChunkSaving(int a_ChunkX, int a_ChunkZ)
Definition: ChunkMap.cpp:185
void MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ)
Marks the chunk as being regenerated - all its clients want that chunk again (used by cWorld::Regener...
Definition: ChunkMap.cpp:1141
cItems PickupsFromBlock(Vector3i a_BlockPos, const cEntity *a_Digger, const cItem *a_Tool)
Returns all the pickups that would result if the a_Digger dug up the block at a_BlockPos using a_Tool...
Definition: ChunkMap.cpp:787
void SaveAllChunks(void) const
Definition: ChunkMap.cpp:1414
bool IsChunkValid(int a_ChunkX, int a_ChunkZ) const
Definition: ChunkMap.cpp:361
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ)
Definition: ChunkMap.cpp:1151
std::map< cChunkCoords, cChunk > m_Chunks
A map of chunk coordinates to chunks.
Definition: ChunkMap.h:301
void SetChunkData(SetChunkData &&a_SetChunkData)
Sets the chunk data as either loaded from the storage or generated.
Definition: ChunkMap.cpp:215
void RemoveClientFromChunks(cClientHandle *a_Client)
Removes the client from all chunks it is present in.
Definition: ChunkMap.cpp:895
void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ)
Marks the chunk as failed-to-load.
Definition: ChunkMap.cpp:1129
NIBBLETYPE GetBlockBlockLight(Vector3i a_BlockPos) const
Definition: ChunkMap.cpp:532
void GenerateChunk(int a_ChunkX, int a_ChunkZ)
Queues the chunk for generating.
Definition: ChunkMap.cpp:1119
void GetChunkStats(int &a_NumChunksValid, int &a_NumChunksDirty) const
Returns the number of valid chunks and the number of dirty chunks.
Definition: ChunkMap.cpp:1254
void RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle *a_Client)
Removes the client from the chunk.
Definition: ChunkMap.cpp:883
void AddChunkStay(cChunkStay &a_ChunkStay)
Adds a new cChunkStay descendant to the internal list of ChunkStays; loads its chunks.
Definition: ChunkMap.cpp:1495
void AddEntity(OwnedEntity a_Entity)
Adds the entity to its appropriate chunk, takes ownership of the entity pointer.
Definition: ChunkMap.cpp:908
void SetNextBlockToTick(const Vector3i a_BlockPos)
Causes the specified block to be ticked on the next Tick() call.
Definition: ChunkMap.cpp:1290
void MarkChunkDirty(int a_ChunkX, int a_ChunkZ)
Definition: ChunkMap.cpp:170
bool GetBlockInfo(Vector3i, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_Meta, NIBBLETYPE &a_SkyLight, NIBBLETYPE &a_BlockLight) const
Definition: ChunkMap.cpp:605
cChunk * FindChunk(int a_ChunkX, int a_ChunkZ)
Locates a chunk ptr in the chunkmap; doesn't create it when not found; assumes m_CSChunks is locked.
Definition: ChunkMap.cpp:69
cEvent m_evtChunkValid
Definition: ChunkMap.h:303
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
void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_BlockMeta)
Sets the meta for the specified block, while keeping the blocktype.
Definition: ChunkMap.cpp:551
void TickBlock(const Vector3i a_BlockPos)
Ticks a single block.
Definition: ChunkMap.cpp:1367
void ReplaceTreeBlocks(const sSetBlockVector &a_Blocks)
Special function used for growing trees, replaces only blocks that tree may overwrite.
Definition: ChunkMap.cpp:625
bool WriteBlockArea(cBlockArea &a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes)
Writes the block area into the specified coords.
Definition: ChunkMap.cpp:1216
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 * GetWorld(void) const
Definition: ChunkMap.h:262
bool ForEachEntity(cEntityCallback a_Callback) const
Calls the callback for each entity in the entire world; returns true if all entities processed,...
Definition: ChunkMap.cpp:982
bool ForEachEntityInBox(const cBoundingBox &a_Box, cEntityCallback a_Callback)
Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
Definition: ChunkMap.cpp:1014
bool DoWithBlockEntityAt(Vector3i a_Position, cBlockEntityCallback a_Callback)
Calls the callback for the block entity at the specified coords.
Definition: ChunkMap.cpp:1079
void DelChunkStay(cChunkStay &a_ChunkStay)
Removes the specified cChunkStay descendant from the internal list of ChunkStays.
Definition: ChunkMap.cpp:1526
OwnedEntity RemoveEntity(cEntity &a_Entity)
Removes the entity from its appropriate chunk Returns an owning reference to the found entity.
Definition: ChunkMap.cpp:964
void TrackInDeadlockDetect(cDeadlockDetect &a_DeadlockDetect, const AString &a_WorldName)
Adds this chunkmap's CS to the DeadlockDetect's tracked CSs.
Definition: ChunkMap.cpp:1477
void CollectPickupsByEntity(cEntity &a_Entity)
Makes the specified entity collect all the pickups around them.
Definition: ChunkMap.cpp:442
bool IsWeatherSunnyAt(int a_BlockX, int a_BlockZ) const
Definition: ChunkMap.cpp:304
void MarkChunkSaved(int a_ChunkX, int a_ChunkZ)
Definition: ChunkMap.cpp:200
void WakeUpSimulators(Vector3i a_Block)
Wakes up simulators for the specified block.
Definition: ChunkMap.cpp:153
bool GetBlocks(sSetBlockVector &a_Blocks, bool a_ContinueOnFailure)
Retrieves block types and metas of the specified blocks.
Definition: ChunkMap.cpp:735
bool IsChunkQueued(int a_ChunkX, int a_ChunkZ) const
Returns true iff the chunk is in the loader / generator queue.
Definition: ChunkMap.cpp:293
bool ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback a_Callback)
Calls the callback for each block entity in the specified chunk.
Definition: ChunkMap.cpp:1064
bool HasEntity(UInt32 a_EntityID) const
Returns true if the entity with specified ID is present in the chunks.
Definition: ChunkMap.cpp:947
bool DigBlock(Vector3i a_BlockPos)
Removes the block at the specified coords and wakes up simulators.
Definition: ChunkMap.cpp:765
void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
Definition: ChunkMap.h:60
std::list< cChunkStay * > cChunkStays
Definition: ChunkMap.h:295
bool TryGetHeight(int a_BlockX, int a_BlockZ, int &a_Height)
Definition: ChunkMap.cpp:406
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: ChunkMap.cpp:873
cWorld * m_World
Definition: ChunkMap.h:305
void Tick(std::chrono::milliseconds a_Dt)
Definition: ChunkMap.cpp:1343
cChunkStays m_ChunkStays
The cChunkStay descendants that are currently enabled in this chunkmap.
Definition: ChunkMap.h:308
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: ChunkMap.cpp:999
EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ) const
Returns the biome at the specified coords.
Definition: ChunkMap.cpp:660
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Definition: ChunkMap.cpp:569
void UnloadUnusedChunks(void)
Definition: ChunkMap.cpp:1384
int GrowPlantAt(Vector3i a_BlockPos, int a_NumStages=1)
Grows the plant at the specified position by at most a_NumStages.
Definition: ChunkMap.cpp:1273
int GetHeight(int a_BlockX, int a_BlockZ)
Definition: ChunkMap.cpp:383
bool DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback)
Calls the callback for the chunk at the block position specified, with ChunkMapCS locked; returns fal...
Definition: ChunkMap.cpp:143
void CollectMobCensus(cMobCensus &a_ToFill)
Make a Mob census, of all mobs, their family, their chunk and their distance to closest player.
Definition: ChunkMap.cpp:1307
cCriticalSection & GetCS(void) const
Returns the CS for locking the chunkmap; only cWorld::cLock may use this function!
Definition: ChunkMap.h:272
cCriticalSection m_CSChunks
Definition: ChunkMap.h:297
size_t GetNumChunks(void) const
Definition: ChunkMap.cpp:1430
bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback &a_Callback)
Calls the callback for each chunk in the coords specified (all cords are inclusive).
Definition: ChunkMap.cpp:1167
size_t GetNumUnusedDirtyChunks(void) const
Returns the number of unused dirty chunks.
Definition: ChunkMap.cpp:1440
void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, const cPlayer &a_Player)
Sends the block at the specified coords to the specified player.
Definition: ChunkMap.cpp:805
bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) const
Definition: ChunkMap.cpp:323
cChunk & ConstructChunk(int a_ChunkX, int a_ChunkZ)
Returns or creates and returns a chunk pointer corresponding to the given chunk coordinates.
Definition: ChunkMap.cpp:39
bool DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback) const
Calls the callback if the entity with the specified ID is found, with the entity object as the callba...
Definition: ChunkMap.cpp:1046
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const
Definition: ChunkMap.cpp:372
void ChunkLighted(int a_ChunkX, int a_ChunkZ, const cChunkDef::BlockNibbles &a_BlockLight, const cChunkDef::BlockNibbles &a_SkyLight)
Definition: ChunkMap.cpp:251
bool GetChunkData(cChunkCoords a_Coords, cChunkDataCallback &a_Callback) const
Calls the callback with the chunk's data, if available (with ChunkCS locked).
Definition: ChunkMap.cpp:271
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: ChunkMap.cpp:822
void AddPlayer(std::unique_ptr< cPlayer > a_Player)
Adds the player to its appropriate chunk, takes ownership of the player pointer.
Definition: ChunkMap.cpp:935
cChunkMap(cWorld *a_World)
Definition: ChunkMap.cpp:30
Makes chunks stay loaded until this object is cleared or destroyed Works by setting internal flags in...
Definition: ChunkStay.h:36
Definition: Entity.h:76
Definition: Player.h:29
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
This class is used to collect information, for each Mob, what is the distance of the closest player i...
Definition: MobCensus.h:26
This class is used to determine which monster can be spawned in which place it is essentially static ...
Definition: MobSpawner.h:16
Definition: Event.h:18
Contains the data for a loaded / generated chunk, ready to be set into a cWorld.
Definition: SetChunkData.h:12
Definition: World.h:53