Add config to show icon on HUD or not (#35)

This commit is contained in:
Alexdoru authored and GitHub committed 2025-06-13 12:06:54 +02:00
1 parent 490a176446
commit d30d8ba100
6 files changed
+20 -1

No files matched your search

@@ -134,6 +134,10 @@ public class ConfigHandler implements IWailaConfigHandler {
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
}
public boolean showIcon() {
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
}
/* Default config loading */
public void loadDefaultConfig(FMLPreInitializationEvent event) {
@@ -145,6 +149,7 @@ public class ConfigHandler implements IWailaConfigHandler {
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
OverlayConfig.posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
OverlayConfig.posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
@@ -84,6 +84,16 @@ public class ScreenWailaConfig extends ScreenBase {
"screen.button.no",
"screen.button.yes"),
"choice.shifttoggledents");
buttonContainer.addButton(
new ButtonBooleanConfig(
this.getRoot(),
Configuration.CATEGORY_GENERAL,
Constants.CFG_WAILA_SHOWICON,
true,
false,
"screen.button.no",
"screen.button.yes"),
"choice.showicon");
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutConfigPos")
@@ -18,7 +18,7 @@ public class OverlayConfig {
// spotless:off
public static void updateColors() {
alpha = (int) (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_ALPHA, 0) / 100.0f * 256) << 24;
alpha = (int) (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_ALPHA, 0) / 100.0f * 255f) << 24;
bgcolor = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_BGCOLOR, 0);
gradient1 = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT1, 0);
gradient2 = alpha + ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_GRADIENT2, 0);
@@ -106,6 +106,8 @@ public class Tooltip {
public Tooltip(List<String> textData, boolean hasIcon) {
if (hasIcon) hasIcon = ConfigHandler.instance().showIcon();
columnsWidth.add(0); // Small init of the arrays to have at least one element
columnsPos.add(0);
@@ -19,6 +19,7 @@ public final class Constants {
public static String CFG_WAILA_LIQUID = "waila.cfg.liquid";
public static String CFG_WAILA_METADATA = "waila.cfg.metadata";
public static String CFG_WAILA_KEYBIND = "waila.cfg.keybind";
public static String CFG_WAILA_SHOWICON = "waila.cfg.showicon";
public static String CFG_WAILA_POSX = "waila.cfg.posx";
public static String CFG_WAILA_POSY = "waila.cfg.posy";
public static String CFG_WAILA_SCALE = "waila.cfg.scale";