Ensure health values do not exceed max health and reset health on death event
This commit is contained in:
@@ -34,6 +34,9 @@ public class PlayerEvents {
|
||||
);
|
||||
if (!event.getEntity().level().isClientSide) {
|
||||
StatEffects.applyAll(event.getEntity());
|
||||
if (event.isWasDeath()) {
|
||||
event.getEntity().setHealth(event.getEntity().getMaxHealth());
|
||||
}
|
||||
PlayerStatsProvider.sync(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ public final class StatEffects {
|
||||
if (IronsSpellbooksCompat.isLoaded()) {
|
||||
IronsSpellbooksCompat.applyAll(player);
|
||||
}
|
||||
if (player.getHealth() > player.getMaxHealth()) {
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user