-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Arithmetic Rework #5203
Arithmetic Rework #5203
Conversation
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.
Overall, looks really solid! Great work.
There will probably be a few other things, but I'm going to ask around for some input first + see how it looks after current requested changes are made :)
src/main/java/ch/njol/skript/expressions/arithmetic/ExprArithmetic.java
Outdated
Show resolved
Hide resolved
So this just crossed my mind, order of operations are still done in order with this system right so |
Yes, they are still in order |
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.
Looking really good now!
src/main/java/ch/njol/skript/expressions/arithmetic/ExprArithmetic.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/arithmetic/ExprArithmetic.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/arithmetic/ExprArithmetic.java
Outdated
Show resolved
Hide 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.
I'm thinking this is okay now - another review or two is definitely necessary
Excellent work!
Also, I think we should try to add some tests if possible (not sure what currently exists)
This should have comprehensive (if not exhaustive) tests written. :) |
converted to draft while I fix some bugs with the new system |
Description
This PR reworks the arithmetic system and expression, it allows addons (and skript) to very easily register their own custom arithmetic type; making the arithmetic expression more versatile. How you register an arithmetic is quite similar to how changers register, examples from the current registered arithmetics here, and they work similarly. An operator is given to an arithmetic then that arithmetic can return an array of classes to determine what can be used as the second value of the operation (same as Changers).
Note:
This is change may break addons that use the current arithmetic system, I tried to make it backwards compatible but there are no guarantees that it won't break them
Some examples of what can be done using this new system:
![](https://camo.githubusercontent.com/8c185a091aced9073f72c28455db8f348ea91fd2698afb03976a8474c48e0d73/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3833363232303432323232333033363436372f313034303731333638333039353031353434342f696d6167652e706e67)
The current registered arithmetic types are:
Target Minecraft Versions: any
Requirements: none
Related Issues: #4253