diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-12 17:21:36 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-12 17:21:36 +0700 |
commit | 636df2c2b3b8e4aa0de64cf3b9aa5c089afd70a9 (patch) | |
tree | 521d8bc2f6e6f307f62e12a3deb7a05f0f72213e /src/main/java/cc/polyfrost/oneconfig/gui/elements | |
parent | da5288bd5c80611acfeb1ebe33af1860f27f23fc (diff) | |
parent | cf8b1a7f962ad3a9c31e6698fb7caf82aac42a18 (diff) | |
download | OneConfig-636df2c2b3b8e4aa0de64cf3b9aa5c089afd70a9.tar.gz OneConfig-636df2c2b3b8e4aa0de64cf3b9aa5c089afd70a9.tar.bz2 OneConfig-636df2c2b3b8e4aa0de64cf3b9aa5c089afd70a9.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements')
3 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java index e5d187f..ac12f07 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java @@ -44,6 +44,7 @@ public class ModCard extends BasicElement { @Override public void draw(long vg, int x, int y) { super.update(x, y); + String cleanName = modData.name.replaceAll("ยง.", ""); Scissor scissor = ScissorManager.scissor(vg, x, y, width, height); isHoveredMain = InputUtils.isAreaHovered(x, y, width, 87); @@ -57,11 +58,11 @@ public class ModCard extends BasicElement { RenderManager.drawSvg(vg, modData.modIcon, x + 98, y + 19, 48, 48); else RenderManager.drawImage(vg, modData.modIcon, x + 98, y + 19, 48, 48); } else { - RenderManager.drawText(vg, modData.name, x + 122 - RenderManager.getTextWidth(vg, modData.name, 16, Fonts.MINECRAFT_BOLD) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD); + RenderManager.drawText(vg, cleanName, x + Math.max(0, (244 - RenderManager.getTextWidth(vg, cleanName, 16, Fonts.MINECRAFT_BOLD))) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD); } favoriteButton.draw(vg, x + 212, y + 87); favorite = favoriteButton.isToggled(); - RenderManager.drawText(vg, modData.name, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM); + RenderManager.drawText(vg, cleanName, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM); if (favorite) favoriteButton.setLeftIcon(SVGs.HEART_FILL); else favoriteButton.setLeftIcon(SVGs.HEART_OUTLINE); 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 5efebdd..67488d7 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 @@ -39,7 +39,7 @@ public class ConfigColorElement extends BasicOption { public void draw(long vg, int x, int y) { if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f); hexField.disable(!isEnabled()); - alphaField.disable(!isEnabled() || allowAlpha); + alphaField.disable(!isEnabled() || !allowAlpha); element.disable(!isEnabled()); int x1 = size == 1 ? x : x + 512; diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java index b7d1a68..1aa5d66 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java @@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.config.core.OneKeyBind; import cc.polyfrost.oneconfig.config.elements.BasicOption; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.gui.elements.BasicButton; +import cc.polyfrost.oneconfig.internal.config.core.KeyBindHandler; import cc.polyfrost.oneconfig.renderer.RenderManager; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.internal.assets.SVGs; @@ -22,6 +23,7 @@ public class ConfigKeyBind extends BasicOption { super(field, parent, name, category, subcategory, size); button = new BasicButton(256, 32, "", SVGs.KEYSTROKE, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY); button.setToggleable(true); + KeyBindHandler.addKeyBind(getKeyBind()); } public static ConfigKeyBind create(Field field, Object parent) { @@ -71,6 +73,7 @@ public class ConfigKeyBind extends BasicOption { private OneKeyBind getKeyBind() { OneKeyBind keyBind = new OneKeyBind(); try { + field.setAccessible(true); keyBind = (OneKeyBind) get(); } catch (IllegalAccessException ignored) { } |