isXander / isXander/YetAnotherConfigLib
EnumCycler#allowedOrdinals() has inverted implementation logic
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 155
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
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.
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;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EnumCyclerImpl.java at the referenced implementation and compare its ordinal filtering with the documented allowedOrdinals behavior. Use the DifficultySetting example to verify that the listed ordinals are selectable and that an omitted ordinal is rejected; done means the implementation matches the documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100