(While coming up with the title, I wished I managed to get some better footage of the actual results of this behaviour, but it seems it doesn't break much in vanilla. However, I felt it needed to be pointed out anyhow)
After some confusing tours in my code where things seemed to break seemingly at random in scripts I had no control over (including other mods!) I finally found what was causing these oddities: Misc.ZERO, the zero-vector constant defined in the Misc package,
is not actually a true constant. It cannot be "set", and the object reference is indeed constant. However, there are ways to affect it:
Misc.ZERO = new Vector2f(9000f, 0f); /* This, as intended, does not work and will throw an error */
Misc.ZERO.x += 9000f; /* This WORKS, and makes all vector math that happens to use Misc.ZERO completely break down */
While this behaviour causes no issues in vanilla, and doesn't happen unless someone happens to overwrite it, it feels like an oversight that might create some strange and hard-to-find buggy behaviour down the line should it be treated as a constant. I know it took me quite the while to figure out the bug, and I only had 7 lines of code to debug!
I'm not sure how possible it is but I think that, from a coding standpoint, Misc.ZERO should probably be set as some form of "true" constant, however this would be achieved in java (alternatively, turned into a function that always
returns new Vector2f(0f, 0f)).