summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemHandler.cpp')
-rw-r--r--src/Items/ItemHandler.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 454fabdd7..d97f986ba 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -8,6 +8,7 @@
#include "../BlockInServerPluginInterface.h"
// Handlers:
+#include "ItemArmor.h"
#include "ItemBed.h"
#include "ItemBoat.h"
#include "ItemBow.h"
@@ -27,6 +28,7 @@
#include "ItemHoe.h"
#include "ItemLeaves.h"
#include "ItemLighter.h"
+#include "ItemLilypad.h"
#include "ItemMap.h"
#include "ItemMinecart.h"
#include "ItemNetherWart.h"
@@ -115,6 +117,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_FISHING_ROD: return new cItemFishingRodHandler(a_ItemType);
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);
case E_ITEM_FLOWER_POT: return new cItemFlowerPotHandler(a_ItemType);
+ case E_BLOCK_LILY_PAD: return new cItemLilypadHandler(a_ItemType);
case E_ITEM_MAP: return new cItemMapHandler();
case E_ITEM_ITEM_FRAME: return new cItemItemFrameHandler(a_ItemType);
case E_ITEM_NETHER_WART: return new cItemNetherWartHandler(a_ItemType);
@@ -220,6 +223,31 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemFoodHandler(a_ItemType);
}
+
+ // Armor:
+ case E_ITEM_LEATHER_CAP:
+ case E_ITEM_GOLD_HELMET:
+ case E_ITEM_CHAIN_HELMET:
+ case E_ITEM_IRON_HELMET:
+ case E_ITEM_DIAMOND_HELMET:
+ case E_ITEM_LEATHER_TUNIC:
+ case E_ITEM_GOLD_CHESTPLATE:
+ case E_ITEM_CHAIN_CHESTPLATE:
+ case E_ITEM_IRON_CHESTPLATE:
+ case E_ITEM_DIAMOND_CHESTPLATE:
+ case E_ITEM_LEATHER_PANTS:
+ case E_ITEM_GOLD_LEGGINGS:
+ case E_ITEM_CHAIN_LEGGINGS:
+ case E_ITEM_IRON_LEGGINGS:
+ case E_ITEM_DIAMOND_LEGGINGS:
+ case E_ITEM_LEATHER_BOOTS:
+ case E_ITEM_GOLD_BOOTS:
+ case E_ITEM_CHAIN_BOOTS:
+ case E_ITEM_IRON_BOOTS:
+ case E_ITEM_DIAMOND_BOOTS:
+ {
+ return new cItemArmorHandler(a_ItemType);
+ }
}
}
@@ -429,7 +457,6 @@ bool cItemHandler::IsTool()
|| (m_ItemType >= 267 && m_ItemType <= 279)
|| (m_ItemType >= 283 && m_ItemType <= 286)
|| (m_ItemType >= 290 && m_ItemType <= 294)
- || (m_ItemType >= 256 && m_ItemType <= 259)
|| (m_ItemType == 325)
|| (m_ItemType == 346);
}
@@ -484,6 +511,16 @@ bool cItemHandler::IsPlaceable(void)
+
+bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
+{
+ return false;
+}
+
+
+
+
+
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
{
UNUSED(a_BlockType);
@@ -504,13 +541,13 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
{
ASSERT(m_ItemType < 256); // Items with IDs above 255 should all be handled by specific handlers
- if (m_ItemType > 256)
+ if (m_ItemType >= 256)
{
- LOGERROR("%s: Item %d has no valid block!", __FUNCTION__, m_ItemType);
+ LOGERROR("%s: Item %d is not eligible for direct block placement!", __FUNCTION__, m_ItemType);
return false;
}
- cBlockHandler * BlockH = BlockHandler(m_ItemType);
+ cBlockHandler * BlockH = BlockHandler((BLOCKTYPE)m_ItemType);
cChunkInterface ChunkInterface(a_World->GetChunkMap());
return BlockH->GetPlacementBlockTypeMeta(
ChunkInterface, a_Player,