summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemArmor.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-21 22:19:22 +0200
committerGitHub <noreply@github.com>2020-04-21 22:19:22 +0200
commit487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch)
tree054a846942f414060e29c72f4a717c8a89e70893 /src/Items/ItemArmor.h
parentDelet SpawnObject params (diff)
downloadcuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.gz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.bz2
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.lz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.xz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.zst
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.zip
Diffstat (limited to 'src/Items/ItemArmor.h')
-rw-r--r--src/Items/ItemArmor.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/Items/ItemArmor.h b/src/Items/ItemArmor.h
index d218c22b3..d91888d5b 100644
--- a/src/Items/ItemArmor.h
+++ b/src/Items/ItemArmor.h
@@ -8,43 +8,52 @@
-class cItemArmorHandler :
+class cItemArmorHandler:
public cItemHandler
{
+ using Super = cItemHandler;
+
public:
- cItemArmorHandler(int a_ItemType) :
- cItemHandler(a_ItemType)
+
+ cItemArmorHandler(int a_ItemType):
+ Super(a_ItemType)
{
}
+
+
/** Move the armor to the armor slot of the player's inventory */
virtual bool OnItemUse(
- cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
- int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
+ cWorld * a_World,
+ cPlayer * a_Player,
+ cBlockPluginInterface & a_PluginInterface,
+ const cItem & a_HeldItem,
+ const Vector3i a_ClickedBlockPos,
+ eBlockFace a_ClickedBlockFace
) override
{
int SlotNum;
- if (ItemCategory::IsHelmet(a_Item.m_ItemType))
+ if (ItemCategory::IsHelmet(a_HeldItem.m_ItemType))
{
SlotNum = 0;
}
- else if (ItemCategory::IsChestPlate(a_Item.m_ItemType))
+ else if (ItemCategory::IsChestPlate(a_HeldItem.m_ItemType))
{
SlotNum = 1;
}
- else if (ItemCategory::IsLeggings(a_Item.m_ItemType))
+ else if (ItemCategory::IsLeggings(a_HeldItem.m_ItemType))
{
SlotNum = 2;
}
- else if (ItemCategory::IsBoots(a_Item.m_ItemType))
+ else if (ItemCategory::IsBoots(a_HeldItem.m_ItemType))
{
SlotNum = 3;
}
else
{
- LOGWARNING("Used unknown armor: %i", a_Item.m_ItemType);
+ LOGWARNING("Used unknown armor: %i", a_HeldItem.m_ItemType);
return false;
}
@@ -53,9 +62,9 @@ public:
return false;
}
- a_Player->GetInventory().SetArmorSlot(SlotNum, a_Item.CopyOne());
+ a_Player->GetInventory().SetArmorSlot(SlotNum, a_HeldItem.CopyOne());
- cItem Item(a_Item);
+ cItem Item(a_HeldItem);
Item.m_ItemCount--;
if (Item.m_ItemCount <= 0)
{
@@ -67,6 +76,8 @@ public:
+
+
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
{
switch (m_ItemType)