Fixed trait serialization

This commit is contained in:
Sollace 2024-03-22 18:52:30 +00:00
parent 64fb0ecc07
commit bc90a96e44
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -62,7 +62,7 @@ public enum Trait implements CommandArgumentEnum<Trait> {
private static final Map<String, Trait> REGISTRY = Arrays.stream(values()).collect(Collectors.toMap(Trait::name, Function.identity()));
private static final Map<Identifier, Trait> IDS = Arrays.stream(values()).collect(Collectors.toMap(Trait::getId, Function.identity()));
public static final com.mojang.serialization.Codec<Trait> CODEC = StringIdentifiable.createCodec(Trait::values, n -> Unicopia.id(n.toLowerCase(Locale.ROOT)).toString());
public static final com.mojang.serialization.Codec<Trait> CODEC = StringIdentifiable.createCodec(Trait::values, n -> n.toLowerCase(Locale.ROOT));
public static final com.mojang.serialization.Codec<Set<Trait>> SET_CODEC = CODEC.listOf().xmap(
l -> l.stream().distinct().collect(Collectors.toSet()),
s -> s.stream().toList()
@ -109,7 +109,7 @@ public enum Trait implements CommandArgumentEnum<Trait> {
@Override
public String asString() {
return name();
return getId().getPath();
}
public TraitGroup getGroup() {