Skip to content

Commit

Permalink
Merge pull request #347 from MrJeremyFisher/pot-glitch-fix
Browse files Browse the repository at this point in the history
Don't heal dead entities with health potions
  • Loading branch information
RedDevel2 committed May 1, 2024
2 parents fbc5552 + a6db779 commit c172178
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ public void healthPotSplash(PotionSplashEvent e) {

modifiedHealth += intensity * multiplier * (healingEffect.getAmplifier() + 1)
* healthPerPotionLevel;
entity.setHealth(Math.min(maxHealth, modifiedHealth));
if (!entity.isDead()) entity.setHealth(Math.min(maxHealth, modifiedHealth));
}
}

@EventHandler
public void itemConsume(PlayerItemConsumeEvent e) {
PotionModification potMod = getModification(e.getItem());
if (potMod == null) {
if (potMod == null || e.getPlayer().isDead()) {
return;
}
PotionMeta potMeta = (PotionMeta) e.getItem().getItemMeta();
Expand Down Expand Up @@ -141,7 +141,7 @@ public void potionSplash(PotionSplashEvent e) {
ent.addPotionEffect(potEffect, false);
};
for (LivingEntity ent : e.getAffectedEntities()) {
impact.accept(ent);
if (!ent.isDead()) impact.accept(ent);
}
});
}
Expand Down

0 comments on commit c172178

Please sign in to comment.