thedarkcolour / KotlinForForge

Makes Kotlin forge-friendly.
GNU Lesser General Public License v2.1
194 stars 26 forks source link

Support 1.19.3 #60

Closed xuankaicat closed 1 year ago

xuankaicat commented 1 year ago

Upgrade KFF for support 1.19.3. I renamed clone in vector util to deepCopy for avoiding the shadow in org.joml.*.

tmvkrpxl0 commented 1 year ago

Should we switch to Vector**c variants such as Vector3fC, Vector2ic, etc? it can allow alternative implementations of vector to work with our util

Oh, nvm, those are immutable Hmm, methods such as plus can be implemented immutable, while plusAssign must be mutable, I think implementing immutable methods only for Vector**c variants can work

tmvkrpxl0 commented 1 year ago

Plus, should Quaternion rotation be considered as multiplication? It is indeed multiplication in complex number sense, and the way it is represented in programming is same as Vector, with different sets of methods

tmvkrpxl0 commented 1 year ago

I've... found a issue, Mutable vector classes such as Vector4f defines method such as div, and kotlin calls it instead of our extension function. and that div function mutates itself, so doing "val c = a / b" will mutate a. Since it's member method it's not possible to override. One solution would be requiring users to declare type of a as read-only one(Vector4fc in this context)

tmvkrpxl0 commented 1 year ago

I've added functionalities that I missed(twice) in my branch based on your PR, feel free to cherry-pick it. https://github.com/tmvkrpxl0/KotlinForForge/commits/3.x-cat I've added: division operator (I somehow missed this twice) Iterator for iterating elements in x,y,z,w order index access method, [0] is x and [1] is y and so on. It can also set it Created Vector4dcUtil.kt

Tester also tests these new functionalities, 30 times in a row.