Max hp before text is now a config option

This commit is contained in:
Thomas Guimbretiere committed 2014-02-20 00:24:22 +01:00
1 parent 78039db017
commit 7eb35b7544
3 files changed
+6 -3

No files matched your search

+2 -1
View File
@@ -148,7 +148,8 @@ public class ConfigHandler implements IWailaConfigHandler {
OverlayConfig.fontcolor = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FONTCOLOR, 0xA0A0A0).getInt();
OverlayConfig.scale = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SCALE, 100).getInt() / 100.0f;
HUDHandlerEntities.nhearts = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NHEARTS, 20).getInt();
HUDHandlerEntities.nhearts = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NHEARTS, 20).getInt();
HUDHandlerEntities.maxhpfortext = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MAXHP, 40).getInt();
config.getCategory(Constants.CATEGORY_MODULES).setComment("Those are the config keys defined in modules.\nServer side, it is used to enforce keys client side using the next section.");
config.getCategory(Constants.CATEGORY_SERVER).setComment("Any key set to true here will ensure that the client is using the configuration set in the 'module' section above.\nThis is useful for enforcing false to 'cheating' keys like silverfish.");
@@ -19,6 +19,7 @@ import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDHandlerEntities implements IWailaEntityProvider {
public static int nhearts = 20;
public static float maxhpfortext = 40.0f;
@Override
public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) {
@@ -45,7 +46,7 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
float health = ((EntityLivingBase)entity).getHealth() / 2.0f;
float maxhp = ((EntityLivingBase)entity).getMaxHealth() / 2.0f;
if (maxhp > 20.0f)
if (((EntityLivingBase)entity).getHealth() > maxhpfortext)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", ((EntityLivingBase)entity).getHealth(), ((EntityLivingBase)entity).getMaxHealth()));
else{
+2 -1
View File
@@ -25,7 +25,8 @@ public final class Constants {
public static String CFG_WAILA_SCALE = "waila.cfg.scale";
public static String CFG_WAILA_SHIFTBLOCK = "waila.cfg.shiftblock";
public static String CFG_WAILA_SHIFTENTS = "waila.cfg.shiftents";
public static String CFG_WAILA_NHEARTS = "waila.cfg.nhearts";
public static String CFG_WAILA_NHEARTS = "waila.cfg.heartsperline";
public static String CFG_WAILA_MAXHP = "waila.cfg.maxhpbeforetext";
public static String CFG_WAILA_ALPHA = "waila.cfg.alpha";
public static String CFG_WAILA_BGCOLOR = "waila.cfg.bgcolor";