From 883f622415b258779ae59a22abdb38cca70a5128 Mon Sep 17 00:00:00 2001 From: arsenicviscera Date: Wed, 11 Mar 2026 20:36:54 -0700 Subject: [PATCH 1/3] Added Quick Regen --- Minecraft.World/Player.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 00c7148e4..0750d1110 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -1001,9 +1001,23 @@ void Player::aiStep() { if (jumpTriggerTime > 0) jumpTriggerTime--; - if (level->difficulty == Difficulty::PEACEFUL && getHealth() < getMaxHealth() && level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION)) - { - if (tickCount % 20 * 12 == 0) heal(1); + if (level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION)) { + bool health_OK = getHealth() < getMaxHealth(); + if ((tickCount % 12 == 0) && health_OK) { + + + + FoodData* fd = getFoodData(); + if ((level->difficulty == Difficulty::PEACEFUL)) { + heal(1); + } + //Quick-Regen from saturation (must have 8 1/2 hunger and have at least 3 saturation) + else if (fd->getSaturationLevel() > 3 && fd->getFoodLevel() >= 17) { + heal(1); + fd->setSaturation(fd->getSaturationLevel() - 3); + } + + }; } inventory->tick(); oBob = bob; From 5b16ced3066f7f9d9f891c2534dbb8f90589f80c Mon Sep 17 00:00:00 2001 From: arsenicviscera Date: Wed, 11 Mar 2026 20:55:42 -0700 Subject: [PATCH 2/3] Changed criteria Just realized you need full hunger for quick regen (oops) --- Minecraft.World/Player.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 0750d1110..23f357968 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -1004,15 +1004,12 @@ void Player::aiStep() if (level->getGameRules()->getBoolean(GameRules::RULE_NATURAL_REGENERATION)) { bool health_OK = getHealth() < getMaxHealth(); if ((tickCount % 12 == 0) && health_OK) { - - - FoodData* fd = getFoodData(); if ((level->difficulty == Difficulty::PEACEFUL)) { heal(1); } - //Quick-Regen from saturation (must have 8 1/2 hunger and have at least 3 saturation) - else if (fd->getSaturationLevel() > 3 && fd->getFoodLevel() >= 17) { + //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); } From 15f555025a02a53e4207eefb1d0aa197fc22921b Mon Sep 17 00:00:00 2001 From: arsenicviscera Date: Wed, 11 Mar 2026 22:35:08 -0700 Subject: [PATCH 3/3] Re-located Code co-author helped me match the code to the Java decomp. Works perfectly in parity with Java. Co-Authored-By: Alexandra-Myers <78748498+alexandra-myers@users.noreply.github.com> --- Minecraft.World/FoodConstants.cpp | 1 + Minecraft.World/FoodConstants.h | 2 +- Minecraft.World/FoodData.cpp | 24 ++++++++++++++++++------ Minecraft.World/Player.cpp | 5 ----- 4 files changed, 20 insertions(+), 12 deletions(-) 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 @@ class FoodConstants // 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); - } }; }