diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-07-31 23:04:00 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-07-31 23:04:00 +0200 |
commit | 84462ba8b20c28136c6a7923323f7cde28a86d70 (patch) | |
tree | a568e3ef01c16deff469dd3612023263603cc2f9 /src/Items/ItemGoldenApple.h | |
parent | Merge pull request #1267 from mc-server/RoofedForest (diff) | |
download | cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar.gz cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar.bz2 cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar.lz cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar.xz cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.tar.zst cuberite-84462ba8b20c28136c6a7923323f7cde28a86d70.zip |
Diffstat (limited to 'src/Items/ItemGoldenApple.h')
-rw-r--r-- | src/Items/ItemGoldenApple.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h new file mode 100644 index 000000000..4e1096e65 --- /dev/null +++ b/src/Items/ItemGoldenApple.h @@ -0,0 +1,58 @@ +#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 + { + // Feed the player: + FoodInfo Info = GetFoodInfo(); + a_Player->Feed(Info.FoodLevel, Info.Saturation); + + // Add the effects: + a_Player->AddEntityEffect(cEntityEffect::effAbsorption, 2400, 0); + a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1); + + // When the apple is a 'notch apple', give extra effects: + if (a_Item->m_ItemDamage > 0) + { + a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 600, 4); + a_Player->AddEntityEffect(cEntityEffect::effResistance, 6000, 0); + a_Player->AddEntityEffect(cEntityEffect::effFireResistance, 6000, 0); + } + + return true; + } + + + virtual FoodInfo GetFoodInfo(void) override + { + return FoodInfo(4, 9.6); + } + + + virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override + { + return false; + } + +}; + + + + |