aboutsummaryrefslogtreecommitdiff
path: root/gradle
diff options
context:
space:
mode:
authorJonas Herzig <me@johni0702.de>2021-03-14 11:25:33 +0100
committerJonas Herzig <me@johni0702.de>2021-03-14 11:38:19 +0100
commite7bc0828ad53c283ca9048e5b54146bf4e81e057 (patch)
tree03a0196556fae719a09dac16151ff683d4d7ada8 /gradle
parent1dcdcb113251ae78c16f53fc62ece35f07f6caf5 (diff)
downloadRemap-e7bc0828ad53c283ca9048e5b54146bf4e81e057.tar.gz
Remap-e7bc0828ad53c283ca9048e5b54146bf4e81e057.tar.bz2
Remap-e7bc0828ad53c283ca9048e5b54146bf4e81e057.zip
Add new @Pattern feature to centralize version-aware code
That is, most of the business code should not be aware that it is being compiled to multiple versions even when it heavily interacts with MC, preprocessor statements should be an escape hatch, not the norm. Similarly, code should not be forced to do `MCVer.getWindow(mc)` instead of the much more intuitive `mc.getWindow()`, and this new preprocessor (technically remap) feature makes this possible by defining "search and replace"-like patterns (but smarter in that they are type-aware) in one or more central places which then are applied all over the code base. In a way, this is another step in the automatic back-porting process where preprocessor statements are used when we cannot yet do something automatically. Previously we "merely" automatically converted between different mapping, this new feature now also allows us to automatically perform simple refactoring tasks like changing field access to a getter+setter (e.g. `mc.getWindow()`), or changing how a method is called (e.g. `BufferBuilder.begin`), or changing a method call chain (e.g. `dispatcher.camera.getYaw()`), or most other search-and-replace-like changes and any combination of those. The only major limitation is that the replacement itself is not smart, so arguments must be kept in same order (or be temporarily assigned to local variables which then can be used in any order).
Diffstat (limited to 'gradle')
0 files changed, 0 insertions, 0 deletions