diff --git a/Minecraft.World/FoodConstants.cpp b/Minecraft.World/FoodConstants.cpp index a8e024a2b..e4a5e2725 100644 --- a/Minecraft.World/FoodConstants.cpp +++ b/Minecraft.World/FoodConstants.cpp @@ -12,6 +12,7 @@ const float FoodConstants::EXHAUSTION_DROP = 4.0f; // number of game ticks to change health because of food const int FoodConstants::HEALTH_TICK_COUNT = 80; +const int FoodConstants::QUICK_HEALTH_TICK_COUNT = 10; const int FoodConstants::HEAL_LEVEL = 18; const int FoodConstants::STARVE_LEVEL = 0; diff --git a/Minecraft.World/FoodConstants.h b/Minecraft.World/FoodConstants.h index cc4620cb9..84728e717 100644 --- a/Minecraft.World/FoodConstants.h +++ b/Minecraft.World/FoodConstants.h @@ -13,7 +13,7 @@ public: // number of game ticks to change health because of food static const int HEALTH_TICK_COUNT; - + static const int QUICK_HEALTH_TICK_COUNT; static const int HEAL_LEVEL; static const int STARVE_LEVEL; diff --git a/Minecraft.World/FoodData.cpp b/Minecraft.World/FoodData.cpp index ab0ced84b..e2452739f 100644 --- a/Minecraft.World/FoodData.cpp +++ b/Minecraft.World/FoodData.cpp @@ -65,16 +65,28 @@ void FoodData::tick(shared_ptr player) } } } - else if (player->level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION) && foodLevel >= FoodConstants::HEAL_LEVEL && player->isHurt()) + else if (player->level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION) && foodLevel >= FoodConstants::MAX_FOOD && player->isHurt()) { tickTimer++; - if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) - { - player->heal(1); - addExhaustion(FoodConstants::EXHAUSTION_HEAL); - tickTimer = 0; + + if (tickTimer >= FoodConstants::QUICK_HEALTH_TICK_COUNT) { + float spent = min(getSaturationLevel(), 6.0f); + player->heal(spent / 6.0f); + addExhaustion(spent); + tickTimer = 0; } + + } + else if (player->level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION) && foodLevel >= FoodConstants::HEAL_LEVEL && player->isHurt()) { + if (tickTimer >= FoodConstants::HEALTH_TICK_COUNT) + { + player->heal(1); + addExhaustion(FoodConstants::EXHAUSTION_HEAL); + tickTimer = 0; + } + } + else if (foodLevel <= FoodConstants::STARVE_LEVEL) { tickTimer++; diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 23f357968..8f7e7b982 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -1008,11 +1008,6 @@ void Player::aiStep() if ((level->difficulty == Difficulty::PEACEFUL)) { heal(1); } - //Quick-Regen from saturation (must have full hunger and have at least 3 saturation) - else if (fd->getSaturationLevel() > 3 && fd->getFoodLevel() == 20) { - heal(1); - fd->setSaturation(fd->getSaturationLevel() - 3); - } }; }