mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed trait serialization
This commit is contained in:
parent
64fb0ecc07
commit
bc90a96e44
1 changed files with 2 additions and 2 deletions
|
@ -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<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()));
|
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(
|
public static final com.mojang.serialization.Codec<Set<Trait>> SET_CODEC = CODEC.listOf().xmap(
|
||||||
l -> l.stream().distinct().collect(Collectors.toSet()),
|
l -> l.stream().distinct().collect(Collectors.toSet()),
|
||||||
s -> s.stream().toList()
|
s -> s.stream().toList()
|
||||||
|
@ -109,7 +109,7 @@ public enum Trait implements CommandArgumentEnum<Trait> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String asString() {
|
public String asString() {
|
||||||
return name();
|
return getId().getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TraitGroup getGroup() {
|
public TraitGroup getGroup() {
|
||||||
|
|
Loading…
Reference in a new issue