Using 3.9.2+26.1-fabric, the logic for the implementation of EnumCycler#allowedOrdinals appears to be inverted from how it is described in the documentation. The documentation says:
The allowed ordinals of the enum class. If empty, all ordinals are allowed.
This is only used if the enum does not implement {@link CyclableEnum}.
However, the logic here uses noneMatch, which will mean that the filter will only allow any ordinal which is not included in the allowedOrdinals array. It should instead use anyMatch.
|
.filter(ordinal -> annotation.allowedOrdinals().length == 0 || Arrays.stream(annotation.allowedOrdinals()).noneMatch(allowed -> allowed == ordinal)) |
Example
In my mod using this enum:
public enum DifficultySetting implements StringRepresentable {
AUTOMATIC("automatic"),
PEACEFUL("peaceful"),
EASY("easy"),
NORMAL("normal"),
HARD("hard");
private final String name;
DifficultySetting(String name) {
this.name = name;
}
@Override
public String getSerializedName() {
return this.name;
}
}
This setting will only allow the setting PEACEFUL to be selected, and not any of the others:
@AutoGen(category = "main")
@SerialEntry
@EnumCycler(allowedOrdinals = {0, 2, 3, 4})
DifficultySetting frostBiteAmplifierDifficulty = DifficultySetting.AUTOMATIC;
Using
3.9.2+26.1-fabric, the logic for the implementation ofEnumCycler#allowedOrdinalsappears to be inverted from how it is described in the documentation. The documentation says:However, the logic here uses
noneMatch, which will mean that the filter will only allow any ordinal which is not included in theallowedOrdinalsarray. It should instead useanyMatch.YetAnotherConfigLib/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EnumCyclerImpl.java
Line 27 in e7fcc32
Example
In my mod using this enum:
This setting will only allow the setting
PEACEFULto be selected, and not any of the others: