Adds checks to not normalize zero vectors
Description
Checks if a vector is zero before calling Vector#normalize() in order to avoid creating vectors with infinite components (stemming from dividing by 0). Currently, syntax that would cause an internal error now returns a zero vector which might be a breaking change according to sovde.
Target Minecraft Versions: any Requirements: none Related Issues: #6194
~~I think isZero is only available on Paper~~
No, it's just added very recently in spigot. 1.19.3+
Oh shoot, i didnt even think about checking for that. Ill try to find a different method. Do you think it would be a bad idea to make my own isZero method that checks the x,y,z componenets? If thats the way to go would i just add it to each file where I use it or would i put it in some utils class
Oh shoot, i didnt even think about checking for that. Ill try to find a different method. Do you think it would be a bad idea to make my own isZero method that checks the x,y,z componenets? If thats the way to go would i just add it to each file where I use it or would i put it in some utils class
Sure, slap it in VectorMath
~~Hm, it doesn't seem to be my new test failing and the branch seems to be up to date with dev/patch so I am not sure what the issue is here~~
Using the new error keyword in the assert statement seems to have been the issue. I guess it hasn't been added to dev/patch yet