Cuberite
A lightweight, fast and extensible game server for Minecraft
ChunkDef.h
Go to the documentation of this file.
1 
2 // ChunkDef.h
3 
4 // Interfaces to helper types for chunk definitions. Most modules want to include this instead of cChunk.h
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "BiomeDef.h"
13 
14 
15 
16 // Used to smoothly convert to new axis ordering. One will be removed when deemed stable.
17 #define AXIS_ORDER_YZX 1 // Original (1.1-)
18 #define AXIS_ORDER_XZY 2 // New (1.2+)
19 #define AXIS_ORDER AXIS_ORDER_XZY
20 
21 
22 
23 
24 
25 // fwd
26 class cBlockEntity;
27 class cEntity;
28 class cClientHandle;
29 class cBlockEntity;
30 class cChunkCoords;
31 
32 using OwnedEntity = std::unique_ptr<cEntity>;
33 using cEntityList = std::vector<OwnedEntity>;
34 
35 
36 
37 
38 // tolua_begin
39 
41 typedef unsigned char BLOCKTYPE;
42 
44 typedef unsigned char NIBBLETYPE;
45 
47 typedef unsigned char HEIGHTTYPE;
48 
49 // tolua_end
50 
51 
52 
53 
54 
57 {
58 public:
59  int m_ChunkX;
60  int m_ChunkZ;
61 
62  cChunkCoords(int a_ChunkX, int a_ChunkZ) : m_ChunkX(a_ChunkX), m_ChunkZ(a_ChunkZ) {}
63 
64 
65  bool operator == (const cChunkCoords & a_Other) const
66  {
67  return ((m_ChunkX == a_Other.m_ChunkX) && (m_ChunkZ == a_Other.m_ChunkZ));
68  }
69 
70 
71  bool operator != (const cChunkCoords & a_Other) const
72  {
73  return !(operator == (a_Other));
74  }
75 
76 
78  bool operator < (const cChunkCoords & a_Other) const
79  {
80  if (a_Other.m_ChunkX == m_ChunkX)
81  {
82  return (m_ChunkZ < a_Other.m_ChunkZ);
83  }
84  else
85  {
86  return (m_ChunkX < a_Other.m_ChunkX);
87  }
88  }
89 
90 
92  AString ToString() const
93  {
94  return fmt::format(FMT_STRING("[{}, {}]"), m_ChunkX, m_ChunkZ);
95  }
96 } ;
97 
98 
99 
100 
101 
103 namespace fmt
104 {
105  template <> struct formatter<cChunkCoords>: formatter<int>
106  {
107  auto format(cChunkCoords a_Coords, format_context & a_Ctx)
108  {
109  return format_to(a_Ctx.out(), "[{}, {}]", a_Coords.m_ChunkX, a_Coords.m_ChunkZ);
110  }
111  };
112 }
113 
114 
115 
116 
117 
120 {
121 public:
122 
123  // Chunk dimensions:
124  static const int Width = 16;
125  static const int Height = 256;
126  static const int NumBlocks = Width * Height * Width;
127 
128  static const int SectionHeight = 16;
129  static const size_t NumSections = (cChunkDef::Height / SectionHeight);
130 
133 
138 
141 
144 
145 
147  inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ)
148  {
149  UNUSED(a_Y);
150  BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ);
151 
152  a_X = a_X - a_ChunkX * Width;
153  a_Z = a_Z - a_ChunkZ * Width;
154  }
155 
156 
159  inline static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition)
160  {
161  cChunkCoords chunkPos = BlockToChunk(a_BlockPosition);
162  return AbsoluteToRelative(a_BlockPosition, chunkPos);
163  }
164 
165 
167  inline static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition, cChunkCoords a_ChunkPos)
168  {
169  return { a_BlockPosition.x - a_ChunkPos.m_ChunkX * Width, a_BlockPosition.y, a_BlockPosition.z - a_ChunkPos.m_ChunkZ * Width };
170  }
171 
172 
174  inline static Vector3i RelativeToAbsolute(Vector3i a_RelBlockPosition, cChunkCoords a_ChunkCoords)
175  {
176  return Vector3i(
177  a_RelBlockPosition.x + a_ChunkCoords.m_ChunkX * Width,
178  a_RelBlockPosition.y,
179  a_RelBlockPosition.z + a_ChunkCoords.m_ChunkZ * Width
180  );
181  }
182 
183 
185  inline static bool IsValidHeight(Vector3i a_BlockPosition)
186  {
187  return ((a_BlockPosition.y >= 0) && (a_BlockPosition.y < Height));
188  }
189 
190 
192  inline static bool IsValidWidth(int a_Width)
193  {
194  return ((a_Width >= 0) && (a_Width < Width));
195  }
196 
197 
199  inline static bool IsValidRelPos(Vector3i a_RelPos)
200  {
201  return (
202  IsValidWidth(a_RelPos.x) &&
203  IsValidHeight(a_RelPos) &&
204  IsValidWidth(a_RelPos.z)
205  );
206  }
207 
208 
210  inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ)
211  {
212  // This version is deprecated in favor of the vector version
213  // If you're developing new code, use the other version.
214  const auto ChunkCoords = BlockToChunk({ a_X, 0, a_Z });
215  a_ChunkX = ChunkCoords.m_ChunkX;
216  a_ChunkZ = ChunkCoords.m_ChunkZ;
217  }
218 
219 
221  inline static cChunkCoords BlockToChunk(const Vector3i a_Position)
222  {
223  return { FAST_FLOOR_DIV(a_Position.x, Width), FAST_FLOOR_DIV(a_Position.z, Width) };
224  }
225 
226 
227  inline static size_t MakeIndex(int x, int y, int z)
228  {
229  ASSERT(IsValidRelPos({ x, y, z }));
230 
231  #if AXIS_ORDER == AXIS_ORDER_XZY
232  // For some reason, NOT using the Horner schema is faster. Weird.
233  return static_cast<size_t>(x + (z * Width) + (y * Width * Width)); // 1.2 uses XZY
234  #elif AXIS_ORDER == AXIS_ORDER_YZX
235  return static_cast<size_t>(y + (z * Width) + (x * Height * Width)); // 1.1 uses YZX
236  #endif
237  }
238 
239 
240  inline static size_t MakeIndex(Vector3i a_RelPos)
241  {
242  return MakeIndex(a_RelPos.x, a_RelPos.y, a_RelPos.z);
243  }
244 
245 
246  inline static Vector3i IndexToCoordinate(size_t index)
247  {
248  #if AXIS_ORDER == AXIS_ORDER_XZY
249  return Vector3i( // 1.2
250  static_cast<int>(index % cChunkDef::Width), // X
251  static_cast<int>(index / (cChunkDef::Width * cChunkDef::Width)), // Y
252  static_cast<int>((index / cChunkDef::Width) % cChunkDef::Width) // Z
253  );
254  #elif AXIS_ORDER == AXIS_ORDER_YZX
255  return Vector3i( // 1.1
256  static_cast<int>(index / (cChunkDef::Height * cChunkDef::Width)), // X
257  static_cast<int>(index % cChunkDef::Height), // Y
258  static_cast<int>((index / cChunkDef::Height) % cChunkDef::Width) // Z
259  );
260  #endif
261  }
262 
263 
264  inline static void SetBlock(BLOCKTYPE * a_BlockTypes, int a_X, int a_Y, int a_Z, BLOCKTYPE a_Type)
265  {
266  ASSERT((a_X >= 0) && (a_X < Width));
267  ASSERT((a_Y >= 0) && (a_Y < Height));
268  ASSERT((a_Z >= 0) && (a_Z < Width));
269  a_BlockTypes[MakeIndex(a_X, a_Y, a_Z)] = a_Type;
270  }
271 
272 
273  inline static void SetBlock(BLOCKTYPE * a_BlockTypes, int a_Index, BLOCKTYPE a_Type)
274  {
275  ASSERT((a_Index >= 0) && (a_Index <= NumBlocks));
276  a_BlockTypes[a_Index] = a_Type;
277  }
278 
279 
280  inline static BLOCKTYPE GetBlock(const BLOCKTYPE * a_BlockTypes, Vector3i a_RelPos)
281  {
282  ASSERT(IsValidRelPos(a_RelPos));
283  return a_BlockTypes[MakeIndex(a_RelPos)];
284  }
285 
286 
287  inline static BLOCKTYPE GetBlock(const BLOCKTYPE * a_BlockTypes, int a_X, int a_Y, int a_Z)
288  {
289  ASSERT((a_X >= 0) && (a_X < Width));
290  ASSERT((a_Y >= 0) && (a_Y < Height));
291  ASSERT((a_Z >= 0) && (a_Z < Width));
292  return a_BlockTypes[MakeIndex(a_X, a_Y, a_Z)];
293  }
294 
295 
296  inline static BLOCKTYPE GetBlock(const BLOCKTYPE * a_BlockTypes, int a_Idx)
297  {
298  ASSERT((a_Idx >= 0) && (a_Idx < NumBlocks));
299  return a_BlockTypes[a_Idx];
300  }
301 
302 
303  inline static HEIGHTTYPE GetHeight(const HeightMap & a_HeightMap, int a_X, int a_Z)
304  {
305  ASSERT((a_X >= 0) && (a_X < Width));
306  ASSERT((a_Z >= 0) && (a_Z < Width));
307  return a_HeightMap[a_X + Width * a_Z];
308  }
309 
310 
311  inline static void SetHeight(HeightMap & a_HeightMap, int a_X, int a_Z, HEIGHTTYPE a_Height)
312  {
313  ASSERT((a_X >= 0) && (a_X < Width));
314  ASSERT((a_Z >= 0) && (a_Z < Width));
315  a_HeightMap[a_X + Width * a_Z] = a_Height;
316  }
317 
318 
319  inline static EMCSBiome GetBiome(const BiomeMap & a_BiomeMap, int a_X, int a_Z)
320  {
321  ASSERT((a_X >= 0) && (a_X < Width));
322  ASSERT((a_Z >= 0) && (a_Z < Width));
323  return a_BiomeMap[a_X + Width * a_Z];
324  }
325 
326 
327  inline static void SetBiome(BiomeMap & a_BiomeMap, int a_X, int a_Z, EMCSBiome a_Biome)
328  {
329  ASSERT((a_X >= 0) && (a_X < Width));
330  ASSERT((a_Z >= 0) && (a_Z < Width));
331  a_BiomeMap[a_X + Width * a_Z] = a_Biome;
332  }
333 
334 
335  static NIBBLETYPE GetNibble(const NIBBLETYPE * a_Buffer, int x, int y, int z)
336  {
337  if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
338  {
339  return ExpandNibble(a_Buffer, MakeIndex(x, y, z));
340  }
341  ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!");
342  return 0;
343  }
344 
345 
346  inline static void PackNibble(NIBBLETYPE * const a_Buffer, const size_t a_Index, const NIBBLETYPE a_Nibble)
347  {
348  ASSERT((a_Nibble & 0xF) == a_Nibble); // Only the lower bits should be set
349 
350  a_Buffer[a_Index / 2] = static_cast<NIBBLETYPE>(
351  (a_Buffer[a_Index / 2] & (0xf0 >> ((a_Index & 1) * 4))) | // The untouched nibble
352  ((a_Nibble & 0x0f) << ((a_Index & 1) * 4)) // The nibble being set
353  );
354  }
355 
356 
357  inline static NIBBLETYPE ExpandNibble(const NIBBLETYPE * const a_Buffer, const size_t a_Index)
358  {
359  return (a_Buffer[a_Index / 2] >> ((a_Index & 1) * 4)) & 0x0f;
360  }
361 } ;
362 
363 
364 
365 
366 
370 {
371 public:
372 
373  virtual ~cClientDiffCallback() {}
374 
376  virtual void Removed(cClientHandle * a_Client) = 0;
377 
379  virtual void Added(cClientHandle * a_Client) = 0;
380 } ;
381 
382 
383 
384 
385 
386 struct sSetBlock
387 {
392 
393  sSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta):
394  m_RelX(a_BlockX),
395  m_RelY(a_BlockY),
396  m_RelZ(a_BlockZ),
397  m_BlockType(a_BlockType),
398  m_BlockMeta(a_BlockMeta)
399  {
401  }
402 
403  sSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
404  sSetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_BlockType, a_BlockMeta)
405  {
406  }
407 
408  sSetBlock(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
409  m_RelX(a_RelX), m_RelY(a_RelY), m_RelZ(a_RelZ),
410  m_ChunkX(a_ChunkX), m_ChunkZ(a_ChunkZ),
411  m_BlockType(a_BlockType),
412  m_BlockMeta(a_BlockMeta)
413  {
414  ASSERT((a_RelX >= 0) && (a_RelX < cChunkDef::Width));
415  ASSERT((a_RelZ >= 0) && (a_RelZ < cChunkDef::Width));
416  }
417 
419  int GetX(void) const { return m_RelX + cChunkDef::Width * m_ChunkX; }
420 
423  int GetY(void) const { return m_RelY; }
424 
426  int GetZ(void) const { return m_RelZ + cChunkDef::Width * m_ChunkZ; }
427 
430  {
431  return Vector3i(GetX(), GetY(), GetZ());
432  }
433 
436  {
437  return Vector3i(m_RelX, m_RelY, m_RelZ);
438  }
439 };
440 
441 typedef std::vector<sSetBlock> sSetBlockVector;
442 
443 typedef std::list<cChunkCoords> cChunkCoordsList;
444 typedef std::vector<cChunkCoords> cChunkCoordsVector;
445 
446 
447 
448 
449 
453 {
454 public:
455  size_t operator () (const cChunkCoords & a_Coords) const
456  {
457  return (static_cast<size_t>(a_Coords.m_ChunkX) << 16) ^ static_cast<size_t>(a_Coords.m_ChunkZ);
458  }
459 };
460 
461 
462 
463 
464 
467 {
468 public:
469 
470  virtual ~cChunkCoordCallback() {}
471 
473  virtual void Call(cChunkCoords a_Coords, bool a_IsSuccess) = 0;
474 } ;
475 
476 
477 
478 
479 
481 template <typename X> class cCoordWithData
482 {
483 public:
484  int x;
485  int y;
486  int z;
487  X Data;
488 
489  cCoordWithData(int a_X, int a_Y, int a_Z) :
490  x(a_X), y(a_Y), z(a_Z), Data()
491  {
492  }
493 
494  cCoordWithData(int a_X, int a_Y, int a_Z, const X & a_Data) :
495  x(a_X), y(a_Y), z(a_Z), Data(a_Data)
496  {
497  }
498 } ;
499 
501 
502 typedef std::list<cCoordWithInt> cCoordWithIntList;
503 typedef std::vector<cCoordWithInt> cCoordWithIntVector;
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Definition: BiomeDef.h:18
std::vector< cCoordWithInt > cCoordWithIntVector
Definition: ChunkDef.h:503
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:441
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
unsigned char HEIGHTTYPE
The type used by the heightmap.
Definition: ChunkDef.h:47
std::list< cChunkCoords > cChunkCoordsList
Definition: ChunkDef.h:443
std::unique_ptr< cEntity > OwnedEntity
Definition: ChunkDef.h:32
cCoordWithData< int > cCoordWithInt
Definition: ChunkDef.h:500
std::vector< OwnedEntity > cEntityList
Definition: ChunkDef.h:33
std::vector< cChunkCoords > cChunkCoordsVector
Definition: ChunkDef.h:444
std::list< cCoordWithInt > cCoordWithIntList
Definition: ChunkDef.h:502
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
#define FAST_FLOOR_DIV(x, div)
Faster than (int)floorf((float)x / (float)div)
Definition: Globals.h:238
#define ASSERT(x)
Definition: Globals.h:276
#define UNUSED
Definition: Globals.h:72
std::string AString
Definition: StringUtils.h:11
Vector3< int > Vector3i
Definition: Vector3.h:487
Implements custom fmtlib formatting for cChunkCoords.
Definition: ChunkDef.h:104
Wraps the chunk coords into a single structure.
Definition: ChunkDef.h:57
cChunkCoords(int a_ChunkX, int a_ChunkZ)
Definition: ChunkDef.h:62
bool operator<(const cChunkCoords &a_Other) const
Simple comparison, to support ordering.
Definition: ChunkDef.h:78
AString ToString() const
Returns a string that describes the chunk coords, suitable for logging.
Definition: ChunkDef.h:92
bool operator!=(const cChunkCoords &a_Other) const
Definition: ChunkDef.h:71
int m_ChunkZ
Definition: ChunkDef.h:60
int m_ChunkX
Definition: ChunkDef.h:59
bool operator==(const cChunkCoords &a_Other) const
Definition: ChunkDef.h:65
auto format(cChunkCoords a_Coords, format_context &a_Ctx)
Definition: ChunkDef.h:107
Constants used throughout the code, useful typedefs and utility functions.
Definition: ChunkDef.h:120
static BLOCKTYPE GetBlock(const BLOCKTYPE *a_BlockTypes, int a_X, int a_Y, int a_Z)
Definition: ChunkDef.h:287
static bool IsValidHeight(Vector3i a_BlockPosition)
Validates a height-coordinate.
Definition: ChunkDef.h:185
static Vector3i RelativeToAbsolute(Vector3i a_RelBlockPosition, cChunkCoords a_ChunkCoords)
Converts relative block coordinates into absolute coordinates with a known chunk location.
Definition: ChunkDef.h:174
static void BlockToChunk(int a_X, int a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords to chunk coords:
Definition: ChunkDef.h:210
BLOCKTYPE BlockTypes[NumBlocks]
The type used for block type operations and storage, AXIS_ORDER ordering.
Definition: ChunkDef.h:140
static BLOCKTYPE GetBlock(const BLOCKTYPE *a_BlockTypes, int a_Idx)
Definition: ChunkDef.h:296
static void AbsoluteToRelative(int &a_X, int &a_Y, int &a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords into relative (chunk + block) coords:
Definition: ChunkDef.h:147
static void SetHeight(HeightMap &a_HeightMap, int a_X, int a_Z, HEIGHTTYPE a_Height)
Definition: ChunkDef.h:311
static bool IsValidWidth(int a_Width)
Validates a width-coordinate.
Definition: ChunkDef.h:192
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
Definition: ChunkDef.h:132
static BLOCKTYPE GetBlock(const BLOCKTYPE *a_BlockTypes, Vector3i a_RelPos)
Definition: ChunkDef.h:280
static NIBBLETYPE GetNibble(const NIBBLETYPE *a_Buffer, int x, int y, int z)
Definition: ChunkDef.h:335
static cChunkCoords BlockToChunk(const Vector3i a_Position)
The Y coordinate of a_Pos is ignored.
Definition: ChunkDef.h:221
static bool IsValidRelPos(Vector3i a_RelPos)
Validates a chunk relative coordinate.
Definition: ChunkDef.h:199
static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition)
Converts the specified absolute position into a relative position within its chunk.
Definition: ChunkDef.h:159
static size_t MakeIndex(Vector3i a_RelPos)
Definition: ChunkDef.h:240
static void PackNibble(NIBBLETYPE *const a_Buffer, const size_t a_Index, const NIBBLETYPE a_Nibble)
Definition: ChunkDef.h:346
static size_t MakeIndex(int x, int y, int z)
Definition: ChunkDef.h:227
static NIBBLETYPE ExpandNibble(const NIBBLETYPE *const a_Buffer, const size_t a_Index)
Definition: ChunkDef.h:357
static const int Width
Definition: ChunkDef.h:124
NIBBLETYPE BlockNibbles[NumBlocks/2]
The type used for block data in nibble format, AXIS_ORDER ordering.
Definition: ChunkDef.h:143
static const size_t NumSections
Definition: ChunkDef.h:129
static const int SectionHeight
Definition: ChunkDef.h:128
static const int Height
Definition: ChunkDef.h:125
static Vector3i IndexToCoordinate(size_t index)
Definition: ChunkDef.h:246
static HEIGHTTYPE GetHeight(const HeightMap &a_HeightMap, int a_X, int a_Z)
Definition: ChunkDef.h:303
static EMCSBiome GetBiome(const BiomeMap &a_BiomeMap, int a_X, int a_Z)
Definition: ChunkDef.h:319
static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition, cChunkCoords a_ChunkPos)
Converts the absolute coords into coords relative to the specified chunk.
Definition: ChunkDef.h:167
static const int NumBlocks
Definition: ChunkDef.h:126
static void SetBiome(BiomeMap &a_BiomeMap, int a_X, int a_Z, EMCSBiome a_Biome)
Definition: ChunkDef.h:327
static void SetBlock(BLOCKTYPE *a_BlockTypes, int a_Index, BLOCKTYPE a_Type)
Definition: ChunkDef.h:273
static void SetBlock(BLOCKTYPE *a_BlockTypes, int a_X, int a_Y, int a_Z, BLOCKTYPE a_Type)
Definition: ChunkDef.h:264
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
Definition: ChunkDef.h:137
Interface class used for comparing clients of two chunks.
Definition: ChunkDef.h:370
virtual void Removed(cClientHandle *a_Client)=0
Called for clients that are in Chunk1 and not in Chunk2,.
virtual ~cClientDiffCallback()
Definition: ChunkDef.h:373
virtual void Added(cClientHandle *a_Client)=0
Called for clients that are in Chunk2 and not in Chunk1.
NIBBLETYPE m_BlockMeta
Definition: ChunkDef.h:391
sSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Definition: ChunkDef.h:393
int GetX(void) const
Returns the absolute X coord of the stored block.
Definition: ChunkDef.h:419
sSetBlock(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Definition: ChunkDef.h:408
int GetY(void) const
Returns the absolute Y coord of the stored block.
Definition: ChunkDef.h:423
Vector3i GetAbsolutePos() const
Returns the absolute coords of the stored block.
Definition: ChunkDef.h:429
int m_RelX
Definition: ChunkDef.h:388
Vector3i GetRelativePos() const
Returns the relative position of the stored block within its chunk.
Definition: ChunkDef.h:435
sSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Definition: ChunkDef.h:403
int m_ChunkZ
Definition: ChunkDef.h:389
int m_RelY
Definition: ChunkDef.h:388
BLOCKTYPE m_BlockType
Definition: ChunkDef.h:390
int GetZ(void) const
Returns the absolute Z coord of the stored block.
Definition: ChunkDef.h:426
int m_ChunkX
Definition: ChunkDef.h:389
int m_RelZ
Definition: ChunkDef.h:388
A simple hash function for chunk coords, we assume that chunk coords won't use more than 16 bits,...
Definition: ChunkDef.h:453
size_t operator()(const cChunkCoords &a_Coords) const
Definition: ChunkDef.h:455
Interface class used as a callback for operations that involve chunk coords.
Definition: ChunkDef.h:467
virtual ~cChunkCoordCallback()
Definition: ChunkDef.h:470
virtual void Call(cChunkCoords a_Coords, bool a_IsSuccess)=0
Called with the chunk's coords, and an optional operation status flag for operations that support it.
Generic template that can store any kind of data together with a triplet of 3 coords.
Definition: ChunkDef.h:482
cCoordWithData(int a_X, int a_Y, int a_Z)
Definition: ChunkDef.h:489
cCoordWithData(int a_X, int a_Y, int a_Z, const X &a_Data)
Definition: ChunkDef.h:494
Definition: Entity.h:76
T x
Definition: Vector3.h:17
T y
Definition: Vector3.h:17
T z
Definition: Vector3.h:17