From e1383cc6a3f8aeca6aa69aa6815e5bf00ae7b802 Mon Sep 17 00:00:00 2001 From: Lord_Cambion Date: Mon, 25 May 2026 02:16:33 +0200 Subject: [PATCH] fix: poison kill player i fixed before this behaviour but somehow it is broken. now i am clamping if 1 or 2 hp player is left with 1 hp. --- Minecraft.World/MobEffect.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index 71620b0c..6ca532a7 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -137,9 +137,13 @@ void MobEffect::applyEffectTick(shared_ptr mob, int amplification) } else if (id == poison->id) { - if (mob->getHealth() > 1.0f) + // poison must never reduce health below 1 hp + // if the current health is between 1 and 2 hp the player is left at exactly 1 HP rather than dying. + float currentHealth = mob->getHealth(); + if (currentHealth > 1.0f) { - mob->hurt(DamageSource::magic, 1.0f); + float poisonDmg = min(1.0f, currentHealth - 1.0f); + mob->hurt(DamageSource::magic, poisonDmg); } } else if (id == wither->id)