KattonContextApi
BonePositionMode
BoneOrientationMode
enum class BoneOrientationModeDetermines which facing direction the returned [ExecutionContext] uses.
BoneOrientationMode.BONE
BONE,Bone's local rotation + entity rotation (approximate world-space facing).
BoneOrientationMode.ENTITY
ENTITY,Entity's natural yaw/pitch.
BoneOrientationMode.WORLD
WORLDDefault — [Vec2.ZERO] (no rotation).
computeBoneWorldPos
fun Entity.computeBoneWorldPos(bone: ModelPart, partialTick: Float = 1.0f): Vec3Computes the world-space position of a [ModelPart] bone on the given [entity].
The bone offset (pixels, 1/16 block) is rotated by the entity's yaw and added to the entity's interpolated position.
Call AFTER animations have been applied ([net.minecraft.client.animation.KeyframeAnimation.apply]), so that [ModelPart.x]/[ModelPart.y]/[ModelPart.z] reflect the animated pose.
createBoneExecution
fun Entity.createBoneExecution(modelPart: ModelPart, positionMode: BonePositionMode = BonePositionMode.BONE, orientationMode: BoneOrientationMode = BoneOrientationMode.WORLD): ExecutionContextCreates an [ExecutionContext] positioned at a [ModelPart] bone on an [entity].
Combines [BonePositionMode] and [BoneOrientationMode] to set the context's pos and rotation. Use the returned [ExecutionContext] to execute commands at the bone's world position, or read pos / rotation directly for custom effects.
On a dedicated client (multiplayer), the server reference may be unavailable — in that case the returned context has position/rotation set but no command execution capability.
Parameters
| Parameter | Description |
|---|---|
modelPart | direct [ModelPart] reference (e.g. model.rightArm, model.head) |
positionMode | [BonePositionMode.BONE] or [BonePositionMode.ENTITY] |
orientationMode | [BoneOrientationMode.BONE], [BoneOrientationMode.ENTITY], or [BoneOrientationMode.WORLD] |
