-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloth-config dependency support #204
Conversation
common/src/main/java/me/shedaniel/clothconfig2/api/ValueHolder.java
Outdated
Show resolved
Hide resolved
@shedaniel do you think you'll get time to review this soon? I'm open to feedback and discussing the overall design if you have a different approach in mind. |
Thank you for this PR and sorry that I have completely forgotten about this, please continue to notify me if I forget in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically these all are impl classes, but Cloth Config is so widely used now that we can't afford to break anyone's code, so we have to keep binary compat even in internal code
common/src/main/java/me/shedaniel/clothconfig2/gui/entries/TooltipListEntry.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/gui/entries/TooltipListEntry.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/api/AbstractConfigEntry.java
Outdated
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/api/AbstractConfigEntry.java
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final minor nitpicks and also would need to resolve the previous issues, then I think this is good to go.
Thank you for your work so far!!
common/src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
Show resolved
Hide resolved
common/src/main/java/me/shedaniel/clothconfig2/gui/widget/DynamicEntryListWidget.java
Outdated
Show resolved
Hide resolved
Fixed your latest points. Also found and fixed a bug where a hidden boolean toggle entry was still handling click events: aa22d5e |
common/src/main/java/me/shedaniel/clothconfig2/api/DisableableWidget.java
Outdated
Show resolved
Hide resolved
Allows users to define dependency `Requirement`s as lambda functions, or generate them via factory methods. A standard requirement controls whether a Config Entry is "enabled" or "disabled". When "disabled" the Config Entry is greyed-out and cannot be interacted with. A "display" requirement controls whether a Config Entry appears _at all_ in the GUI. It's still technically present, but won't be rendered or take up any space in the list GUI. A hidden Config Entry is also disabled automatically.
85d1cdb
to
8eb1416
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for everything you’ve done! I am currently on a trip, I will merge this the next weekend
Great, thanks for all your help and guidance. 🎉 Would you like the PR to target a different branch or stick with Enjoy your trip! |
* Enable/Display config entries using dependencies Allows users to define dependency `Requirement`s as lambda functions, or generate them via factory methods. A standard requirement controls whether a Config Entry is "enabled" or "disabled". When "disabled" the Config Entry is greyed-out and cannot be interacted with. A "display" requirement controls whether a Config Entry appears _at all_ in the GUI. It's still technically present, but won't be rendered or take up any space in the list GUI. A hidden Config Entry is also disabled automatically. * Apply license headers --------- Co-authored-by: shedaniel <[email protected]>
* Enable/Display config entries using dependencies Allows users to define dependency `Requirement`s as lambda functions, or generate them via factory methods. A standard requirement controls whether a Config Entry is "enabled" or "disabled". When "disabled" the Config Entry is greyed-out and cannot be interacted with. A "display" requirement controls whether a Config Entry appears _at all_ in the GUI. It's still technically present, but won't be rendered or take up any space in the list GUI. A hidden Config Entry is also disabled automatically. * Apply license headers --------- Co-authored-by: shedaniel <[email protected]>
Follow up from shedaniel#204, adds annotation based dependency support to autoconfig.
Following on from my initial draft PR #195, here's a subset of the changes focused on adding dependency support to cloth config.
I identified the main cause of complexity in the draft PR was auto-generating human readable descriptions of potentially complex dependencies. In hindsight, the result isn't worth the added complexity, instead it is recommended that users write their own dependency descriptions in tooltips or labels.
This PR does add a simple "Dependencies not met" line to the tooltip when
isEnabled()
isfalse
. This could be removed/reformatted/reworded depending on your preference.Currently, theimplementedDependency
may be checked multiple times per frame. If this proves performance intenseive, it may make sense to instead check once-per-tick on the main thread and store the result in anAtomicBoolean
to reference from the render thread.I plan to add an implementation for autoconfig in a follow up PR, based on what I have currently in the initial draft, but ideally this should be merged first - or at least the design agreed upon.
Fixes #26