-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Adds a SetEffect lang util class #5219
Conversation
Co-authored-by: Patrick Miller <[email protected]>
Would the resulting syntax for your example be |
Yes the word registerMake(SetEffectTest.class, "all", "(return all|(have|be) all)", "itemtypes"); Which would make that |
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.
I would like some discussion on the usage of the BiConsumer
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.
I hate to say it but I think I would have to agree with tud for the most part. I don't know if this is the best way to move forward with this kind of thing.
Having thought more about this, I'm shifting my position from "this seems unnecessary but alright" to just "this seems unnecessary". Like tud said, I think the main issue with these kinds of syntaxes is having to register both a condition and an effect, which this doesn't address. The only real solid benefit I can see here is standardizing the syntaxes for similar properties, but it comes at the cost of being a lot less flexible. As I said in my last comment, when I had trouble with this sort of thing, it was with unusual syntax that didn't fit the kind of syntax this PR creates anyways. I just think this would be a very niche addition that doesn't really help solve the real issue of needing both a condition and effect. I also think that boolean property expressions seem perfectly fine most of the time as well. |
bd134d0
to
3f08853
Compare
The only other way about going around with this is similar to how ExprChange was applied to every expression with an overridable method, which would potentially go into a Condition? Proposals are needed here. I still only see this as the most valid way to avoid the ugly line of getting boolean expressions. |
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.
I'm not really a fan of the set
patterns here. IMO they are what we are trying to get away from when avoiding using an Effect rather than an Expression.
The make/force patterns might be a little inflexible, but it's not terrible. What might be more useful IMO is a utility that registers both an Effect and a Condition (this would have to use some sort of backing interface, would probably be a little messy).
it seems like the teams consensus is that we would rather not pursue this approach. thank you for your contribution regardless |
Description
Separated the JUnit fixes in this pull request into #6057 will rebase this after that gets merged
Adding my implementation of how to deal with boolean expressions not reflecting proper language statements.
My addons have been using this utility class for a long time. Examples below.
What this utility class does is registers a default effect and not an expression, because returning a boolean expression should be a condition, but we still want to support changing the property value.
This conversation has been brought up before in the SkUnity developer Discord channel as needing a change. So i'm gonna add my implementation that solves that said issue. Honestly this is very helpful.
Examples of my addons using this utility class:
Khoryl (There are subclasses to the set effect due to how Khoryl has to operate)https://github.com/TheLimeGlass/Khoryl/tree/master/src/main/java/me/limeglass/khoryl/elements
Skellett example: https://github.com/TheLimeGlass/Skellett/blob/master/src/main/java/me/limeglass/skellett/elements/bossbars/SetBossBarVisible.java
Target Minecraft Versions: any
Requirements: none