Cuberite
A lightweight, fast and extensible game server for Minecraft
Defines.cpp
Go to the documentation of this file.
1 #include "Globals.h"
2 
3 #include "Defines.h"
4 #include "BlockType.h"
5 
6 
7 
8 
9 
10 const char * ClickActionToString(int a_ClickAction)
11 {
12  switch (a_ClickAction)
13  {
14  case caLeftClick: return "caLeftClick";
15  case caRightClick: return "caRightClick";
16  case caShiftLeftClick: return "caShiftLeftClick";
17  case caShiftRightClick: return "caShiftRightClick";
18  case caNumber1: return "caNumber1";
19  case caNumber2: return "caNumber2";
20  case caNumber3: return "caNumber3";
21  case caNumber4: return "caNumber4";
22  case caNumber5: return "caNumber5";
23  case caNumber6: return "caNumber6";
24  case caNumber7: return "caNumber7";
25  case caNumber8: return "caNumber8";
26  case caNumber9: return "caNumber9";
27  case caMiddleClick: return "caMiddleClick";
28  case caDropKey: return "caDropKey";
29  case caCtrlDropKey: return "caCtrlDropKey";
30  case caLeftClickOutside: return "caLeftClickOutside";
31  case caRightClickOutside: return "caRightClickOutside";
32  case caLeftClickOutsideHoldNothing: return "caLeftClickOutsideHoldNothing";
33  case caRightClickOutsideHoldNothing: return "caRightClickOutsideHoldNothing";
34  case caLeftPaintBegin: return "caLeftPaintBegin";
35  case caRightPaintBegin: return "caRightPaintBegin";
36  case caMiddlePaintBegin: return "caMiddlePaintBegin";
37  case caLeftPaintProgress: return "caLeftPaintProgress";
38  case caRightPaintProgress: return "caRightPaintProgress";
39  case caMiddlePaintProgress: return "caMiddlePaintProgress";
40  case caLeftPaintEnd: return "caLeftPaintEnd";
41  case caRightPaintEnd: return "caRightPaintEnd";
42  case caMiddlePaintEnd: return "caMiddlePaintEnd";
43  case caDblClick: return "caDblClick";
44  case caUnknown: return "caUnknown";
45  }
46  UNREACHABLE("Unknown click action");
47 }
48 
49 
50 
51 
52 
55 {
56  switch (a_BlockFace)
57  {
58  case BLOCK_FACE_XM: return BLOCK_FACE_XP;
59  case BLOCK_FACE_XP: return BLOCK_FACE_XM;
60  case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
61  case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
62  case BLOCK_FACE_NONE:
63  case BLOCK_FACE_YM:
64  case BLOCK_FACE_YP:
65  {
66  return a_BlockFace;
67  }
68  }
69  UNREACHABLE("Unsupported block face");
70 }
71 
72 
73 
74 
75 
78 {
79  switch (a_BlockFace)
80  {
81  case BLOCK_FACE_XM: return BLOCK_FACE_ZP;
82  case BLOCK_FACE_XP: return BLOCK_FACE_ZM;
83  case BLOCK_FACE_ZM: return BLOCK_FACE_XM;
84  case BLOCK_FACE_ZP: return BLOCK_FACE_XP;
85  case BLOCK_FACE_NONE:
86  case BLOCK_FACE_YM:
87  case BLOCK_FACE_YP:
88  {
89  return a_BlockFace;
90  }
91  }
92  UNREACHABLE("Unsupported block face");
93 }
94 
95 
96 
97 
98 
100 {
101  switch (a_BlockFace)
102  {
103  case BLOCK_FACE_XM: return BLOCK_FACE_ZM;
104  case BLOCK_FACE_XP: return BLOCK_FACE_ZP;
105  case BLOCK_FACE_ZM: return BLOCK_FACE_XP;
106  case BLOCK_FACE_ZP: return BLOCK_FACE_XM;
107  case BLOCK_FACE_NONE:
108  case BLOCK_FACE_YM:
109  case BLOCK_FACE_YP:
110  {
111  return a_BlockFace;
112  }
113  }
114  UNREACHABLE("Unsupported block face");
115 }
116 
117 
118 
119 
120 
122 {
123  switch (a_BlockFace)
124  {
125  case BLOCK_FACE_YP: return BLOCK_FACE_YM;
126  case BLOCK_FACE_XP: return BLOCK_FACE_XM;
127  case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
128  case BLOCK_FACE_YM: return BLOCK_FACE_YP;
129  case BLOCK_FACE_XM: return BLOCK_FACE_XP;
130  case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
131  case BLOCK_FACE_NONE: return a_BlockFace;
132  }
133  UNREACHABLE("Unsupported block face");
134 }
135 
136 
137 
138 
139 
142 {
143  switch (a_BlockFace)
144  {
145  case BLOCK_FACE_XM: return "BLOCK_FACE_XM";
146  case BLOCK_FACE_XP: return "BLOCK_FACE_XP";
147  case BLOCK_FACE_YM: return "BLOCK_FACE_YM";
148  case BLOCK_FACE_YP: return "BLOCK_FACE_YP";
149  case BLOCK_FACE_ZM: return "BLOCK_FACE_ZM";
150  case BLOCK_FACE_ZP: return "BLOCK_FACE_ZP";
151  case BLOCK_FACE_NONE: return "BLOCK_FACE_NONE";
152  }
153  UNREACHABLE("Unsupported block face");
154 }
155 
156 
157 
158 
159 
160 bool IsValidBlock(int a_BlockType)
161 {
162  return (
163  ((a_BlockType > -1) && (a_BlockType <= E_BLOCK_MAX_TYPE_ID)) ||
164  (a_BlockType == 255) // the blocks 253-254 don't exist yet -> https://minecraft.wiki/w/Data_values#Block_IDs
165  );
166 }
167 
168 
169 
170 
171 
172 bool IsValidItem(int a_ItemType)
173 {
174  if (
175  ((a_ItemType >= E_ITEM_FIRST) && (a_ItemType <= E_ITEM_MAX_CONSECUTIVE_TYPE_ID)) || // Basic items range
176  ((a_ItemType >= E_ITEM_FIRST_DISC) && (a_ItemType <= E_ITEM_LAST_DISC)) // Music discs' special range
177  )
178  {
179  return true;
180  }
181 
182  if (a_ItemType == 0)
183  {
184  return false;
185  }
186 
187  return IsValidBlock(a_ItemType);
188 }
189 
190 
191 
192 
193 
194 eDimension StringToDimension(const AString & a_DimensionString)
195 {
196  // First try decoding as a number
197  int res;
198  if (StringToInteger(a_DimensionString, res))
199  {
200  // It was a valid number
201  return static_cast<eDimension>(res);
202  }
203 
204  // Decode using a built-in map:
205  static struct
206  {
207  eDimension m_Dimension;
208  const char * m_String;
209  } DimensionMap [] =
210  {
211  { dimOverworld, "Overworld"},
212  { dimOverworld, "Normal"},
213  { dimOverworld, "World"},
214  { dimNether, "Nether"},
215  { dimNether, "Hell"}, // Alternate name for Nether
216  { dimEnd, "End"},
217  { dimEnd, "Sky"}, // Old name for End
218  } ;
219  for (size_t i = 0; i < ARRAYCOUNT(DimensionMap); i++)
220  {
221  if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0)
222  {
223  return DimensionMap[i].m_Dimension;
224  }
225  } // for i - DimensionMap[]
226 
227  // Not found
228  LOGWARNING("Unknown dimension: \"%s\". Setting to Overworld", a_DimensionString.c_str());
229  return dimOverworld;
230 }
231 
232 
233 
234 
235 
237 {
238  // Decode using a built-in map:
239  static struct
240  {
241  eDimension m_Dimension;
242  const char * m_String;
243  } DimensionMap[] =
244  {
245  { dimOverworld, "Overworld" },
246  { dimNether, "Nether" },
247  { dimEnd, "End" },
248  };
249 
250  for (size_t i = 0; i < ARRAYCOUNT(DimensionMap); i++)
251  {
252  if (DimensionMap[i].m_Dimension == a_Dimension)
253  {
254  return DimensionMap[i].m_String;
255  }
256  } // for i - DimensionMap[]
257 
258  // Not found
259  LOGWARNING("Unknown dimension: \"%i\". Setting to Overworld", static_cast<int>(a_Dimension));
260  return "Overworld";
261 }
262 
263 
264 
265 
266 
268 {
269  // Make sure to keep this alpha-sorted.
270  switch (a_DamageType)
271  {
272  case dtAdmin: return "dtAdmin";
273  case dtAttack: return "dtAttack";
274  case dtCactusContact: return "dtCactusContact";
275  case dtMagmaContact: return "dtMagmaContact";
276  case dtDrowning: return "dtDrowning";
277  case dtEnderPearl: return "dtEnderPearl";
278  case dtEnvironment: return "dtEnvironment";
279  case dtFalling: return "dtFalling";
280  case dtFireContact: return "dtFireContact";
281  case dtInVoid: return "dtInVoid";
282  case dtLavaContact: return "dtLavaContact";
283  case dtLightning: return "dtLightning";
284  case dtOnFire: return "dtOnFire";
285  case dtPoisoning: return "dtPoisoning";
286  case dtWithering: return "dtWithering";
287  case dtPotionOfHarming: return "dtPotionOfHarming";
288  case dtRangedAttack: return "dtRangedAttack";
289  case dtStarving: return "dtStarving";
290  case dtSuffocating: return "dtSuffocation";
291  case dtExplosion: return "dtExplosion";
292  }
293  UNREACHABLE("Unsupported damage type");
294 }
295 
296 
297 
298 
299 
300 eDamageType StringToDamageType(const AString & a_DamageTypeString)
301 {
302  // First try decoding as a number:
303  int res;
304  if (!StringToInteger(a_DamageTypeString, res))
305  {
306  // It was a valid number
307  return static_cast<eDamageType>(res);
308  }
309 
310  // Decode using a built-in map:
311  static struct
312  {
313  eDamageType m_DamageType;
314  const char * m_String;
315  } DamageTypeMap [] =
316  {
317  // Cannonical names:
318  { dtAttack, "dtAttack"},
319  { dtRangedAttack, "dtRangedAttack"},
320  { dtLightning, "dtLightning"},
321  { dtFalling, "dtFalling"},
322  { dtDrowning, "dtDrowning"},
323  { dtSuffocating, "dtSuffocation"},
324  { dtStarving, "dtStarving"},
325  { dtCactusContact, "dtCactusContact"},
326  { dtMagmaContact, "dtMagmaContact"},
327  { dtLavaContact, "dtLavaContact"},
328  { dtPoisoning, "dtPoisoning"},
329  { dtWithering, "dtWithering"},
330  { dtOnFire, "dtOnFire"},
331  { dtFireContact, "dtFireContact"},
332  { dtInVoid, "dtInVoid"},
333  { dtPotionOfHarming, "dtPotionOfHarming"},
334  { dtAdmin, "dtAdmin"},
335  { dtExplosion, "dtExplosion"},
336  { dtEnvironment, "dtEnvironment"},
337 
338  // Common synonyms:
339  { dtAttack, "dtPawnAttack"},
340  { dtAttack, "dtEntityAttack"},
341  { dtAttack, "dtMob"},
342  { dtAttack, "dtMobAttack"},
343  { dtRangedAttack, "dtArrowAttack"},
344  { dtRangedAttack, "dtArrow"},
345  { dtRangedAttack, "dtProjectile"},
346  { dtFalling, "dtFall"},
347  { dtDrowning, "dtDrown"},
348  { dtSuffocating, "dtSuffocation"},
349  { dtStarving, "dtStarvation"},
350  { dtStarving, "dtHunger"},
351  { dtCactusContact, "dtCactus"},
352  { dtCactusContact, "dtCactuses"},
353  { dtCactusContact, "dtCacti"},
354  { dtMagmaContact, "dtMagma"},
355  { dtLavaContact, "dtLava"},
356  { dtPoisoning, "dtPoison"},
357  { dtWithering, "dtWither"},
358  { dtOnFire, "dtBurning"},
359  { dtFireContact, "dtInFire"},
360  { dtAdmin, "dtPlugin"},
361  } ;
362  for (size_t i = 0; i < ARRAYCOUNT(DamageTypeMap); i++)
363  {
364  if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0)
365  {
366  return DamageTypeMap[i].m_DamageType;
367  }
368  } // for i - DamageTypeMap[]
369 
370  // Not found:
371  return static_cast<eDamageType>(-1);
372 }
373 
374 
375 
376 
377 
378 void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse)
379 {
380  LOGWARNING("AddFaceDirection with X/Y/Z parameters is deprecated, use the vector version");
381 
382  const auto Offset = AddFaceDirection({ a_BlockX, a_BlockY, a_BlockZ }, a_BlockFace, a_bInverse);
383  a_BlockX = Offset.x;
384  a_BlockY = Offset.y;
385  a_BlockZ = Offset.z;
386 }
387 
388 
389 
390 
391 
392 Vector3i AddFaceDirection(const Vector3i a_Position, const eBlockFace a_BlockFace, const bool a_InvertDirection)
393 {
394  const int Offset = a_InvertDirection ? -1 : 1;
395 
396  switch (a_BlockFace)
397  {
398  case BLOCK_FACE_YP: return a_Position.addedY(+Offset);
399  case BLOCK_FACE_YM: return a_Position.addedY(-Offset);
400  case BLOCK_FACE_ZM: return a_Position.addedZ(-Offset);
401  case BLOCK_FACE_ZP: return a_Position.addedZ(+Offset);
402  case BLOCK_FACE_XP: return a_Position.addedX(+Offset);
403  case BLOCK_FACE_XM: return a_Position.addedX(-Offset);
404  case BLOCK_FACE_NONE: break;
405  }
406 
407  UNREACHABLE("Unsupported block face");
408 }
409 
410 
411 
412 
413 
414 bool ItemCategory::IsPickaxe(short a_ItemType)
415 {
416  switch (a_ItemType)
417  {
420  case E_ITEM_IRON_PICKAXE:
421  case E_ITEM_GOLD_PICKAXE:
423  {
424  return true;
425  }
426  default:
427  {
428  return false;
429  }
430  }
431 }
432 
433 
434 
435 
436 
437 bool ItemCategory::IsAxe(short a_ItemType)
438 {
439  switch (a_ItemType)
440  {
441  case E_ITEM_WOODEN_AXE:
442  case E_ITEM_STONE_AXE:
443  case E_ITEM_IRON_AXE:
444  case E_ITEM_GOLD_AXE:
445  case E_ITEM_DIAMOND_AXE:
446  {
447  return true;
448  }
449  default:
450  {
451  return false;
452  }
453  }
454 }
455 
456 
457 
458 
459 
460 bool ItemCategory::IsSword(short a_ItemID)
461 {
462  return (a_ItemID == E_ITEM_WOODEN_SWORD)
463  || (a_ItemID == E_ITEM_STONE_SWORD)
464  || (a_ItemID == E_ITEM_IRON_SWORD)
465  || (a_ItemID == E_ITEM_GOLD_SWORD)
466  || (a_ItemID == E_ITEM_DIAMOND_SWORD);
467 }
468 
469 
470 
471 
472 
473 bool ItemCategory::IsHoe(short a_ItemID)
474 {
475  return (a_ItemID == E_ITEM_WOODEN_HOE)
476  || (a_ItemID == E_ITEM_STONE_HOE)
477  || (a_ItemID == E_ITEM_IRON_HOE)
478  || (a_ItemID == E_ITEM_GOLD_HOE)
479  || (a_ItemID == E_ITEM_DIAMOND_HOE);
480 }
481 
482 
483 
484 
485 
486 bool ItemCategory::IsShovel(short a_ItemID)
487 {
488  return (a_ItemID == E_ITEM_WOODEN_SHOVEL)
489  || (a_ItemID == E_ITEM_STONE_SHOVEL)
490  || (a_ItemID == E_ITEM_IRON_SHOVEL)
491  || (a_ItemID == E_ITEM_GOLD_SHOVEL)
492  || (a_ItemID == E_ITEM_DIAMOND_SHOVEL);
493 }
494 
495 
496 
497 
498 
499 bool ItemCategory::IsTool(short a_ItemID)
500 {
501  return IsPickaxe( a_ItemID)
502  || IsAxe ( a_ItemID)
503  || IsSword ( a_ItemID)
504  || IsHoe ( a_ItemID)
505  || IsShovel ( a_ItemID);
506 }
507 
508 
509 
510 
511 
512 bool ItemCategory::IsHelmet(short a_ItemType)
513 {
514  return (
515  (a_ItemType == E_ITEM_LEATHER_CAP) ||
516  (a_ItemType == E_ITEM_GOLD_HELMET) ||
517  (a_ItemType == E_ITEM_CHAIN_HELMET) ||
518  (a_ItemType == E_ITEM_IRON_HELMET) ||
519  (a_ItemType == E_ITEM_DIAMOND_HELMET)
520  );
521 }
522 
523 
524 
525 
526 
527 bool ItemCategory::IsChestPlate(short a_ItemType)
528 {
529  return (
530  (a_ItemType == E_ITEM_ELYTRA) ||
531  (a_ItemType == E_ITEM_LEATHER_TUNIC) ||
532  (a_ItemType == E_ITEM_GOLD_CHESTPLATE) ||
533  (a_ItemType == E_ITEM_CHAIN_CHESTPLATE) ||
534  (a_ItemType == E_ITEM_IRON_CHESTPLATE) ||
535  (a_ItemType == E_ITEM_DIAMOND_CHESTPLATE)
536  );
537 }
538 
539 
540 
541 
542 
543 bool ItemCategory::IsLeggings(short a_ItemType)
544 {
545  return (
546  (a_ItemType == E_ITEM_LEATHER_PANTS) ||
547  (a_ItemType == E_ITEM_GOLD_LEGGINGS) ||
548  (a_ItemType == E_ITEM_CHAIN_LEGGINGS) ||
549  (a_ItemType == E_ITEM_IRON_LEGGINGS) ||
550  (a_ItemType == E_ITEM_DIAMOND_LEGGINGS)
551  );
552 }
553 
554 
555 
556 
557 
558 bool ItemCategory::IsBoots(short a_ItemType)
559 {
560  return (
561  (a_ItemType == E_ITEM_LEATHER_BOOTS) ||
562  (a_ItemType == E_ITEM_GOLD_BOOTS) ||
563  (a_ItemType == E_ITEM_CHAIN_BOOTS) ||
564  (a_ItemType == E_ITEM_IRON_BOOTS) ||
565  (a_ItemType == E_ITEM_DIAMOND_BOOTS)
566  );
567 }
568 
569 
570 
571 
572 
573 bool ItemCategory::IsMinecart(short a_ItemType)
574 {
575  return (
576  (a_ItemType == E_ITEM_MINECART) ||
577  (a_ItemType == E_ITEM_CHEST_MINECART) ||
578  (a_ItemType == E_ITEM_FURNACE_MINECART) ||
579  (a_ItemType == E_ITEM_MINECART_WITH_TNT) ||
580  (a_ItemType == E_ITEM_MINECART_WITH_HOPPER)
581  );
582 }
583 
584 
585 
586 
587 
588 bool ItemCategory::IsArmor(short a_ItemType)
589 {
590  return (
591  IsHelmet(a_ItemType) ||
592  IsChestPlate(a_ItemType) ||
593  IsLeggings(a_ItemType) ||
594  IsBoots(a_ItemType)
595  );
596 }
597 
598 
599 
600 
601 
602 bool ItemCategory::IsHorseArmor(short a_ItemType)
603 {
604  switch (a_ItemType)
605  {
609  {
610  return true;
611  }
612  default:
613  {
614  return false;
615  }
616  }
617 }
618 
619 
620 
621 
622 
623 bool ItemCategory::IsVillagerFood(short a_ItemType)
624 {
625  switch (a_ItemType)
626  {
627  case E_ITEM_CARROT:
628  case E_ITEM_POTATO:
629  case E_ITEM_BREAD:
630  case E_ITEM_BEETROOT:
631  case E_ITEM_SEEDS:
633  case E_ITEM_WHEAT:
634  {
635  return true;
636  }
637 
638  default:
639  {
640  return false;
641  }
642  }
643 }
const char * m_String
Definition: BiomeDef.cpp:17
@ E_BLOCK_MAX_TYPE_ID
Maximum BlockType number used.
Definition: BlockType.h:278
@ E_ITEM_WOODEN_PICKAXE
Definition: BlockType.h:314
@ E_ITEM_GOLD_BOOTS
Definition: BlockType.h:361
@ E_ITEM_STONE_PICKAXE
Definition: BlockType.h:318
@ E_ITEM_DIAMOND_AXE
Definition: BlockType.h:323
@ E_ITEM_LEATHER_PANTS
Definition: BlockType.h:344
@ E_ITEM_CHAIN_BOOTS
Definition: BlockType.h:349
@ E_ITEM_IRON_LEGGINGS
Definition: BlockType.h:352
@ E_ITEM_DIAMOND_BOOTS
Definition: BlockType.h:357
@ E_ITEM_STONE_AXE
Definition: BlockType.h:319
@ E_ITEM_CHAIN_HELMET
Definition: BlockType.h:346
@ E_ITEM_CHEST_MINECART
Definition: BlockType.h:387
@ E_ITEM_IRON_HOE
Definition: BlockType.h:336
@ E_ITEM_GOLD_HELMET
Definition: BlockType.h:358
@ E_ITEM_IRON_SWORD
Definition: BlockType.h:311
@ E_ITEM_GOLD_CHESTPLATE
Definition: BlockType.h:359
@ E_ITEM_IRON_HELMET
Definition: BlockType.h:350
@ E_ITEM_MINECART_WITH_TNT
Definition: BlockType.h:453
@ E_ITEM_DIAMOND_HOE
Definition: BlockType.h:337
@ E_ITEM_DIAMOND_PICKAXE
Definition: BlockType.h:322
@ E_ITEM_WHEAT
Definition: BlockType.h:340
@ E_ITEM_MAX_CONSECUTIVE_TYPE_ID
Maximum consecutive ItemType number used.
Definition: BlockType.h:503
@ E_ITEM_WOODEN_HOE
Definition: BlockType.h:334
@ E_ITEM_MINECART
Definition: BlockType.h:372
@ E_ITEM_IRON_CHESTPLATE
Definition: BlockType.h:351
@ E_ITEM_IRON_HORSE_ARMOR
Definition: BlockType.h:463
@ E_ITEM_GOLD_LEGGINGS
Definition: BlockType.h:360
@ E_ITEM_GOLD_HORSE_ARMOR
Definition: BlockType.h:464
@ E_ITEM_DIAMOND_CHESTPLATE
Definition: BlockType.h:355
@ E_ITEM_DIAMOND_HELMET
Definition: BlockType.h:354
@ E_ITEM_MINECART_WITH_HOPPER
Definition: BlockType.h:454
@ E_ITEM_IRON_BOOTS
Definition: BlockType.h:353
@ E_ITEM_GOLD_SHOVEL
Definition: BlockType.h:328
@ E_ITEM_IRON_PICKAXE
Definition: BlockType.h:301
@ E_ITEM_GOLD_PICKAXE
Definition: BlockType.h:329
@ E_ITEM_LAST_DISC
Maximum disc itemtype number used.
Definition: BlockType.h:522
@ E_ITEM_WOODEN_SHOVEL
Definition: BlockType.h:313
@ E_ITEM_LEATHER_TUNIC
Definition: BlockType.h:343
@ E_ITEM_ELYTRA
Definition: BlockType.h:490
@ E_ITEM_DIAMOND_SWORD
Definition: BlockType.h:320
@ E_ITEM_IRON_SHOVEL
Definition: BlockType.h:300
@ E_ITEM_CARROT
Definition: BlockType.h:437
@ E_ITEM_BEETROOT_SEEDS
Definition: BlockType.h:482
@ E_ITEM_GOLD_HOE
Definition: BlockType.h:338
@ E_ITEM_DIAMOND_HORSE_ARMOR
Definition: BlockType.h:465
@ E_ITEM_STONE_SWORD
Definition: BlockType.h:316
@ E_ITEM_STONE_SHOVEL
Definition: BlockType.h:317
@ E_ITEM_FIRST_DISC
Definition: BlockType.h:505
@ E_ITEM_BREAD
Definition: BlockType.h:341
@ E_ITEM_DIAMOND_LEGGINGS
Definition: BlockType.h:356
@ E_ITEM_FIRST
Definition: BlockType.h:298
@ E_ITEM_SEEDS
Definition: BlockType.h:339
@ E_ITEM_FURNACE_MINECART
Definition: BlockType.h:388
@ E_ITEM_DIAMOND_SHOVEL
Definition: BlockType.h:321
@ E_ITEM_STONE_HOE
Definition: BlockType.h:335
@ E_ITEM_WOODEN_SWORD
Definition: BlockType.h:312
@ E_ITEM_LEATHER_CAP
Definition: BlockType.h:342
@ E_ITEM_BEETROOT
Definition: BlockType.h:481
@ E_ITEM_WOODEN_AXE
Definition: BlockType.h:315
@ E_ITEM_GOLD_AXE
Definition: BlockType.h:330
@ E_ITEM_GOLD_SWORD
Definition: BlockType.h:327
@ E_ITEM_CHAIN_CHESTPLATE
Definition: BlockType.h:347
@ E_ITEM_LEATHER_BOOTS
Definition: BlockType.h:345
@ E_ITEM_CHAIN_LEGGINGS
Definition: BlockType.h:348
@ E_ITEM_IRON_AXE
Definition: BlockType.h:302
@ E_ITEM_POTATO
Definition: BlockType.h:438
bool IsValidBlock(int a_BlockType)
Returns true if the specified block type is valid (known).
Definition: Defines.cpp:160
eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
Returns a blockface opposite to the one specified.
Definition: Defines.cpp:121
eDamageType StringToDamageType(const AString &a_DamageTypeString)
Translates a damage type string to damage type.
Definition: Defines.cpp:300
AString DimensionToString(eDimension a_Dimension)
Translates a dimension enum to dimension string.
Definition: Defines.cpp:236
bool IsValidItem(int a_ItemType)
Returns true if the specified item type is valid (known).
Definition: Defines.cpp:172
eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace)
Returns a blockface rotated around the Y axis counter-clockwise.
Definition: Defines.cpp:77
eDimension StringToDimension(const AString &a_DimensionString)
Translates a dimension string to dimension enum.
Definition: Defines.cpp:194
AString DamageTypeToString(eDamageType a_DamageType)
Translates damage type constant to a string representation (built-in).
Definition: Defines.cpp:267
void AddFaceDirection(int &a_BlockX, int &a_BlockY, int &a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse)
Modifies the specified coords so that they point to the block adjacent to the one specified through i...
Definition: Defines.cpp:378
eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
Returns a blockface mirrored around the Y axis (doesn't change up / down).
Definition: Defines.cpp:54
AString BlockFaceToString(eBlockFace a_BlockFace)
Returns the textual representation of the BlockFace constant.
Definition: Defines.cpp:141
const char * ClickActionToString(int a_ClickAction)
Returns a textual representation of the click action.
Definition: Defines.cpp:10
eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
Returns a blockface rotated around the Y axis clockwise.
Definition: Defines.cpp:99
eDimension
Dimension of a world.
Definition: Defines.h:231
@ dimEnd
Definition: Defines.h:234
@ dimNether
Definition: Defines.h:232
@ dimOverworld
Definition: Defines.h:233
@ caRightPaintProgress
Definition: Defines.h:108
@ caDblClick
Definition: Defines.h:113
@ caLeftPaintProgress
Definition: Defines.h:107
@ caNumber6
Definition: Defines.h:93
@ caNumber8
Definition: Defines.h:95
@ caMiddleClick
Definition: Defines.h:97
@ caCtrlDropKey
Definition: Defines.h:99
@ caLeftPaintEnd
Definition: Defines.h:110
@ caLeftClickOutside
Definition: Defines.h:100
@ caMiddlePaintEnd
Definition: Defines.h:112
@ caLeftClickOutsideHoldNothing
Definition: Defines.h:102
@ caDropKey
Definition: Defines.h:98
@ caShiftRightClick
Definition: Defines.h:87
@ caNumber7
Definition: Defines.h:94
@ caRightClick
Definition: Defines.h:85
@ caNumber4
Definition: Defines.h:91
@ caNumber1
Definition: Defines.h:88
@ caMiddlePaintBegin
Definition: Defines.h:106
@ caMiddlePaintProgress
Definition: Defines.h:109
@ caNumber3
Definition: Defines.h:90
@ caLeftPaintBegin
Definition: Defines.h:104
@ caRightClickOutsideHoldNothing
Definition: Defines.h:103
@ caNumber9
Definition: Defines.h:96
@ caNumber2
Definition: Defines.h:89
@ caRightPaintEnd
Definition: Defines.h:111
@ caRightClickOutside
Definition: Defines.h:101
@ caUnknown
Definition: Defines.h:115
@ caShiftLeftClick
Definition: Defines.h:86
@ caNumber5
Definition: Defines.h:92
@ caRightPaintBegin
Definition: Defines.h:105
@ caLeftClick
Definition: Defines.h:84
eDamageType
Damage type, used in the TakeDamageInfo structure and related functions.
Definition: Defines.h:244
@ dtAdmin
Definition: Defines.h:263
@ dtPoisoning
Definition: Defines.h:256
@ dtSuffocating
Definition: Defines.h:251
@ dtMagmaContact
Definition: Defines.h:254
@ dtAttack
Definition: Defines.h:246
@ dtStarving
Definition: Defines.h:252
@ dtExplosion
Definition: Defines.h:264
@ dtInVoid
Definition: Defines.h:260
@ dtFireContact
Definition: Defines.h:259
@ dtEnderPearl
Definition: Defines.h:262
@ dtDrowning
Definition: Defines.h:250
@ dtEnvironment
Definition: Defines.h:265
@ dtWithering
Definition: Defines.h:257
@ dtRangedAttack
Definition: Defines.h:247
@ dtFalling
Definition: Defines.h:249
@ dtOnFire
Definition: Defines.h:258
@ dtCactusContact
Definition: Defines.h:253
@ dtLavaContact
Definition: Defines.h:255
@ dtLightning
Definition: Defines.h:248
@ dtPotionOfHarming
Definition: Defines.h:261
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:38
@ BLOCK_FACE_XP
Definition: Defines.h:41
@ BLOCK_FACE_YP
Definition: Defines.h:43
@ BLOCK_FACE_YM
Definition: Defines.h:42
@ BLOCK_FACE_ZM
Definition: Defines.h:44
@ BLOCK_FACE_ZP
Definition: Defines.h:45
@ BLOCK_FACE_XM
Definition: Defines.h:40
@ BLOCK_FACE_NONE
Definition: Defines.h:39
#define UNREACHABLE(x)
Definition: Globals.h:288
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
Definition: Globals.h:231
void LOGWARNING(std::string_view a_Format, const Args &... args)
Definition: LoggerSimple.h:67
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
std::string AString
Definition: StringUtils.h:11
bool StringToInteger(const AString &a_str, T &a_Num)
Parses any integer type.
Definition: StringUtils.h:143
bool IsMinecart(short a_ItemType)
Definition: Defines.cpp:573
bool IsHoe(short a_ItemType)
Definition: Defines.cpp:473
bool IsHelmet(short a_ItemType)
Definition: Defines.cpp:512
bool IsPickaxe(short a_ItemType)
Definition: Defines.cpp:414
bool IsTool(short a_ItemType)
Definition: Defines.cpp:499
bool IsAxe(short a_ItemType)
Definition: Defines.cpp:437
bool IsVillagerFood(short a_ItemType)
Definition: Defines.cpp:623
bool IsLeggings(short a_ItemType)
Definition: Defines.cpp:543
bool IsChestPlate(short a_ItemType)
Definition: Defines.cpp:527
bool IsArmor(short a_ItemType)
Definition: Defines.cpp:588
bool IsBoots(short a_ItemType)
Definition: Defines.cpp:558
bool IsShovel(short a_ItemType)
Definition: Defines.cpp:486
bool IsHorseArmor(short a_ItemType)
Definition: Defines.cpp:602
bool IsSword(short a_ItemType)
Definition: Defines.cpp:460
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
Definition: Vector3.h:314
Vector3< T > addedZ(T a_AddZ) const
Returns a copy of this vector moved by the specified amount on the Z axis.
Definition: Vector3.h:320
Vector3< T > addedX(T a_AddX) const
Returns a copy of this vector moved by the specified amount on the X axis.
Definition: Vector3.h:308