Skip to content

Commit

Permalink
Fix negative mob health being displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Apr 29, 2024
1 parent 19a4d24 commit a7e1012
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/dev/aurelium/auramobs/listeners/MobDamage.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public void onMobDamage(EntityDamageEvent e) {
return;
}

int level = entity.getPersistentDataContainer().getOrDefault(plugin.getMobKey(), PersistentDataType.INTEGER, 0);
double resHealth = entity.getHealth() - e.getDamage();
int level = entity.getPersistentDataContainer().getOrDefault(plugin.getMobKey(), PersistentDataType.INTEGER, 1);
double resHealth = entity.getHealth() - e.getFinalDamage();
resHealth = Math.max(resHealth, 0.0);
String formattedHealth = plugin.getFormatter().format(resHealth);
try {
entity.setCustomName(ColorUtils.colorMessage(plugin.optionString("custom_name.format")
Expand Down

0 comments on commit a7e1012

Please sign in to comment.