making custom filters more powerful #443
Open
+9
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As far as I know, the custom filters are currently limited to groovy and java builtin classes and the NBT library, not allowing for json read/write operations on files for example.
This PR aims to solve that. It implements the possibility to make custom import statements based on the libraries that mca uses. (Maybe even past that) Instead of only being able to write the code that is put inside the filter function, you can now define the filter function itself inside of the custom filter, allowing for imports before that definition.
This is also useful for extending the custom filter functionality even more, for example by adding some kind of hook functions "before" and "after" that will be called once before the filtering process starts and after it ends. That way one could define all those three functions in the custom filter, making it even more powerful.