1
0
cuberite-2a/src/Items/ItemGoldenApple.h
Alexander Harkness 2529a89835 Golden Apple Fixes (#4130)
* Do not remove food item until player has been fed
* Golden apples now ignore hunger when eating
* Removed EnchantedGoldenApple recipe, as it was removed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
* Adjust golden apple effects, as they were changed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
2018-01-06 00:39:23 +00:00

50 lines
1009 B
C++

#pragma once
#include "ItemFood.h"
class cItemGoldenAppleHandler :
public cItemFoodHandler
{
typedef cItemFoodHandler super;
public:
cItemGoldenAppleHandler()
: super(E_ITEM_GOLDEN_APPLE)
{
}
virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override
{
super::EatItem(a_Player, a_Item);
// Enchanted golden apples have stronger effects:
if (a_Item->m_ItemDamage >= E_META_GOLDEN_APPLE_ENCHANTED)
{
a_Player->AddEntityEffect(cEntityEffect::effAbsorption, 2400, 3);
a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 400, 1);
a_Player->AddEntityEffect(cEntityEffect::effResistance, 6000, 0);
a_Player->AddEntityEffect(cEntityEffect::effFireResistance, 6000, 0);
return true;
}
a_Player->AddEntityEffect(cEntityEffect::effAbsorption, 2400, 0);
a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1);
return true;
}
virtual FoodInfo GetFoodInfo(const cItem * a_Item) override
{
UNUSED(a_Item);
return FoodInfo(4, 9.6);
}
};