From 487f9a2aa9b5497495cef1ac3b9c7a603e69f862 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 21 Apr 2020 22:19:22 +0200 Subject: Vector3 in Handlers (#4680) Refactored all cBlockHandler and cItemHandler descendants to use Vector3. --- src/Items/ItemPotion.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/Items/ItemPotion.h') diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index 49fbfa0dd..875fbec02 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -17,6 +17,9 @@ public: } + + + // cItemHandler overrides: virtual bool IsDrinkable(short a_ItemDamage) override { @@ -26,12 +29,19 @@ public: } + + + 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 { - short PotionDamage = a_Item.m_ItemDamage; + short PotionDamage = a_HeldItem.m_ItemDamage; // Do not throw non-splash potions: if (cEntityEffect::IsPotionDrinkable(PotionDamage)) @@ -59,6 +69,9 @@ public: } + + + virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override { short PotionDamage = a_Item->m_ItemDamage; -- cgit v1.2.3