Skip to content

Commit 3d75deb

Browse files
committed
modrinth and cursefoge ids
1 parent 833189b commit 3d75deb

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ modId=yet-another-config-lib
77
modName=YetAnotherConfigLib
88
modDescription=YetAnotherConfigLib (yacl) is just that. A builder-based configuration library for Minecraft.
99

10-
curseforgeId=
11-
modrinthId=
10+
curseforgeId=667299
11+
modrinthId=yacl
1212
githubProject=isXander/YetAnotherConfigLib

src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public String getString() {
6363
@Override
6464
public Text formatValue() {
6565
MutableText text = Text.literal("#");
66-
if (allowAlpha()) text.append(toHex(option().pendingValue().getAlpha()));
6766
text.append(Text.literal(toHex(option().pendingValue().getRed())).formatted(Formatting.RED));
6867
text.append(Text.literal(toHex(option().pendingValue().getGreen())).formatted(Formatting.GREEN));
6968
text.append(Text.literal(toHex(option().pendingValue().getBlue())).formatted(Formatting.BLUE));
69+
if (allowAlpha()) text.append(toHex(option().pendingValue().getAlpha()));
7070
return text;
7171
}
7272

@@ -82,12 +82,16 @@ public void setFromString(String value) {
8282
if (value.startsWith("#"))
8383
value = value.substring(1);
8484

85-
int alpha = Integer.parseInt(value.substring(0, 2), 16);
86-
int red = Integer.parseInt(allowAlpha() ? value.substring(2, 4) : value.substring(0, 2), 16);
87-
int green = Integer.parseInt(allowAlpha() ? value.substring(4, 6) : value.substring(2, 4), 16);
88-
int blue = Integer.parseInt(allowAlpha() ? value.substring(6, 8) : value.substring(4, 6), 16);
85+
int red = Integer.parseInt(value.substring(0, 2), 16);
86+
int green = Integer.parseInt(value.substring(2, 4), 16);
87+
int blue = Integer.parseInt(value.substring(4, 6), 16);
8988

90-
option().requestSet(allowAlpha() ? new Color(red, green, blue, alpha) : new Color(red, green, blue));
89+
if (allowAlpha()) {
90+
int alpha = Integer.parseInt(value.substring(6, 8), 16);
91+
option().requestSet(new Color(red, green, blue, alpha));
92+
} else {
93+
option().requestSet(new Color(red, green, blue));
94+
}
9195
}
9296

9397
@Override

0 commit comments

Comments
 (0)