Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockID.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // tolua_begin
5 
6 
8 {
163 
168 
174 
176  E_BLOCK_STAINED_CLAY = 159, // Synonym to terracotta
177  E_BLOCK_TERRACOTTA = 159, // Synonym to stained clay
179  E_BLOCK_NEW_LEAVES = 161, // Acacia and Dark Oak IDs in Minecraft 1.7.x
271  // ...
273 
274  // Keep these two as the last values. Update the last block value to the last block with an id less than 255 when adding another block
275  // IsValidBlock() depends on this (255 gets checked additionally because there is a gap. See https://minecraft.gamepedia.com/Data_values#Block_IDs
278 
279  E_BLOCK_UNFINISHED = 254, // Special type used as a placeholder, signifying that the block lacks implementation
280 
281  // Synonym or ID compatibility
287 };
288 
289 
290 
291 
292 
293 enum ENUM_ITEM_ID : short
294 {
296 
297  E_ITEM_FIRST = 256, // First true item type
298 
304  E_ITEM_BOW = 261,
306  E_ITEM_COAL = 263,
308  E_ITEM_IRON = 265,
309  E_ITEM_GOLD = 266,
324  E_ITEM_BOWL = 281,
366  E_ITEM_SIGN = 323,
376  E_ITEM_BOAT = 333,
378  E_ITEM_MILK = 335,
380  E_ITEM_CLAY = 337,
384  E_ITEM_BOOK = 340,
388  E_ITEM_EGG = 344,
395  E_ITEM_DYE = 351,
396  E_ITEM_BONE = 352,
398  E_ITEM_CAKE = 354,
399  E_ITEM_BED = 355,
402  E_ITEM_MAP = 358,
418  E_ITEM_POTIONS = 373, // OBSOLETE, use E_ITEM_POTION instead
442  E_ITEM_HEAD = 397,
465  E_ITEM_LEAD = 420,
498 
499  // Keep these two as the last values of the consecutive list, without a number - they will get their correct number assigned automagically by C++
500  // IsValidItem() depends on this!
503 
517 
518  // Keep these two as the last values of the disc list, without a number - they will get their correct number assigned automagically by C++
519  // IsValidItem() depends on this!
522 
524 };
525 
526 
527 
528 
529 
531 {
532  // Please keep this list alpha-sorted by the blocktype part
533  // then number-sorted for the same block
534 
536  // Block metas:
537 
538  // E_BLOCK_ANVIL metas
544 
545  // E_BLOCK_BED metas:
552 
553  // E_BLOCK_BIG_FLOWER metas:
560  // 0x8 is supposedly a bit flag but all vanilla plants have this value
562 
563  // E_BLOCK_BREWING_STAND metas
567 
568  // E_BLOCK_BUTTON metas
576 
577  // E_BLOCK_CARPET metas:
594 
595  // E_BLOCK_CHEST metas:
600 
601  // E_BLOCK_CONCRETE metas:
618 
619  // E_BLOCK_CONCRETE_POWDER metas:
636 
637  // E_BLOCK_DIRT metas:
642 
643  // E_BLOCK_DISPENSER / E_BLOCK_DROPPER metas:
652 
653  // E_BLOCK_DOUBLE_STONE_SLAB metas:
665 
666  // E_BLOCK_END_PORTAL_FRAME metas:
667  E_META_END_PORTAL_FRAME_ZP = 0, // Faces towards centre of portal
671  E_META_END_PORTAL_FRAME_ZP_EYE = 4, // Frames with ender eye
675  E_META_END_PORTAL_FRAME_NO_EYE = 0, // Just the eye bitflag
677 
678  // E_BLOCK_FLOWER metas:
687 
688  // E_BLOCK_JUKEBOX metas:
691 
692  // E_BLOCK_HOPPER metas:
694  E_META_HOPPER_UNATTACHED = 1, // Hopper doesn't move items up, there's no YP
699 
700  // E_BLOCK_LEAVES metas:
713 
714  // E_BLOCK_LEAVES meta cont. (Block ID 161):
721 
722  // E_BLOCK_LOG metas:
727 
728  // E_BLOCK_NEW_LOG metas:
731 
732  // E_BLOCK_PISTON metas:
741 
742  // E_BLOCK_PLANKS metas:
749 
750  // E_BLOCK_(XXX_WEIGHTED)_PRESSURE_PLATE metas:
753 
754  // E_BLOCK_PRISMARINE_BLOCK metas:
758 
759  // E_BLOCK_QUARTZ_BLOCK metas:
763 
764  // E_BLOCK_RAIL metas
775 
776  // E_BLOCK_RED_SANDSTONE metas:
780 
781  // E_BLOCK_SAND metas:
784 
785  // E_BLOCK_SANDSTONE metas:
789 
790  // E_BLOCK_SAPLING metas (lowest 3 bits):
797 
798  // E_BLOCK_SILVERFISH_EGG metas:
802 
803  // E_BLOCK_SNOW metas:
812 
813  // E_BLOCK_SPONGE metas:
816 
817  // E_BLOCK_STAINED_CLAY metas:
834 
835  // E_BLOCK_STAINED_GLASS metas:
852 
853  // E_BLOCK_STAINED_GLASS_PANE metas:
870 
871  // E_BLOCK_STAIRS metas:
877 
878  // E_BLOCK_STONE metas:
886 
887  // E_BLOCK_STONE_SLAB metas:
896 
897  // E_BLOCK_STONE_BRICKS metas:
902 
903  // E_BLOCK_TALL_GRASS metas:
908 
909  // E_BLOCK_TORCH, E_BLOCK_REDSTONE_TORCH_OFF, E_BLOCK_REDSTONE_TORCH_ON metas:
910  E_META_TORCH_EAST = 1, // east face of the block, pointing east
915  E_META_TORCH_XM = 1, // Torch attached to the XM side of its block
916  E_META_TORCH_XP = 2, // Torch attached to the XP side of its block
917  E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block
918  E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block
919 
920  // E_META_LOG metas:
937 
938  // E_META_LOG metas cont. (Block ID 162):
947 
948  // E_BLOCK_WOODEN_DOUBLE_SLAB metas:
955 
956  // E_BLOCK_WOODEN_SLAB metas:
964 
965  // E_BLOCK_WOOL metas:
982 };
983 
984 
985 
986 
987 
988 enum ENUM_ITEM_META : short
989 {
990  // Please keep this list alpha-sorted by the itemtype part
991  // then number-sorted for the same item
992 
994  // Item metas:
995 
996  // E_ITEM_BANNER metas:
1013 
1014  // E_ITEM_COAL metas:
1017 
1018  // E_ITEM_DYE metas:
1035 
1036  // E_ITEM_GOLDEN_APPLE metas:
1039 
1040  // E_ITEM_HEAD metas:
1047 
1048  // E_ITEM_RAW_FISH metas:
1053 
1054  // E_ITEM_COOKED_FISH metas:
1057 
1058  // E_ITEM_MINECART_TRACKS metas:
1061 
1062  // E_ITEM_SPAWN_EGG metas:
1063  // See also cMonster::eType, since monster type and spawn egg meta are the same
1120 } ;
1121 
1122 
1123 
1124 
1125 
1128 {
1131  dimEnd = 1,
1132  dimNotSet = 255, // For things that need an "indeterminate" state, such as cProtocol's LastSentDimension
1133 } ;
1134 
1135 
1136 
1137 
1138 
1141 {
1142  // Canonical names for the types (as documented in the plugin wiki):
1143  dtAttack, // Being attacked by a mob
1144  dtRangedAttack, // Being attacked by a projectile, possibly from a mob
1145  dtLightning, // Hit by a lightning strike
1146  dtFalling, // Falling down; dealt when hitting the ground
1147  dtDrowning, // Drowning in water / lava
1148  dtSuffocating, // Suffocating inside a block
1149  dtStarving, // Hunger
1150  dtCactusContact, // Contact with a cactus block
1151  dtLavaContact, // Contact with a lava block
1152  dtPoisoning, // Having the poison effect
1153  dtWithering, // Having the wither effect
1154  dtOnFire, // Being on fire
1155  dtFireContact, // Standing inside a fire block
1156  dtInVoid, // Falling into the Void (Y < 0)
1158  dtEnderPearl, // Thrown an ender pearl, teleported by it
1159  dtAdmin, // Damage applied by an admin command
1160  dtExplosion, // Damage applied by an explosion
1161 
1162  // Some common synonyms:
1184 } ;
1185 
1186 
1187 
1188 
1189 
1203 {
1214 } ;
1215 
1216 
1217 
1218 
1219 
1221 {
1225 } ;
1226 
1227 
1228 
1229 
1230 
1232 {
1238 } ;
1239 
1240 // tolua_end
1241 
1242 
1243 
1244 
1245 // fwd:
1246 class cItem;
1247 class cIniFile;
1248 
1249 
1250 
1251 
1252 
1253 // tolua_begin
1254 
1256 extern int BlockStringToType(const AString & a_BlockTypeString);
1257 
1259 extern bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item);
1260 
1262 extern AString ItemToString(const cItem & a_Item);
1263 
1265 extern AString ItemTypeToString(short a_ItemType);
1266 
1268 extern AString ItemToFullString(const cItem & a_Item);
1269 
1271 extern eDimension StringToDimension(const AString & a_DimensionString);
1272 
1275 extern AString DimensionToString(eDimension a_Dimension);
1276 
1278 extern AString DamageTypeToString(eDamageType a_DamageType);
1279 
1281 extern eDamageType StringToDamageType(const AString & a_DamageString);
1282 
1284 extern cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default);
1285 
1286 // tolua_end
1287 
1288 
1289 
1290 
1291 
1293 template <class = void>
1294 bool IsOneOf(BLOCKTYPE a_BlockType)
1295 {
1296  return false;
1297 }
1298 
1299 
1312 template <BLOCKTYPE Head, BLOCKTYPE ... Tail>
1313 bool IsOneOf(BLOCKTYPE a_BlockType)
1314 {
1315  return ((a_BlockType == Head) || (IsOneOf<Tail...>(a_BlockType)));
1316 }
1317 
1318 
1319 
eShrapnelLevel
Definition: BlockID.h:1220
eDimension
Dimension of a world.
Definition: BlockID.h:1127
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
cItem GetIniItemSet(cIniFile &a_IniFile, const char *a_Section, const char *a_Key, const char *a_Default)
Returns a cItem representing the item described in an IniFile&#39;s value; if the value doesn&#39;t exist...
Definition: BlockID.cpp:476
Number of individual (different) consecutive itemtypes.
Definition: BlockID.h:501
eDimension StringToDimension(const AString &a_DimensionString)
Translates a dimension string to dimension enum.
Definition: BlockID.cpp:294
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
AString ItemToString(const cItem &a_Item)
Translates a full item into a string.
Definition: BlockID.cpp:257
AString DamageTypeToString(eDamageType a_DamageType)
Translates damage type constant to a string representation (built-in).
Definition: BlockID.cpp:368
ENUM_BLOCK_ID
Definition: BlockID.h:7
eDamageType
Damage type, used in the TakeDamageInfo structure and related functions.
Definition: BlockID.h:1140
AString DimensionToString(eDimension a_Dimension)
Translates a dimension enum to dimension string.
Definition: BlockID.cpp:336
Maximum disc itemtype number used.
Definition: BlockID.h:521
eDamageType StringToDamageType(const AString &a_DamageString)
Translates a damage type string to damage type.
Definition: BlockID.cpp:401
ENUM_BLOCK_META
Definition: BlockID.h:530
Useless, really, but needs to be present for the following value.
Definition: BlockID.h:520
eExplosionSource
The source of an explosion.
Definition: BlockID.h:1202
Maximum valid ItemType.
Definition: BlockID.h:523
std::string AString
Definition: StringUtils.h:13
Number of individual (different) blocktypes.
Definition: BlockID.h:276
ENUM_ITEM_ID
Definition: BlockID.h:293
Maximum BlockType number used.
Definition: BlockID.h:277
ENUM_ITEM_META
Definition: BlockID.h:988
Maximum consecutive ItemType number used.
Definition: BlockID.h:502
bool IsOneOf(BLOCKTYPE a_BlockType)
Base case for IsOneOf to handle empty template aguments.
Definition: BlockID.h:1294
int BlockStringToType(const AString &a_BlockTypeString)
Translates a blocktype string into blocktype.
Definition: BlockID.cpp:218
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
Definition: BlockID.cpp:270
AString ItemToFullString(const cItem &a_Item)
Translates a full item into a fully-specified string (including meta and count).
Definition: BlockID.cpp:283
eSpreadSource
Definition: BlockID.h:1231
Definition: Item.h:36
bool StringToItem(const AString &a_ItemTypeString, cItem &a_Item)
Translates an itemtype string into an item.
Definition: BlockID.cpp:238