diff options
author | xander <xander@isxander.dev> | 2022-09-05 07:56:47 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-05 07:56:47 +0100 |
commit | 3d75debaf50c39576a0a5a198e0a15c62db606a9 (patch) | |
tree | 7768b4698b7349079d2c690fce6db1beaaeeb3af | |
parent | 833189bb4d8f524c572b6dcc86a7e146cdcf979f (diff) | |
download | YetAnotherConfigLib-3d75debaf50c39576a0a5a198e0a15c62db606a9.tar.gz YetAnotherConfigLib-3d75debaf50c39576a0a5a198e0a15c62db606a9.tar.bz2 YetAnotherConfigLib-3d75debaf50c39576a0a5a198e0a15c62db606a9.zip |
modrinth and cursefoge ids
-rw-r--r-- | gradle.properties | 4 | ||||
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java | 16 |
2 files changed, 12 insertions, 8 deletions
diff --git a/gradle.properties b/gradle.properties index 21452ad..d8e9acb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,6 @@ modId=yet-another-config-lib modName=YetAnotherConfigLib modDescription=YetAnotherConfigLib (yacl) is just that. A builder-based configuration library for Minecraft. -curseforgeId= -modrinthId= +curseforgeId=667299 +modrinthId=yacl githubProject=isXander/YetAnotherConfigLib diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java b/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java index 4d1dfc3..11e33d0 100644 --- a/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java +++ b/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java @@ -63,10 +63,10 @@ public class ColorController implements IStringController<Color> { @Override public Text formatValue() { MutableText text = Text.literal("#"); - if (allowAlpha()) text.append(toHex(option().pendingValue().getAlpha())); text.append(Text.literal(toHex(option().pendingValue().getRed())).formatted(Formatting.RED)); text.append(Text.literal(toHex(option().pendingValue().getGreen())).formatted(Formatting.GREEN)); text.append(Text.literal(toHex(option().pendingValue().getBlue())).formatted(Formatting.BLUE)); + if (allowAlpha()) text.append(toHex(option().pendingValue().getAlpha())); return text; } @@ -82,12 +82,16 @@ public class ColorController implements IStringController<Color> { if (value.startsWith("#")) value = value.substring(1); - int alpha = Integer.parseInt(value.substring(0, 2), 16); - int red = Integer.parseInt(allowAlpha() ? value.substring(2, 4) : value.substring(0, 2), 16); - int green = Integer.parseInt(allowAlpha() ? value.substring(4, 6) : value.substring(2, 4), 16); - int blue = Integer.parseInt(allowAlpha() ? value.substring(6, 8) : value.substring(4, 6), 16); + int red = Integer.parseInt(value.substring(0, 2), 16); + int green = Integer.parseInt(value.substring(2, 4), 16); + int blue = Integer.parseInt(value.substring(4, 6), 16); - option().requestSet(allowAlpha() ? new Color(red, green, blue, alpha) : new Color(red, green, blue)); + if (allowAlpha()) { + int alpha = Integer.parseInt(value.substring(6, 8), 16); + option().requestSet(new Color(red, green, blue, alpha)); + } else { + option().requestSet(new Color(red, green, blue)); + } } @Override |