Cuberite
A lightweight, fast and extensible game server for Minecraft
Defines.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 
5 
6 
7 
9 typedef std::vector<int> cSlotNums;
10 
11 
12 
13 
14 
15 // tolua_begin
16 
18 enum
19 {
20  // Open to suggestion on naming convention here :)
22 } ;
23 
24 
25 
26 
27 
30 {
31  BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air
32  BLOCK_FACE_XM = 4, // Interacting with the X- face of the block
33  BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block
34  BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block
35  BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block
36  BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block
37  BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block
38 
39  // Synonyms using the (deprecated) world directions:
40  BLOCK_FACE_BOTTOM = BLOCK_FACE_YM, // Interacting with the bottom face of the block
41  BLOCK_FACE_TOP = BLOCK_FACE_YP, // Interacting with the top face of the block
42  BLOCK_FACE_NORTH = BLOCK_FACE_ZM, // Interacting with the northern face of the block
43  BLOCK_FACE_SOUTH = BLOCK_FACE_ZP, // Interacting with the southern face of the block
44  BLOCK_FACE_WEST = BLOCK_FACE_XM, // Interacting with the western face of the block
45  BLOCK_FACE_EAST = BLOCK_FACE_XP, // Interacting with the eastern face of the block
46 
47  // Bounds, used for range-checking:
50 } ;
51 
52 
53 
54 
55 
57 enum
58 {
66 } ;
67 
68 
69 
70 
71 
74 {
75  // Sorted by occurrence in the 1.5 protocol
106  // Add new actions here
107  caUnknown = 255,
108 
109  // Keep this list in sync with ClickActionToString() function below!
110 } ;
111 
112 
113 
114 
115 
117 {
123 
124  // Easier-to-use synonyms:
130 
131  // These two are used to check GameMode for validity when converting from integers.
132  gmMax, // Gets automatically assigned
133  gmMin = 0,
134 } ;
135 
136 
137 
138 
139 
141 {
143  ctSystem = 1,
145 } ;
146 
147 
148 
149 
150 
152 {
156 
157  // Easier-to-use synonyms:
162 } ;
163 
164 
165 
166 
167 
169 {
176 } ;
177 
178 
179 
180 
181 
183 {
200 } ;
201 
202 
203 
204 
205 
206 enum eHand
207 {
208  hMain = 0,
209  hOff = 1,
210 } ;
211 
212 
213 
214 
215 
217 {
218  mhLeft = 0,
219  mhRight = 1,
220 } ;
221 
222 
223 
224 
225 
227 {
228  spCape = 0x01,
229  spJacket = 0x02,
230  spLeftSleeve = 0x04,
232  spLeftPants = 0x10,
233  spRightPants = 0x20,
234  spHat = 0x40,
235  spMask = 0x7F,
236 };
237 
238 
239 
240 
241 
242 inline const char * ClickActionToString(int a_ClickAction)
243 {
244  switch (a_ClickAction)
245  {
246  case caLeftClick: return "caLeftClick";
247  case caRightClick: return "caRightClick";
248  case caShiftLeftClick: return "caShiftLeftClick";
249  case caShiftRightClick: return "caShiftRightClick";
250  case caNumber1: return "caNumber1";
251  case caNumber2: return "caNumber2";
252  case caNumber3: return "caNumber3";
253  case caNumber4: return "caNumber4";
254  case caNumber5: return "caNumber5";
255  case caNumber6: return "caNumber6";
256  case caNumber7: return "caNumber7";
257  case caNumber8: return "caNumber8";
258  case caNumber9: return "caNumber9";
259  case caMiddleClick: return "caMiddleClick";
260  case caDropKey: return "caDropKey";
261  case caCtrlDropKey: return "caCtrlDropKey";
262  case caLeftClickOutside: return "caLeftClickOutside";
263  case caRightClickOutside: return "caRightClickOutside";
264  case caLeftClickOutsideHoldNothing: return "caLeftClickOutsideHoldNothing";
265  case caRightClickOutsideHoldNothing: return "caRightClickOutsideHoldNothing";
266  case caLeftPaintBegin: return "caLeftPaintBegin";
267  case caRightPaintBegin: return "caRightPaintBegin";
268  case caMiddlePaintBegin: return "caMiddlePaintBegin";
269  case caLeftPaintProgress: return "caLeftPaintProgress";
270  case caRightPaintProgress: return "caRightPaintProgress";
271  case caMiddlePaintProgress: return "caMiddlePaintProgress";
272  case caLeftPaintEnd: return "caLeftPaintEnd";
273  case caRightPaintEnd: return "caRightPaintEnd";
274  case caMiddlePaintEnd: return "caMiddlePaintEnd";
275  case caDblClick: return "caDblClick";
276 
277  case caUnknown: return "caUnknown";
278  }
279  UNREACHABLE("Unknown click action");
280 }
281 
282 
283 
284 
285 
288 {
289  switch (a_BlockFace)
290  {
291  case BLOCK_FACE_XM: return BLOCK_FACE_XP;
292  case BLOCK_FACE_XP: return BLOCK_FACE_XM;
293  case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
294  case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
295  case BLOCK_FACE_NONE:
296  case BLOCK_FACE_YM:
297  case BLOCK_FACE_YP:
298  {
299  return a_BlockFace;
300  }
301  }
302  UNREACHABLE("Unsupported block face");
303 }
304 
305 
306 
307 
308 
311 {
312  switch (a_BlockFace)
313  {
314  case BLOCK_FACE_XM: return BLOCK_FACE_ZP;
315  case BLOCK_FACE_XP: return BLOCK_FACE_ZM;
316  case BLOCK_FACE_ZM: return BLOCK_FACE_XM;
317  case BLOCK_FACE_ZP: return BLOCK_FACE_XP;
318  case BLOCK_FACE_NONE:
319  case BLOCK_FACE_YM:
320  case BLOCK_FACE_YP:
321  {
322  return a_BlockFace;
323  }
324  }
325  UNREACHABLE("Unsupported block face");
326 }
327 
328 
329 
330 
331 
333 {
334  switch (a_BlockFace)
335  {
336  case BLOCK_FACE_XM: return BLOCK_FACE_ZM;
337  case BLOCK_FACE_XP: return BLOCK_FACE_ZP;
338  case BLOCK_FACE_ZM: return BLOCK_FACE_XP;
339  case BLOCK_FACE_ZP: return BLOCK_FACE_XM;
340  case BLOCK_FACE_NONE:
341  case BLOCK_FACE_YM:
342  case BLOCK_FACE_YP:
343  {
344  return a_BlockFace;
345  }
346  }
347  UNREACHABLE("Unsupported block face");
348 }
349 
350 
351 
352 
353 
355 {
356  switch (a_BlockFace)
357  {
358  case BLOCK_FACE_YP: return BLOCK_FACE_YM;
359  case BLOCK_FACE_XP: return BLOCK_FACE_XM;
360  case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
361  case BLOCK_FACE_YM: return BLOCK_FACE_YP;
362  case BLOCK_FACE_XM: return BLOCK_FACE_XP;
363  case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
364  case BLOCK_FACE_NONE: return a_BlockFace;
365  }
366  UNREACHABLE("Unsupported block face");
367 }
368 
369 
370 
371 
372 
375 {
376  switch (a_BlockFace)
377  {
378  case BLOCK_FACE_XM: return "BLOCK_FACE_XM";
379  case BLOCK_FACE_XP: return "BLOCK_FACE_XP";
380  case BLOCK_FACE_YM: return "BLOCK_FACE_YM";
381  case BLOCK_FACE_YP: return "BLOCK_FACE_YP";
382  case BLOCK_FACE_ZM: return "BLOCK_FACE_ZM";
383  case BLOCK_FACE_ZP: return "BLOCK_FACE_ZP";
384  case BLOCK_FACE_NONE: return "BLOCK_FACE_NONE";
385  }
386  UNREACHABLE("Unsupported block face");
387 }
388 
389 
390 
391 
392 
393 inline bool IsValidBlock(int a_BlockType)
394 {
395  if (
396  (
397  (a_BlockType > -1) &&
398  (a_BlockType <= E_BLOCK_MAX_TYPE_ID)
399  ) ||
400  (a_BlockType == 255) // the blocks 253-254 don't exist yet -> https://minecraft.gamepedia.com/Data_values#Block_IDs
401  )
402  {
403  return true;
404  }
405  return false;
406 }
407 
408 
409 
410 
411 
412 inline bool IsValidItem(int a_ItemType)
413 {
414  if (
415  ((a_ItemType >= E_ITEM_FIRST) && (a_ItemType <= E_ITEM_MAX_CONSECUTIVE_TYPE_ID)) || // Basic items range
416  ((a_ItemType >= E_ITEM_FIRST_DISC) && (a_ItemType <= E_ITEM_LAST_DISC)) // Music discs' special range
417  )
418  {
419  return true;
420  }
421 
422  if (a_ItemType == 0)
423  {
424  return false;
425  }
426 
427  return IsValidBlock(a_ItemType);
428 }
429 
430 // tolua_end
431 
432 
433 
434 
435 
436 inline bool IsBlockWater(BLOCKTYPE a_BlockType)
437 {
438  return ((a_BlockType == E_BLOCK_WATER) || (a_BlockType == E_BLOCK_STATIONARY_WATER));
439 }
440 
441 
442 
443 
444 
445 inline bool IsBlockIce(BLOCKTYPE a_BlockType)
446 {
447  switch (a_BlockType)
448  {
449  case E_BLOCK_ICE:
450  case E_BLOCK_PACKED_ICE:
451  case E_BLOCK_FROSTED_ICE:
452  {
453  return true;
454  }
455  default:
456  {
457  return false;
458  }
459  }
460 }
461 
462 
463 
464 
465 
466 inline bool IsBlockWaterOrIce(BLOCKTYPE a_BlockType)
467 {
468  return (IsBlockWater(a_BlockType) || IsBlockIce(a_BlockType));
469 }
470 
471 
472 
473 
474 
475 inline bool IsBlockLava(BLOCKTYPE a_BlockType)
476 {
477  return ((a_BlockType == E_BLOCK_LAVA) || (a_BlockType == E_BLOCK_STATIONARY_LAVA));
478 }
479 
480 
481 
482 
483 
484 inline bool IsBlockLiquid(BLOCKTYPE a_BlockType)
485 {
486  return IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType);
487 }
488 
489 
490 
491 
492 inline bool IsBlockRail(BLOCKTYPE a_BlockType)
493 {
494  switch (a_BlockType)
495  {
496  case E_BLOCK_RAIL:
500  {
501  return true;
502  }
503  default: return false;
504  }
505 }
506 
507 
508 
509 
510 
511 inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType)
512 {
513  switch (a_BlockType)
514  {
515  case E_BLOCK_DIRT:
516  case E_BLOCK_GRASS:
517  case E_BLOCK_FARMLAND:
518  case E_BLOCK_GRASS_PATH:
519  {
520  return true;
521  }
522  }
523  return false;
524 }
525 
526 
527 
528 
529 inline bool IsBlockFence(BLOCKTYPE a_BlockType)
530 {
531  switch (a_BlockType)
532  {
535  case E_BLOCK_BIRCH_FENCE:
540  case E_BLOCK_FENCE:
547  {
548  return true;
549  }
550  default:
551  {
552  return false;
553  }
554  }
555 }
556 
557 
558 
559 
560 
561 inline bool IsBlockMaterialWood(BLOCKTYPE a_BlockType)
562 {
563  switch (a_BlockType)
564  {
565  case E_BLOCK_PLANKS:
566  case E_BLOCK_LOG:
567  case E_BLOCK_NOTE_BLOCK:
568  case E_BLOCK_BOOKCASE:
570  case E_BLOCK_CHEST:
572  case E_BLOCK_SIGN_POST:
573  case E_BLOCK_OAK_DOOR:
574  case E_BLOCK_WALLSIGN:
576  case E_BLOCK_JUKEBOX:
577  case E_BLOCK_FENCE:
578  case E_BLOCK_TRAPDOOR:
583  case E_BLOCK_WOODEN_SLAB:
589  case E_BLOCK_NEW_LOG:
593  case E_BLOCK_WALL_BANNER:
601  case E_BLOCK_BIRCH_FENCE:
605  case E_BLOCK_SPRUCE_DOOR:
606  case E_BLOCK_BIRCH_DOOR:
607  case E_BLOCK_JUNGLE_DOOR:
608  case E_BLOCK_ACACIA_DOOR:
610  {
611  return true;
612  }
613  default:
614  {
615  return false;
616  }
617  }
618 }
619 
620 
621 
622 
623 
624 inline bool IsBlockMaterialPlants(BLOCKTYPE a_BlockType)
625 {
626  switch (a_BlockType)
627  {
628  case E_BLOCK_SAPLING:
629  case E_BLOCK_DANDELION:
630  case E_BLOCK_FLOWER:
633  case E_BLOCK_CROPS:
634  case E_BLOCK_REEDS:
636  case E_BLOCK_MELON_STEM:
637  case E_BLOCK_LILY_PAD:
638  case E_BLOCK_NETHER_WART:
639  case E_BLOCK_COCOA_POD:
640  case E_BLOCK_CARROTS:
641  case E_BLOCK_POTATOES:
644  case E_BLOCK_BEETROOTS:
645  {
646  return true;
647  }
648  default:
649  {
650  return false;
651  }
652  }
653 }
654 
655 
656 
657 
658 
659 inline bool IsBlockMaterialVine(BLOCKTYPE a_BlockType)
660 {
661  switch (a_BlockType)
662  {
663  case E_BLOCK_TALL_GRASS:
664  case E_BLOCK_DEAD_BUSH:
665  case E_BLOCK_VINES:
666  case E_BLOCK_BIG_FLOWER:
667  {
668  return true;
669  }
670  default:
671  {
672  return false;
673  }
674  }
675 }
676 
677 
678 
679 
680 
681 inline bool IsBlockMaterialIron(BLOCKTYPE a_BlockType)
682 {
683  switch (a_BlockType)
684  {
685  case E_BLOCK_LAPIS_BLOCK:
686  case E_BLOCK_GOLD_BLOCK:
687  case E_BLOCK_IRON_BLOCK:
689  case E_BLOCK_IRON_DOOR:
690  case E_BLOCK_IRON_BARS:
692  case E_BLOCK_CAULDRON:
698  case E_BLOCK_HOPPER:
703  {
704  return true;
705  }
706  default:
707  {
708  return false;
709  }
710  }
711 }
712 
713 
714 
715 
716 
717 inline bool IsBlockMaterialAnvil(BLOCKTYPE a_BlockType)
718 {
719  return (a_BlockType == E_BLOCK_ANVIL);
720 }
721 
722 
723 
724 
725 
726 inline bool IsBlocksWeb(BLOCKTYPE a_BlockType)
727 {
728  return (a_BlockType == E_BLOCK_COBWEB);
729 }
730 
731 
732 
733 
734 
735 inline bool IsBlockMaterialLeaves(BLOCKTYPE a_BlockType)
736 {
737  return (a_BlockType == E_BLOCK_LEAVES) || (a_BlockType == E_BLOCK_NEW_LEAVES);
738 }
739 
740 
741 
742 
743 
744 inline bool IsBlocksWool(BLOCKTYPE a_BlockType)
745 {
746  return (a_BlockType == E_BLOCK_WOOL);
747 }
748 
749 
750 
751 
752 
753 inline bool IsBlockMaterialGourd(BLOCKTYPE a_BlockType)
754 {
755  switch (a_BlockType)
756  {
757  case E_BLOCK_PUMPKIN:
759  case E_BLOCK_MELON:
760  {
761  return true;
762  }
763  default:
764  {
765  return false;
766  }
767  }
768 }
769 
770 
771 
772 
773 
774 inline bool IsBlockMaterialCoral(BLOCKTYPE a_BlockType)
775 {
776  return false; // yes, there is no block in minecraft which belongs to this type.
777 }
778 
779 
780 
781 
782 
783 inline bool IsBlockMaterialRock(BLOCKTYPE a_BlockType)
784 {
785  switch (a_BlockType)
786  {
787  case E_BLOCK_STONE:
788  case E_BLOCK_COBBLESTONE:
789  case E_BLOCK_BEDROCK:
790  case E_BLOCK_GOLD_ORE:
791  case E_BLOCK_IRON_ORE:
792  case E_BLOCK_COAL_ORE:
793  case E_BLOCK_LAPIS_ORE:
794  case E_BLOCK_DISPENSER:
795  case E_BLOCK_SANDSTONE:
797  case E_BLOCK_STONE_SLAB:
798  case E_BLOCK_BRICK:
800  case E_BLOCK_OBSIDIAN:
801  case E_BLOCK_MOB_SPAWNER:
802  case E_BLOCK_DIAMOND_ORE:
803  case E_BLOCK_FURNACE:
804  case E_BLOCK_LIT_FURNACE:
809  case E_BLOCK_NETHERRACK:
818  case E_BLOCK_END_STONE:
820  case E_BLOCK_EMERALD_ORE:
821  case E_BLOCK_ENDER_CHEST:
826  case E_BLOCK_DROPPER:
839  case E_BLOCK_PURPUR_SLAB:
840  case E_BLOCK_END_BRICKS:
841  case E_BLOCK_MAGMA:
843  case E_BLOCK_BONE_BLOCK:
844  case E_BLOCK_OBSERVER:
845  {
846  return true;
847  }
848  default:
849  {
850  return false;
851  }
852  }
853 }
854 
855 
856 
857 
858 
859 inline void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse = false) // tolua_export
860 { // tolua_export
861  if (!a_bInverse)
862  {
863  switch (a_BlockFace)
864  {
865  case BLOCK_FACE_YP: a_BlockY++; break;
866  case BLOCK_FACE_YM: a_BlockY--; break;
867  case BLOCK_FACE_ZM: a_BlockZ--; break;
868  case BLOCK_FACE_ZP: a_BlockZ++; break;
869  case BLOCK_FACE_XP: a_BlockX++; break;
870  case BLOCK_FACE_XM: a_BlockX--; break;
871  case BLOCK_FACE_NONE:
872  {
873  LOGWARNING("%s: Unknown face: %d", __FUNCTION__, a_BlockFace);
874  ASSERT(!"AddFaceDirection(): Unknown face");
875  break;
876  }
877  }
878  }
879  else
880  {
881  switch (a_BlockFace)
882  {
883  case BLOCK_FACE_YP: a_BlockY--; break;
884  case BLOCK_FACE_YM: a_BlockY++; break;
885  case BLOCK_FACE_ZM: a_BlockZ++; break;
886  case BLOCK_FACE_ZP: a_BlockZ--; break;
887  case BLOCK_FACE_XP: a_BlockX--; break;
888  case BLOCK_FACE_XM: a_BlockX++; break;
889  case BLOCK_FACE_NONE:
890  {
891  LOGWARNING("%s: Unknown inv face: %d", __FUNCTION__, a_BlockFace);
892  ASSERT(!"AddFaceDirection(): Unknown face");
893  break;
894  }
895  }
896  }
897 } // tolua_export
898 
899 
900 
901 
902 
903 inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse = false)
904 {
905  int Y = a_BlockY;
906  AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
907  a_BlockY = Clamp<unsigned char>(static_cast<unsigned char>(Y), 0, cChunkDef::Height - 1);
908 }
909 
910 
911 
912 
913 
914 inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z)
915 {
916  // a_X = sinf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
917  // a_Y = -sinf ( a_Pitch / 180 * PI);
918  // a_Z = -cosf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
919  a_X = cos(a_Pan / 180 * M_PI) * cos(a_Pitch / 180 * M_PI);
920  a_Y = sin(a_Pan / 180 * M_PI) * cos(a_Pitch / 180 * M_PI);
921  a_Z = sin(a_Pitch / 180 * M_PI);
922 }
923 
924 
925 
926 
927 
928 inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, double & a_Pitch)
929 {
930  double r = sqrt((a_X * a_X) + (a_Z * a_Z));
931  if (r < std::numeric_limits<double>::epsilon())
932  {
933  a_Pan = 0;
934  }
935  else
936  {
937  a_Pan = atan2(a_Z, a_X) * 180 / M_PI - 90;
938  }
939 
940  a_Pitch = atan2(a_Y, r) * 180 / M_PI;
941 }
942 
943 
944 
945 
946 
947 inline float GetSignf(float a_Val)
948 {
949  return (a_Val < 0.f) ? -1.f : 1.f;
950 }
951 
952 
953 
954 
955 
956 inline float GetSpecialSignf( float a_Val)
957 {
958  return (a_Val <= 0.f) ? -1.f : 1.f;
959 }
960 
961 
962 
963 
964 
965 template <class T> inline T Diff(T a_Val1, T a_Val2)
966 {
967  return std::abs(a_Val1 - a_Val2);
968 }
969 
970 
971 
972 
973 
974 // tolua_begin
975 
977 {
978  // https://forum.cuberite.org/thread-1212.html
979  // MessageType...
980 
981  mtCustom, // Send raw data without any processing
982  mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege)
983  mtInformation, // Informational message (i.e. command usage)
984  mtSuccess, // Something executed successfully
985  mtWarning, // Something concerning (i.e. reload) is about to happen
986  mtFatal, // Something catastrophic occured (i.e. plugin crash)
987  mtDeath, // Denotes death of player
988  mtPrivateMessage, // Player to player messaging identifier
989  mtJoin, // A player has joined the server
990  mtLeave, // A player has left the server
991  mtMaxPlusOne, // The first invalid type, used for checking on LuaAPI boundaries
992 
993  // Common aliases:
998 };
999 
1000 
1001 
1002 
1003 
1005 inline double NormalizeAngleDegrees(const double a_Degrees)
1006 {
1007  double Norm = fmod(a_Degrees + 180, 360);
1008  if (Norm < 0)
1009  {
1010  Norm += 360;
1011  }
1012  return Norm - 180;
1013 }
1014 
1015 
1016 
1017 
1018 
1019 namespace ItemCategory
1020 {
1021  inline bool IsPickaxe(short a_ItemID)
1022  {
1023  return (a_ItemID == E_ITEM_WOODEN_PICKAXE)
1024  || (a_ItemID == E_ITEM_STONE_PICKAXE)
1025  || (a_ItemID == E_ITEM_IRON_PICKAXE)
1026  || (a_ItemID == E_ITEM_GOLD_PICKAXE)
1027  || (a_ItemID == E_ITEM_DIAMOND_PICKAXE);
1028  }
1029 
1030 
1031 
1032  inline bool IsAxe(short a_ItemID)
1033  {
1034  return (a_ItemID == E_ITEM_WOODEN_AXE)
1035  || (a_ItemID == E_ITEM_STONE_AXE)
1036  || (a_ItemID == E_ITEM_IRON_AXE)
1037  || (a_ItemID == E_ITEM_GOLD_AXE)
1038  || (a_ItemID == E_ITEM_DIAMOND_AXE);
1039  }
1040 
1041 
1042 
1043  inline bool IsSword(short a_ItemID)
1044  {
1045  return (a_ItemID == E_ITEM_WOODEN_SWORD)
1046  || (a_ItemID == E_ITEM_STONE_SWORD)
1047  || (a_ItemID == E_ITEM_IRON_SWORD)
1048  || (a_ItemID == E_ITEM_GOLD_SWORD)
1049  || (a_ItemID == E_ITEM_DIAMOND_SWORD);
1050  }
1051 
1052 
1053 
1054  inline bool IsHoe(short a_ItemID)
1055  {
1056  return (a_ItemID == E_ITEM_WOODEN_HOE)
1057  || (a_ItemID == E_ITEM_STONE_HOE)
1058  || (a_ItemID == E_ITEM_IRON_HOE)
1059  || (a_ItemID == E_ITEM_GOLD_HOE)
1060  || (a_ItemID == E_ITEM_DIAMOND_HOE);
1061  }
1062 
1063 
1064 
1065  inline bool IsShovel(short a_ItemID)
1066  {
1067  return (a_ItemID == E_ITEM_WOODEN_SHOVEL)
1068  || (a_ItemID == E_ITEM_STONE_SHOVEL)
1069  || (a_ItemID == E_ITEM_IRON_SHOVEL)
1070  || (a_ItemID == E_ITEM_GOLD_SHOVEL)
1071  || (a_ItemID == E_ITEM_DIAMOND_SHOVEL);
1072  }
1073 
1074 
1075 
1076  inline bool IsTool(short a_ItemID)
1077  {
1078  return IsPickaxe( a_ItemID)
1079  || IsAxe ( a_ItemID)
1080  || IsSword ( a_ItemID)
1081  || IsHoe ( a_ItemID)
1082  || IsShovel ( a_ItemID);
1083  }
1084 
1085 
1086 
1087  inline bool IsHelmet(short a_ItemType)
1088  {
1089  return (
1090  (a_ItemType == E_ITEM_LEATHER_CAP) ||
1091  (a_ItemType == E_ITEM_GOLD_HELMET) ||
1092  (a_ItemType == E_ITEM_CHAIN_HELMET) ||
1093  (a_ItemType == E_ITEM_IRON_HELMET) ||
1094  (a_ItemType == E_ITEM_DIAMOND_HELMET)
1095  );
1096  }
1097 
1098 
1099 
1100  inline bool IsChestPlate(short a_ItemType)
1101  {
1102  return (
1103  (a_ItemType == E_ITEM_LEATHER_TUNIC) ||
1104  (a_ItemType == E_ITEM_GOLD_CHESTPLATE) ||
1105  (a_ItemType == E_ITEM_CHAIN_CHESTPLATE) ||
1106  (a_ItemType == E_ITEM_IRON_CHESTPLATE) ||
1107  (a_ItemType == E_ITEM_DIAMOND_CHESTPLATE)
1108  );
1109  }
1110 
1111 
1112 
1113  inline bool IsLeggings(short a_ItemType)
1114  {
1115  return (
1116  (a_ItemType == E_ITEM_LEATHER_PANTS) ||
1117  (a_ItemType == E_ITEM_GOLD_LEGGINGS) ||
1118  (a_ItemType == E_ITEM_CHAIN_LEGGINGS) ||
1119  (a_ItemType == E_ITEM_IRON_LEGGINGS) ||
1120  (a_ItemType == E_ITEM_DIAMOND_LEGGINGS)
1121  );
1122  }
1123 
1124 
1125 
1126  inline bool IsBoots(short a_ItemType)
1127  {
1128  return (
1129  (a_ItemType == E_ITEM_LEATHER_BOOTS) ||
1130  (a_ItemType == E_ITEM_GOLD_BOOTS) ||
1131  (a_ItemType == E_ITEM_CHAIN_BOOTS) ||
1132  (a_ItemType == E_ITEM_IRON_BOOTS) ||
1133  (a_ItemType == E_ITEM_DIAMOND_BOOTS)
1134  );
1135  }
1136 
1137 
1138 
1139  inline bool IsMinecart(short a_ItemType)
1140  {
1141  return (
1142  (a_ItemType == E_ITEM_MINECART) ||
1143  (a_ItemType == E_ITEM_CHEST_MINECART) ||
1144  (a_ItemType == E_ITEM_FURNACE_MINECART) ||
1145  (a_ItemType == E_ITEM_MINECART_WITH_TNT) ||
1146  (a_ItemType == E_ITEM_MINECART_WITH_HOPPER)
1147  );
1148  }
1149 
1150 
1151 
1152  inline bool IsArmor(short a_ItemType)
1153  {
1154  return (
1155  IsHelmet(a_ItemType) ||
1156  IsChestPlate(a_ItemType) ||
1157  IsLeggings(a_ItemType) ||
1158  IsBoots(a_ItemType)
1159  );
1160  }
1161 
1162 
1163 
1164  inline bool IsHorseArmor(short a_ItemType)
1165  {
1166  switch (a_ItemType)
1167  {
1171  {
1172  return true;
1173  }
1174  default:
1175  {
1176  return false;
1177  }
1178  }
1179  }
1180 }
1181 
1182 // tolua_end
eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
Definition: Defines.h:332
bool IsBlockMaterialVine(BLOCKTYPE a_BlockType)
Definition: Defines.h:659
bool IsBlockMaterialPlants(BLOCKTYPE a_BlockType)
Definition: Defines.h:624
eSkinPart
Definition: Defines.h:226
AString BlockFaceToString(eBlockFace a_BlockFace)
Returns the textual representation of the BlockFace constant.
Definition: Defines.h:374
eMainHand
Definition: Defines.h:216
eGameMode
Definition: Defines.h:116
eWeather
Definition: Defines.h:151
bool IsBlockWater(BLOCKTYPE a_BlockType)
Definition: Defines.h:436
bool IsBlockFence(BLOCKTYPE a_BlockType)
Definition: Defines.h:529
Definition: Defines.h:234
eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
Returns a blockface mirrored around the Y axis (doesn&#39;t change up / down).
Definition: Defines.h:287
Definition: Defines.h:209
bool IsSword(short a_ItemID)
Definition: Defines.h:1043
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
bool IsHelmet(short a_ItemType)
Definition: Defines.h:1087
eChatType
Definition: Defines.h:140
bool IsTool(short a_ItemID)
Definition: Defines.h:1076
Definition: Defines.h:208
eMobHeadRotation
Definition: Defines.h:182
bool IsHoe(short a_ItemID)
Definition: Defines.h:1054
bool IsLeggings(short a_ItemType)
Definition: Defines.h:1113
bool IsValidItem(int a_ItemType)
Definition: Defines.h:412
eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
Definition: Defines.h:354
bool IsBlockMaterialRock(BLOCKTYPE a_BlockType)
Definition: Defines.h:783
static const int Height
Definition: ChunkDef.h:135
bool IsMinecart(short a_ItemType)
Definition: Defines.h:1139
eClickAction
Individual actions sent in the WindowClick packet.
Definition: Defines.h:73
bool IsBlockLiquid(BLOCKTYPE a_BlockType)
Definition: Defines.h:484
void AddFaceDirection(int &a_BlockX, int &a_BlockY, int &a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse=false)
Definition: Defines.h:859
Definition: Defines.h:133
const char * ClickActionToString(int a_ClickAction)
Definition: Defines.h:242
float GetSpecialSignf(float a_Val)
Definition: Defines.h:956
bool IsChestPlate(short a_ItemType)
Definition: Defines.h:1100
Maximum disc itemtype number used.
Definition: BlockID.h:521
bool IsBlockMaterialWood(BLOCKTYPE a_BlockType)
Definition: Defines.h:561
Definition: Defines.h:132
eMobHeadType
Definition: Defines.h:168
Definition: Defines.h:997
#define ASSERT(x)
Definition: Globals.h:335
void LOGWARNING(const char *a_Format, fmt::ArgList a_ArgList)
Definition: Logger.cpp:174
bool IsBlockWaterOrIce(BLOCKTYPE a_BlockType)
Definition: Defines.h:466
bool IsBlockRail(BLOCKTYPE a_BlockType)
Definition: Defines.h:492
eHand
Definition: Defines.h:206
bool IsHorseArmor(short a_ItemType)
Definition: Defines.h:1164
Definition: Defines.h:159
bool IsValidBlock(int a_BlockType)
Definition: Defines.h:393
bool IsBlockMaterialCoral(BLOCKTYPE a_BlockType)
Definition: Defines.h:774
bool IsArmor(short a_ItemType)
Definition: Defines.h:1152
double NormalizeAngleDegrees(const double a_Degrees)
Normalizes an angle in degrees to the [-180, +180) range:
Definition: Defines.h:1005
std::string AString
Definition: StringUtils.h:13
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
Definition: Defines.h:29
void EulerToVector(double a_Pan, double a_Pitch, double &a_X, double &a_Y, double &a_Z)
Definition: Defines.h:914
bool IsAxe(short a_ItemID)
Definition: Defines.h:1032
bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType)
Definition: Defines.h:511
Maximum BlockType number used.
Definition: BlockID.h:277
bool IsShovel(short a_ItemID)
Definition: Defines.h:1065
bool IsBlocksWool(BLOCKTYPE a_BlockType)
Definition: Defines.h:744
float GetSignf(float a_Val)
Definition: Defines.h:947
Maximum consecutive ItemType number used.
Definition: BlockID.h:502
eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace)
Returns a blockface rotated around the Y axis counter-clockwise.
Definition: Defines.h:310
eMessageType
Definition: Defines.h:976
bool IsBlockIce(BLOCKTYPE a_BlockType)
Definition: Defines.h:445
bool IsBlockMaterialIron(BLOCKTYPE a_BlockType)
Definition: Defines.h:681
bool IsBlockMaterialLeaves(BLOCKTYPE a_BlockType)
Definition: Defines.h:735
bool IsBlockMaterialAnvil(BLOCKTYPE a_BlockType)
Definition: Defines.h:717
bool IsBlocksWeb(BLOCKTYPE a_BlockType)
Definition: Defines.h:726
#define UNREACHABLE(x)
Use to mark code that should be impossible to reach.
Definition: Globals.h:344
bool IsBoots(short a_ItemType)
Definition: Defines.h:1126
bool IsPickaxe(short a_ItemID)
Definition: Defines.h:1021
bool IsBlockMaterialGourd(BLOCKTYPE a_BlockType)
Definition: Defines.h:753
bool IsBlockLava(BLOCKTYPE a_BlockType)
Definition: Defines.h:475
T Diff(T a_Val1, T a_Val2)
Definition: Defines.h:965
std::vector< int > cSlotNums
List of slot numbers, used for inventory-painting.
Definition: Defines.h:9
void VectorToEuler(double a_X, double a_Y, double a_Z, double &a_Pan, double &a_Pitch)
Definition: Defines.h:928