|
@@ -1,6 +1,8 @@
|
|
|
package me.lortseam.completeconfig.data;
|
|
|
|
|
|
+import lombok.AccessLevel;
|
|
|
import lombok.Getter;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import me.lortseam.completeconfig.api.ConfigEntryContainer;
|
|
|
import me.lortseam.completeconfig.data.gui.TranslationIdentifier;
|
|
|
import net.minecraft.text.TextColor;
|
|
@@ -12,15 +14,6 @@ import java.lang.reflect.Field;
|
|
|
|
|
|
public class ColorEntry<T> extends Entry<T> {
|
|
|
|
|
|
- public static final ScalarSerializer<TextColor> TEXT_COLOR_SERIALIZER = TypeSerializer.of(TextColor.class, (item, typeSupported) -> {
|
|
|
- return item.getRgb();
|
|
|
- }, value -> {
|
|
|
- if (value instanceof Integer) {
|
|
|
- return TextColor.fromRgb((int) value);
|
|
|
- }
|
|
|
- throw new CoercionFailedException(value, "TextColor");
|
|
|
- });
|
|
|
-
|
|
|
@Getter
|
|
|
private final boolean alphaMode;
|
|
|
|
|
@@ -29,4 +22,18 @@ public class ColorEntry<T> extends Entry<T> {
|
|
|
this.alphaMode = alphaMode;
|
|
|
}
|
|
|
|
|
|
+ @NoArgsConstructor(access = AccessLevel.PRIVATE)
|
|
|
+ public static final class Serializers {
|
|
|
+
|
|
|
+ public static final ScalarSerializer<TextColor> TEXT_COLOR = TypeSerializer.of(TextColor.class, (item, typeSupported) -> {
|
|
|
+ return item.getRgb();
|
|
|
+ }, value -> {
|
|
|
+ if (value instanceof Integer) {
|
|
|
+ return TextColor.fromRgb((int) value);
|
|
|
+ }
|
|
|
+ throw new CoercionFailedException(value, "TextColor");
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|