Skip to content

Commit

Permalink
fix: max health method
Browse files Browse the repository at this point in the history
  • Loading branch information
alvindimas05 committed Jan 17, 2025
1 parent dab3e7b commit 10b722e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,12 @@ public static double getMaxHealth(LivingEntity ent) {
return ent.getMaxHealth();
} else {
try {
return ent.getAttribute((Attribute) Objects.requireNonNull(Reflection.getMethod(Reflection.Classes.Attribute.getType(),
"getAttribute", String.class)).invoke("max_health")).getBaseValue();
return Objects.requireNonNull(
ent.getAttribute((Attribute) Objects.requireNonNull(
Reflection.getMethod(Reflection.Classes.Attribute.getType(),
"getAttribute", String.class))
.invoke(Reflection.Classes.Attribute, "max_health")))
.getBaseValue();
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 10b722e

Please sign in to comment.