isXander / isXander/YetAnotherConfigLib
[API Request] Allow `AutoGen` Config to Set `OptionFlag`
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 155
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
Now there is no way to set OptionFlag for AutoGen config.
I wrote a mixin for temporary use. (It's cumbersome to open a PR for a new project.)
@Mixin(SimpleOptionFactory.class)
abstract class MSimpleOptionFactory<A extends Annotation, T> implements OptionFactory<A, T> {
@Inject(method = "flags", at = @At("RETURN"), cancellable = true)
private void setFlags(A annotation, ConfigField<T> field, OptionAccess storage, CallbackInfoReturnable<Set<OptionFlag>> cir) {
if (field.access().getAnnotation(GameRestart.class).isPresent()) {
var set = new HashSet<>(cir.getReturnValue());
set.add(OptionFlag.GAME_RESTART);
cir.setReturnValue(set);
}
}
}
public class PSEConfig {
@AutoGen(category = Categories.MAIN)
@SerialEntry
@IntField(min = 1, max = 64, format = "%d")
@GameRestart
public int potionMaxStack = 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.
Research direction
Trace AutoGen handling into SimpleOptionFactory.flags and inspect how OptionFlag values are produced. Confirm the API can express an OptionFlag such as GAME_RESTART for an AutoGen field, and verify that generated options retain it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100