summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemGoldenApple.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemGoldenApple.h')
-rw-r--r--src/Items/ItemGoldenApple.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h
index 2303e0e7a..cece9a54a 100644
--- a/src/Items/ItemGoldenApple.h
+++ b/src/Items/ItemGoldenApple.h
@@ -14,14 +14,18 @@ class cItemGoldenAppleHandler :
public:
cItemGoldenAppleHandler()
- : super(E_ITEM_GOLDEN_APPLE)
+ : super(E_ITEM_GOLDEN_APPLE, FoodInfo(4, 9.6))
{
}
-
virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
{
- super::EatItem(a_Player, a_Item);
+ cItemHandler::EatItem(a_Player, a_Item);
+
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
// Enchanted golden apples have stronger effects:
if (a_Item->m_ItemDamage >= E_META_GOLDEN_APPLE_ENCHANTED)
@@ -39,11 +43,4 @@ public:
return true;
}
-
- virtual FoodInfo GetFoodInfo(const cItem * a_Item) override
- {
- UNUSED(a_Item);
- return FoodInfo(4, 9.6);
- }
-
};