1
0

Added missing item types, fixed placing stone walls.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1243 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-03-03 14:00:49 +00:00
parent 46e1228f73
commit 0e2340ee34
4 changed files with 58 additions and 19 deletions

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/01/13 16:38:13. ** Generated automatically by tolua++-1.0.92 on 03/03/13 14:57:13.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
@ -21597,6 +21597,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_BLOCK_POTATOES",E_BLOCK_POTATOES); tolua_constant(tolua_S,"E_BLOCK_POTATOES",E_BLOCK_POTATOES);
tolua_constant(tolua_S,"E_BLOCK_WOODEN_BUTTON",E_BLOCK_WOODEN_BUTTON); tolua_constant(tolua_S,"E_BLOCK_WOODEN_BUTTON",E_BLOCK_WOODEN_BUTTON);
tolua_constant(tolua_S,"E_BLOCK_HEAD",E_BLOCK_HEAD); tolua_constant(tolua_S,"E_BLOCK_HEAD",E_BLOCK_HEAD);
tolua_constant(tolua_S,"E_BLOCK_ANVIL",E_BLOCK_ANVIL);
tolua_constant(tolua_S,"E_BLOCK_TRAPPED_CHEST",E_BLOCK_TRAPPED_CHEST); tolua_constant(tolua_S,"E_BLOCK_TRAPPED_CHEST",E_BLOCK_TRAPPED_CHEST);
tolua_constant(tolua_S,"E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE",E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE); tolua_constant(tolua_S,"E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE",E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE);
tolua_constant(tolua_S,"E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE",E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE); tolua_constant(tolua_S,"E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE",E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE);
@ -21747,12 +21748,22 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK); tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK);
tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD); tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD);
tolua_constant(tolua_S,"E_ITEM_FLOWER_POT",E_ITEM_FLOWER_POT); tolua_constant(tolua_S,"E_ITEM_FLOWER_POT",E_ITEM_FLOWER_POT);
tolua_constant(tolua_S,"E_ITEM_CARROT",E_ITEM_CARROT);
tolua_constant(tolua_S,"E_ITEM_POTATO",E_ITEM_POTATO);
tolua_constant(tolua_S,"E_ITEM_BAKED_POTATO",E_ITEM_BAKED_POTATO);
tolua_constant(tolua_S,"E_ITEM_POISONOUS_POTATO",E_ITEM_POISONOUS_POTATO);
tolua_constant(tolua_S,"E_ITEM_GOLDEN_CARROT",E_ITEM_GOLDEN_CARROT);
tolua_constant(tolua_S,"E_ITEM_HEAD",E_ITEM_HEAD);
tolua_constant(tolua_S,"E_ITEM_CARROT_ON_STICK",E_ITEM_CARROT_ON_STICK);
tolua_constant(tolua_S,"E_ITEM_PUMPKIN_PIE",E_ITEM_PUMPKIN_PIE);
tolua_constant(tolua_S,"E_ITEM_FIREWORK_ROCKET",E_ITEM_FIREWORK_ROCKET); tolua_constant(tolua_S,"E_ITEM_FIREWORK_ROCKET",E_ITEM_FIREWORK_ROCKET);
tolua_constant(tolua_S,"E_ITEM_FIREWORK_STAR",E_ITEM_FIREWORK_STAR); tolua_constant(tolua_S,"E_ITEM_FIREWORK_STAR",E_ITEM_FIREWORK_STAR);
tolua_constant(tolua_S,"E_ITEM_ENCHANTED_BOOK",E_ITEM_ENCHANTED_BOOK); tolua_constant(tolua_S,"E_ITEM_ENCHANTED_BOOK",E_ITEM_ENCHANTED_BOOK);
tolua_constant(tolua_S,"E_ITEM_COMPARATOR",E_ITEM_COMPARATOR); tolua_constant(tolua_S,"E_ITEM_COMPARATOR",E_ITEM_COMPARATOR);
tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK",E_ITEM_NETHER_BRICK); tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK",E_ITEM_NETHER_BRICK);
tolua_constant(tolua_S,"E_ITEM_NETHER_QUARTZ",E_ITEM_NETHER_QUARTZ); tolua_constant(tolua_S,"E_ITEM_NETHER_QUARTZ",E_ITEM_NETHER_QUARTZ);
tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_TNT",E_ITEM_MINECART_WITH_TNT);
tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_HOPPER",E_ITEM_MINECART_WITH_HOPPER);
tolua_constant(tolua_S,"E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES",E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES); tolua_constant(tolua_S,"E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES",E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES);
tolua_constant(tolua_S,"E_ITEM_MAX_CONSECUTIVE_TYPE_ID",E_ITEM_MAX_CONSECUTIVE_TYPE_ID); tolua_constant(tolua_S,"E_ITEM_MAX_CONSECUTIVE_TYPE_ID",E_ITEM_MAX_CONSECUTIVE_TYPE_ID);
tolua_constant(tolua_S,"E_ITEM_FIRST_DISC",E_ITEM_FIRST_DISC); tolua_constant(tolua_S,"E_ITEM_FIRST_DISC",E_ITEM_FIRST_DISC);

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/01/13 16:38:13. ** Generated automatically by tolua++-1.0.92 on 03/03/13 14:57:13.
*/ */
/* Exported function */ /* Exported function */

View File

@ -309,7 +309,6 @@ enum ENUM_ITEM_ID
E_ITEM_CAULDRON = 380, E_ITEM_CAULDRON = 380,
E_ITEM_EYE_OF_ENDER = 381, E_ITEM_EYE_OF_ENDER = 381,
E_ITEM_GLISTERING_MELON = 382, E_ITEM_GLISTERING_MELON = 382,
E_ITEM_SPAWN_EGG = 383, E_ITEM_SPAWN_EGG = 383,
E_ITEM_BOTTLE_O_ENCHANTING = 384, E_ITEM_BOTTLE_O_ENCHANTING = 384,
E_ITEM_FIRE_CHARGE = 385, E_ITEM_FIRE_CHARGE = 385,
@ -317,12 +316,24 @@ enum ENUM_ITEM_ID
E_ITEM_WRITTEN_BOOK = 387, E_ITEM_WRITTEN_BOOK = 387,
E_ITEM_EMERALD = 388, E_ITEM_EMERALD = 388,
E_ITEM_FLOWER_POT = 390, E_ITEM_FLOWER_POT = 390,
E_ITEM_CARROT = 391,
E_ITEM_POTATO = 392,
E_ITEM_BAKED_POTATO = 393,
E_ITEM_POISONOUS_POTATO = 394,
// TODO: missing an item
E_ITEM_GOLDEN_CARROT = 396,
E_ITEM_HEAD = 397,
E_ITEM_CARROT_ON_STICK = 398,
// TODO: missing an item
E_ITEM_PUMPKIN_PIE = 400,
E_ITEM_FIREWORK_ROCKET = 401, E_ITEM_FIREWORK_ROCKET = 401,
E_ITEM_FIREWORK_STAR = 402, E_ITEM_FIREWORK_STAR = 402,
E_ITEM_ENCHANTED_BOOK = 403, E_ITEM_ENCHANTED_BOOK = 403,
E_ITEM_COMPARATOR = 404, E_ITEM_COMPARATOR = 404,
E_ITEM_NETHER_BRICK = 405, E_ITEM_NETHER_BRICK = 405,
E_ITEM_NETHER_QUARTZ = 406, E_ITEM_NETHER_QUARTZ = 406,
E_ITEM_MINECART_WITH_TNT = 407,
E_ITEM_MINECART_WITH_HOPPER = 408,
// Keep these two as the last values of the consecutive list, without a number - they will get their correct number assigned automagically by C++ // Keep these two as the last values of the consecutive list, without a number - they will get their correct number assigned automagically by C++
// IsValidItem() depends on this! // IsValidItem() depends on this!

View File

@ -344,6 +344,7 @@ char cItemHandler::GetMaxStackSize(void)
bool cItemHandler::IsTool() bool cItemHandler::IsTool()
{ {
// TODO: Rewrite this to list all tools specifically
return return
(m_ItemType >= 256 && m_ItemType <= 259) (m_ItemType >= 256 && m_ItemType <= 259)
|| (m_ItemType == 261) || (m_ItemType == 261)
@ -359,27 +360,46 @@ bool cItemHandler::IsTool()
bool cItemHandler::IsFood() bool cItemHandler::IsFood(void)
{ {
return switch (m_ItemType)
(m_ItemType == 260) {
|| (m_ItemType == 282) case E_ITEM_RED_APPLE:
|| (m_ItemType == 297) case E_ITEM_GOLDEN_APPLE:
|| (m_ItemType >= 319 && m_ItemType <= 320) case E_ITEM_MUSHROOM_SOUP:
|| (m_ItemType == 335) case E_ITEM_BREAD:
|| (m_ItemType >= 349 && m_ItemType <= 350) case E_ITEM_RAW_PORKCHOP:
|| (m_ItemType == 357) case E_ITEM_COOKED_PORKCHOP:
|| (m_ItemType == 360) case E_ITEM_MILK:
|| (m_ItemType >= 363 && m_ItemType <= 366); case E_ITEM_RAW_FISH:
case E_ITEM_COOKED_FISH:
case E_ITEM_COOKIE:
case E_ITEM_MELON_SLICE:
case E_ITEM_RAW_BEEF:
case E_ITEM_STEAK:
case E_ITEM_RAW_CHICKEN:
case E_ITEM_COOKED_CHICKEN:
case E_ITEM_ROTTEN_FLESH:
case E_ITEM_SPIDER_EYE:
case E_ITEM_CARROT:
case E_ITEM_POTATO:
case E_ITEM_BAKED_POTATO:
case E_ITEM_POISONOUS_POTATO:
{
return true;
}
} // switch (m_ItemType)
return false;
} }
bool cItemHandler::IsPlaceable() bool cItemHandler::IsPlaceable(void)
{ {
return m_ItemType >= 1 && m_ItemType <= 136; // We can place any block that has a corresponding E_BLOCK_TYPE:
return (m_ItemType >= 1) && (m_ItemType <= E_BLOCK_MAX_TYPE_ID);
} }
@ -417,9 +437,6 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
a_CursorX, a_CursorY, a_CursorZ, a_CursorX, a_CursorY, a_CursorZ,
a_BlockType, a_BlockMeta a_BlockType, a_BlockMeta
); );
a_BlockType = (BLOCKTYPE) m_ItemType;
a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x0f); // This keeps most textures. The few other items have to override this
return true;
} }