From 2529a898351c4b7c6372570ba53a7e25678980a9 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 6 Jan 2018 00:39:23 +0000 Subject: 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 --- src/Items/ItemGoldenApple.h | 18 ++++++++---------- src/Items/ItemHandler.cpp | 13 ++----------- 2 files changed, 10 insertions(+), 21 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h index 00f5ac1c0..2303e0e7a 100644 --- a/src/Items/ItemGoldenApple.h +++ b/src/Items/ItemGoldenApple.h @@ -21,23 +21,21 @@ public: virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override { - if (!super::EatItem(a_Player, a_Item)) - { - return false; - } - - // Add the effects: - a_Player->AddEntityEffect(cEntityEffect::effAbsorption, 2400, 0); - a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 100, 1); + super::EatItem(a_Player, a_Item); - // When the apple is a 'notch apple', give extra effects: + // Enchanted golden apples have stronger effects: if (a_Item->m_ItemDamage >= E_META_GOLDEN_APPLE_ENCHANTED) { - a_Player->AddEntityEffect(cEntityEffect::effRegeneration, 600, 4); + 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; } diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 976ab959d..14b25d2b7 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -822,17 +822,8 @@ bool cItemHandler::GetPlacementBlockTypeMeta( bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item) { - if (!a_Player->IsGameModeCreative()) - { - a_Player->GetInventory().RemoveOneEquippedItem(); - } - - FoodInfo Info = GetFoodInfo(a_Item); - if ((Info.FoodLevel > 0) || (Info.Saturation > 0.f)) - { - return a_Player->Feed(Info.FoodLevel, Info.Saturation); - } - return false; + auto FoodInfo = GetFoodInfo(a_Item); + return a_Player->Feed(FoodInfo.FoodLevel, FoodInfo.Saturation); } -- cgit v1.2.3