Skip to content

Commit

Permalink
Fix numerical display halving health values (TehNut-Mods/HWYLA#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadows-of-Fire authored and deirn committed Feb 4, 2021
1 parent b4c6459 commit 5d92745
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public void appendHead(List<Text> tooltip, IEntityAccessor accessor, IPluginConf
public void appendBody(List<Text> tooltip, IEntityAccessor accessor, IPluginConfig config) {
if (config.get(PluginCore.CONFIG_SHOW_ENTITY_HEALTH) && accessor.getEntity() instanceof LivingEntity) {
LivingEntity living = (LivingEntity) accessor.getEntity();
float health = living.getHealth() / 2.0F;
float maxHealth = living.getMaxHealth() / 2.0F;
float health = living.getHealth();
float maxHealth = living.getMaxHealth();

if (living.getMaxHealth() > Waila.CONFIG.get().getGeneral().getMaxHealthForRender())
tooltip.add(new TranslatableText("tooltip.waila.health", String.format("%.2f", health), String.format("%.2f", maxHealth)));
else {
CompoundTag healthData = new CompoundTag();
healthData.putFloat("health", health);
healthData.putFloat("max", maxHealth);
healthData.putFloat("health", health / 2.0F);
healthData.putFloat("max", maxHealth / 2.0F);
tooltip.add(new RenderableTextComponent(PluginCore.RENDER_ENTITY_HEALTH, healthData));
}
}
Expand Down

0 comments on commit 5d92745

Please sign in to comment.