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) {
|
if (!event.getEntity().level().isClientSide) {
|
||||||
StatEffects.applyAll(event.getEntity());
|
StatEffects.applyAll(event.getEntity());
|
||||||
|
if (event.isWasDeath()) {
|
||||||
|
event.getEntity().setHealth(event.getEntity().getMaxHealth());
|
||||||
|
}
|
||||||
PlayerStatsProvider.sync(event.getEntity());
|
PlayerStatsProvider.sync(event.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,4 +48,4 @@ public class PlayerEvents {
|
|||||||
StatEffects.applyAll(event.getEntity());
|
StatEffects.applyAll(event.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ public final class StatEffects {
|
|||||||
if (IronsSpellbooksCompat.isLoaded()) {
|
if (IronsSpellbooksCompat.isLoaded()) {
|
||||||
IronsSpellbooksCompat.applyAll(player);
|
IronsSpellbooksCompat.applyAll(player);
|
||||||
}
|
}
|
||||||
|
if (player.getHealth() > player.getMaxHealth()) {
|
||||||
|
player.setHealth(player.getMaxHealth());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user