diff options
4 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/annotations/Color.java b/src/main/java/cc/polyfrost/oneconfig/config/annotations/Color.java index 98cc5ec..cea220e 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/annotations/Color.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/annotations/Color.java @@ -14,6 +14,8 @@ import java.lang.annotation.Target; public @interface Color { String name(); + boolean allowAlpha() default true; + int size() default 1; String category() default "General"; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java index 2c49f08..a8fdb5e 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java @@ -169,7 +169,7 @@ public class VigilanceConfig extends Config { private OneColor cachedColor = null; public CompatConfigColorElement(Field color, Vigilant parent, String name, String category, String subcategory, int size) { - super(null, parent, name, category, subcategory, size); + super(null, parent, name, category, subcategory, size, true); this.color = color; } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java index 581babd..5efebdd 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java @@ -20,26 +20,26 @@ public class ConfigColorElement extends BasicOption { private final TextInputField alphaField = new TextInputField(72, 32, "", false, false); private final BasicElement element = new BasicElement(64, 32, false); private boolean open = false; - private final boolean isAlphaAllowed; + private final boolean allowAlpha; - public ConfigColorElement(Field field, Object parent, String name, String category, String subcategory, int size) { + public ConfigColorElement(Field field, Object parent, String name, String category, String subcategory, int size, boolean allowAlpha) { super(field, parent, name, category, subcategory, size); hexField.setCentered(true); alphaField.setCentered(true); alphaField.onlyAcceptNumbers(true); - isAlphaAllowed = true; + this.allowAlpha = allowAlpha; } public static ConfigColorElement create(Field field, Object parent) { Color color = field.getAnnotation(Color.class); - return new ConfigColorElement(field, parent, color.name(), color.category(), color.subcategory(), color.size()); + return new ConfigColorElement(field, parent, color.name(), color.category(), color.subcategory(), color.size(), color.allowAlpha()); } @Override public void draw(long vg, int x, int y) { if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f); hexField.disable(!isEnabled()); - alphaField.disable(!isEnabled() || isAlphaAllowed); + alphaField.disable(!isEnabled() || allowAlpha); element.disable(!isEnabled()); int x1 = size == 1 ? x : x + 512; @@ -87,7 +87,7 @@ public class ConfigColorElement extends BasicOption { RenderManager.drawRoundedRect(vg, x1 + 420, y + 4, 56, 24, color.getRGB(), 8f); if (element.isClicked() && !element.isToggled()) { open = !open; - OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY())); + OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY(), allowAlpha)); } if (OneConfigGui.INSTANCE.currentColorSelector == null) open = false; if (OneConfigGui.INSTANCE.currentColorSelector != null && open) { diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java index 3397264..6b28835 100644 --- a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java @@ -27,9 +27,9 @@ public class HUDUtils { options.get(options.size() - 1).addDependency(() -> hud.enabled); options.add(new ConfigCheckbox(hud.getClass().getField("border"), hud, "Outline/border", category, subcategory, 1)); options.get(options.size() - 1).addDependency(() -> hud.enabled); - options.add(new ConfigColorElement(hud.getClass().getField("bgColor"), hud, "Background color:", category, subcategory, 1)); + options.add(new ConfigColorElement(hud.getClass().getField("bgColor"), hud, "Background color:", category, subcategory, 1, true)); options.get(options.size() - 1).addDependency(() -> hud.enabled); - options.add(new ConfigColorElement(hud.getClass().getField("borderColor"), hud, "Border color:", category, subcategory, 1)); + options.add(new ConfigColorElement(hud.getClass().getField("borderColor"), hud, "Border color:", category, subcategory, 1, true)); options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.border); options.add(new ConfigSlider(hud.getClass().getField("cornerRadius"), hud, "Corner radius:", category, subcategory, 0, 10, 0)); options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.rounded); |