mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 13:37:58 +01:00
Fix spell recipes (1.20.2)
This commit is contained in:
parent
cc8bc28432
commit
ebbb87a0b8
1 changed files with 4 additions and 3 deletions
|
@ -60,7 +60,8 @@ public enum Trait implements CommandArgumentEnum<Trait> {
|
|||
BLOOD(TraitGroup.DARKNESS);
|
||||
|
||||
private static final Map<Identifier, Trait> IDS = Arrays.stream(values()).collect(Collectors.toMap(Trait::getId, Function.identity()));
|
||||
public static final EnumCodec<Trait> CODEC = StringIdentifiable.createCodec(Trait::values, n -> n.toLowerCase(Locale.ROOT));
|
||||
private static final EnumCodec<Trait> NAME_CODEC = StringIdentifiable.createCodec(Trait::values, n -> n.toLowerCase(Locale.ROOT));
|
||||
public static final Codec<Trait> CODEC = Identifier.CODEC.xmap(id -> IDS.get(id), Trait::getId);
|
||||
public static final Codec<Set<Trait>> SET_CODEC = CODEC.listOf().xmap(
|
||||
l -> l.stream().distinct().collect(Collectors.toSet()),
|
||||
s -> s.stream().toList()
|
||||
|
@ -165,7 +166,7 @@ public enum Trait implements CommandArgumentEnum<Trait> {
|
|||
|
||||
@Deprecated
|
||||
public static Optional<Trait> fromName(String name) {
|
||||
Trait trait = CODEC.byId(name);
|
||||
Trait trait = NAME_CODEC.byId(name);
|
||||
if (trait == null) {
|
||||
Unicopia.LOGGER.error("Unknown trait: " + name);
|
||||
}
|
||||
|
@ -178,7 +179,7 @@ public enum Trait implements CommandArgumentEnum<Trait> {
|
|||
|
||||
public static class ArgumentType extends EnumArgumentType<Trait> {
|
||||
protected ArgumentType() {
|
||||
super(CODEC, Trait::values);
|
||||
super(NAME_CODEC, Trait::values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue