Switch to JOML vectors.
Problem
In the pursuit of a Bukkit-less Skript, Vector is a rather large thorn in the side. It's used all over the place in many places that have no relation to Bukkit at all. It's also not exactly the more versatile or optimized implementation of vectors. Since Minecraft now provides JOML at no cost to us, it seems prudent to swap to relying on JOML vectors instead.
JOML vectors also open up some new optimization opportunities as they allow for more efficient operations compared to Bukkit's.
Solution
Replaces nearly every instance of Vector with Vector3d. The vector classinfo is now backed by Vector3d. Vector remains in Bukkit-specific areas where it would be silly to try to force in Vector3d just to swap it back to Vector every time it's needed, but Vector should no longer be passed between syntaxes.
No additional optimizations have been made to existing implementation to help make this PR easier to review. It should be a 1:1 replacement as of now. Despite that, a small performance improvement of around 5-10% has been seen when testing basic vector operations.
I have added converters between Vector3d and Vector to help back-compatibility with addons, though that likely won't help a lot since any use of %vector% will now produce a Vector3d instead of the expected Vector.
Vectors stored in variables will be deserialized as a Vector3d without issue, and vice versa if the user ever goes back to to a version prior to this PR.
It's very likely I've missed a spot or two and I would appreciate anyone willing to test this.
Testing Completed
No new tests added.
Supporting Information
This should target 2.13 at the earliest.
Breaking changes:
- The 'vector' classinfo is now backed by Vector3d, meaning any addon who uses a %vector% input expecting it to be a Vector will need to re-write their code.
- The should be no user-facing breaking changes, only addon-facing ones.
Completes: none Related: none
Leaving this open for now, but not going to merge unless i can find a less breaking way to do this. It's not worth breaking a lot of addons over a minor improvement. Perhaps a new type called vector3 or something