Skip to main content

Module body

Module body 

Source
Expand description

Bodies, camera and movement (yog-body, see its docs): pose and dress entities, disguise and morph them, move the camera, replace the local player’s travel step. Register handlers with Registry::on_body, Registry::on_camera and Registry::on_travel; say which entities to ask about with track and track_type.

Modules§

anim
Clips (.yanim) sampled at a time, and the pose they make: per bone a turn, a move and a scale on top of the bone’s rest.
camera
The camera: where the local player’s view is and how it turns, changed by mods each frame (after vanilla placed it).
format
The source formats: .ymodel (a skeleton of bones with cubes) and .yanim (clips of keyframes). Java model space — pixels, y down, as CubeListBuilder and PartPose (what Blockbench’s “Modded Entity” makes); angles in degrees.
math
The vectors and matrices bodies use are yog-graphics’ own.
model
A .ymodel made ready to draw: its bones in order, each cube baked into the quads vanilla’s ModelPart.Cube makes (same corners, same box-UV, same mirroring) — so a model drawn here looks as one drawn by the game.
morph
Morphing one body into another, as the old Morph mod did: the faces of the first slide, turn and stretch into the faces of the second, while the first’s skin fades into the second’s.
movement
The local player’s movement: a mod may replace a travel step (what the player moves by this tick) — gliding, flying, dashing. Runs on the client, which moves its own player; the server takes the result.
rig
A Rig: a model with clips playing on it, layered, and poses a mod sets by hand on top — evaluated into quads to draw, vanilla parts to pose, and locators to follow.
wire
What the host and a mod say each frame about one entity (see docs/design/yog-body.md): the Frame the host sends, the Ops the mod answers with. Little-endian; strings are a u16 length and UTF-8.

Structs§

BoneOp
What to change about a vanilla part.
BonePose
What a bone does on top of its rest: radians, pixels, a factor.
CameraFrame
The camera as vanilla placed it this frame.
CameraOut
What mods change; each handler gets the last one’s result and adds to it.
Capture
The posed geometry of an entity (entity space, see the design doc).
Clip
An animation, ready.
Frame
One entity, this frame.
Mat4
A 4×4 matrix, column-major: m[col * 4 + row].
Mesh
Quads with one texture.
Model
A model, ready.
Ops
A mod’s answer: operations, written in order.
Pose
Bones by name → what they do. Names a model lacks are the vanilla model’s parts.
Quad
One four-cornered face: corners, their UVs (0–1), its normal.
Rig
A model and what it does.
TravelFrame
The local player before a travel step.
Vec3

Enums§

Anchor
Where a mesh’s vertices are.
Mode
How a mesh is drawn.

Functions§

clip
Clip name of animations id, if registered.
entity_data
What this client was told entity uuid keeps under key (yog_core::Server::set_entity_data); body frames carry it too (Frame::data).
model
Model id, if registered.
register_anims
Registers the clips of id (ns:name) from its compiled .yanim.
register_model
Registers model id (ns:name) from its compiled .ymodel.
set_dimensions
This client’s side of yog_core::Server::entity_set_dimensions: the entity’s own hitbox (Some((width, height, eye height)), blocks) or vanilla’s again. The mod sends who has which (its own packet); the local player moves and collides with it.
track
Asks the body handlers about entity uuid each frame (on), or stops.
track_type
Asks the body handlers about every entity of entity_type (on), or stops.