EnumCycler#allowedOrdinals() has inverted implementation logic
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 78/100
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.
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;
- Dominant language
- Java
- Stars
- 155
- Forks
- 68
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 1
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.
More from isXander/YetAnotherConfigLib
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
isXander/YetAnotherConfigLib#361 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
isXander/YetAnotherConfigLib#343 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
isXander/YetAnotherConfigLib#362 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
isXander/YetAnotherConfigLib#360 · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
isXander/YetAnotherConfigLib#357 ·
All issues in isXander/YetAnotherConfigLib
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100