summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.cpp
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-07-30 19:53:21 +0200
committerworktycho <work.tycho@gmail.com>2017-07-30 19:53:21 +0200
commit10d42a2452e19ca98506df4d85c0e8f37b3e8981 (patch)
tree84ab60be36919dac3b24e7384bfd533349a9d177 /src/Items/ItemHandler.cpp
parentcParsedNBT: Improved error reporting (#3876) (diff)
downloadcuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.gz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.bz2
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.lz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.xz
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.tar.zst
cuberite-10d42a2452e19ca98506df4d85c0e8f37b3e8981.zip
Diffstat (limited to 'src/Items/ItemHandler.cpp')
-rw-r--r--src/Items/ItemHandler.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index b430e83ef..c34b8b444 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -826,41 +826,17 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
-bool cItemHandler::GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance)
-{
- return false;
-}
-
-
-
-
-
bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
{
- UNUSED(a_Item);
if (!a_Player->IsGameModeCreative())
{
a_Player->GetInventory().RemoveOneEquippedItem();
}
- FoodInfo Info = GetFoodInfo();
+ FoodInfo Info = GetFoodInfo(a_Item);
if ((Info.FoodLevel > 0) || (Info.Saturation > 0.f))
{
- bool Success = a_Player->Feed(Info.FoodLevel, Info.Saturation);
-
- // Give effects
- cEntityEffect::eType EffectType;
- int EffectDurationTicks;
- short EffectIntensity;
- float Chance;
- if (Success && GetEatEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance))
- {
- if (GetRandomProvider().RandBool(Chance))
- {
- a_Player->AddEntityEffect(EffectType, EffectDurationTicks, EffectIntensity, Chance);
- }
- }
- return Success;
+ return a_Player->Feed(Info.FoodLevel, Info.Saturation);
}
return false;
}
@@ -869,8 +845,9 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item)
-cItemHandler::FoodInfo cItemHandler::GetFoodInfo()
+cItemHandler::FoodInfo cItemHandler::GetFoodInfo(const cItem * a_Item)
{
+ UNUSED(a_Item);
return FoodInfo(0, 0);
}