-
Notifications
You must be signed in to change notification settings - Fork 14
Improved Math Extensions/Functions #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
oops, hit enter before writing the description lol |
b5e4ce8 to
b183d4e
Compare
|
@jakobkmar is there any possibility I could get some feedback on this? because I'd love to see it merged soon-ish, if possible |
|
I'm probably actually gonna split this into two PRs:
|
b183d4e to
7899710
Compare
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
d648345 to
66a2d96
Compare
solonovamax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making this review to remind myself for later.
Also add kdoc comments to all elements.
| operator fun Vector3i.plus(n: Int): Vector3i = n.let { nInt -> Vector3i(this).add(nInt, nInt, nInt) } | ||
| operator fun Vector3i.plus(n: Long): Vector3i = n.toInt().let { nInt -> Vector3i(this).add(nInt, nInt, nInt) } | ||
| operator fun Vector3i.plus(n: Float): Vector3i = n.toInt().let { nInt -> Vector3i(this).add(nInt, nInt, nInt) } | ||
| operator fun Vector3i.plus(n: Double): Vector3i = n.toInt().let { nInt -> Vector3i(this).add(nInt, nInt, nInt) } | ||
| operator fun Vector3i.plus(n: Number): Vector3i = n.toInt().let { nInt -> Vector3i(this).add(nInt, nInt, nInt) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add Number.plus(Vector3i), etc. methods for parity with matrix extensions
| fun BlockPos.toPos3i(): Pos3i = Pos3i(x, y, z) | ||
| fun BlockPos.toPos3f(): Pos3f = Pos3f(x.toFloat(), y.toFloat(), z.toFloat()) | ||
| fun BlockPos.toPos3d(): Pos3d = Pos3d(x.toDouble(), y.toDouble(), z.toDouble()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add BlockPos.toVec3i(), etc. methods for completeness.
| "package": "net.silkmc.silk.core.mixin", | ||
| "required": true, | ||
| "compatibilityLevel": "JAVA_21", | ||
| "mixins": [ | ||
| "block.AbstractBlockAccessor", | ||
| "entity.MixinEntity", | ||
| "entity.MixinLivingEntity", | ||
| "server.MixinMinecraftServer", | ||
| "server.MixinPlayerList", | ||
| "server.MixinServerConfigurationPacketListenerImpl", | ||
| "server.MixinServerGamePacketListenerImpl", | ||
| "server.MixinServerLoginPacketListenerImpl" | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this change completely (changes nothing, artifact of not properly reverting another other change)
- Add operators for - Vector3i - Vector3f - Vector3d - Vector2i - Vector2f - Vector2d - Add new operators - cross product & dot product - overloads to avoid boxing & unboxing - initialization functions similar to listOf() for vectors - conversion functions for `Vec*`/`Vector*` -> `Pos*` - some function aliases for yarn mappings
- Add operators for all JOML matrix types
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
- Utility extensions for registering so you can do smth like
val MY_ITEM = Registries.ITEM.register("mymod:myid", MyItem())
- convenience methods for getting entities in an area
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Also suppress some warnings in the other *Operations files Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Soft depends on fabric-permissions-api-v0. Falls back to vanilla permission checks if it's not present Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
See: FabricMC/fabric-loom#1153 Using layered mappings with a custom mapping is preferred.
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
66a2d96 to
2641fc5
Compare
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This PR contains a bunch of additional math extensions/functions, such as:
Vector3i,Vector3f,Vector3d,Vector2i,Vector2f, andVector2dPos{2,3}{i,d,f}(ie. convert from mcVec*,BlockPos, and jomlVector*classes to thePos*classes)Int,Long,Float, andDouble. this is to avoid the overhead that comes with boxing & unboxing when usingNumber. theNumberoverload is still provided if, for whatever reason, someone has like aByteorShortor smth and wants to multiply it)pos*Of,vec*Of, andvector*Of(eg.pos3dOf(x, y, z): Pos3d,vec3Of(x, y, z): Vec3,vector3dOf(x, y, z): Vector3d, etc.)toMcVec3d, which is an alias fortoMcVec3, asVec3is namedVec3don yarn)Matrix2f,Matrix2d,Matrix3f,Matrix3d,Matrix3x2f,Matrix3x2d,Matrix4f,Matrix4d,Matrix4x3f, andMatrix4x3dAABB/Boxconvenience extensions forSplit of into a separate PR. See Misc Additions #67.World.convenience extensions for
I just find this slightly cleaner for registering things.
Split off into a separate PR. See Adds extensions for registration #66.Registry, allowing for things like~~