org.rsmod.game.pathfinder.util.RotationUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rsmod-pathfinder Show documentation
Show all versions of rsmod-pathfinder Show documentation
A custom BFS pathfinder implementation to emulate RS.
The newest version!
package org.rsmod.game.pathfinder.util
internal object RotationUtils {
fun rotate(objectRot: Int, dimensionA: Int, dimensionB: Int): Int = when {
objectRot and 0x1 != 0 -> dimensionB
else -> dimensionA
}
fun rotate(objectRot: Int, blockAccessFlags: Int): Int = when (objectRot) {
0 -> blockAccessFlags
else -> ((blockAccessFlags shl objectRot) and 0xF) or (blockAccessFlags shr (4 - objectRot))
}
}