summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2018-01-06 01:39:23 +0100
committerpeterbell10 <peterbell10@live.co.uk>2018-01-06 01:39:23 +0100
commit2529a898351c4b7c6372570ba53a7e25678980a9 (patch)
treef87099d4a2374bb67fad1aa35ed472eb0af05ddf
parentImproved fishing rewards (#4120) (diff)
downloadcuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar.gz
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar.bz2
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar.lz
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar.xz
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.tar.zst
cuberite-2529a898351c4b7c6372570ba53a7e25678980a9.zip
Diffstat (limited to '')
-rw-r--r--Server/crafting.txt5
-rw-r--r--src/Entities/Player.cpp4
-rw-r--r--src/Items/ItemGoldenApple.h18
-rw-r--r--src/Items/ItemHandler.cpp13
4 files changed, 16 insertions, 24 deletions
diff --git a/Server/crafting.txt b/Server/crafting.txt
index caac966ae..c85943996 100644
--- a/Server/crafting.txt
+++ b/Server/crafting.txt
@@ -50,7 +50,7 @@ DarkOakPlanks, 4 = DarkOakLog, *
EnderChest = EyeOfEnder, 2:2 | Obsidian, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
Furnace = Cobblestone, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
JunglePlanks, 4 = JungleLog, *
-OakPlanks, 4 = OakLog, *
+OakPlanks, 4 = OakLog, *
SprucePlanks, 4 = SpruceLog, *
Stick, 4 = Planks^-1, 2:2, 2:3
Torch, 4 = Stick, 1:2 | Coal^-1, 1:1
@@ -345,7 +345,6 @@ Bowl, 4 = Planks^-1, 1:1, 2:2, 3:1
Bread = Wheat, 1:1, 2:1, 3:1
Cake = MilkBucket, 1:1, 2:1, 3:1 | Sugar, 1:2, 3:2 | Egg, 2:2 | Wheat, 1:3, 2:3, 3:3
Cookie, 8 = Wheat, *, * | CocoaBeans, *
-EnchantedGoldenApple = RedApple, 2:2 | GoldBlock, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
GoldenApple = RedApple, 2:2 | GoldIngot, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
MelonBlock = MelonSlice, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
MelonSeeds = MelonSlice, *
@@ -858,7 +857,7 @@ GoldNugget, 9 = GoldIngot, *
MagmaCream = SlimeBall, * | BlazePowder, *
#******************************************************#
-# Dyed Armor
+# Dyed Armor
# Do not modify
LeatherHelmet = LeatherHelmet^-1, * | Dye^-1, *
LeatherHelmet = LeatherHelmet^-1, * | Dye^-1, * | Dye^-1, *
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 71f7b582f..073d00909 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -678,6 +678,10 @@ void cPlayer::FinishEating(void)
{
return;
}
+ if (!IsGameModeCreative())
+ {
+ GetInventory().RemoveOneEquippedItem();
+ }
ItemHandler->OnFoodEaten(m_World, this, &Item);
}
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);
}