Skip to content

Java Library API Reference

jellymods edited this page Sep 19, 2026 · 1 revision

API Reference

This is mostly for internal housekeeping and documentation, mostly unnecessary for using the library.

Member
List<Limb<?>> getLimbs() Return limbs in a stable order that defines part order, which the model's segment-name array must match
tickMarionette() solves every limb and ticks its parts. Call from tick(), after setting targets
getMarionetteParts() every part of every limb, flattened. Return it from your getParts() override
removeMarionette(reason) removes every part. Call from your remove(...) override
getMarionetteBoundingBoxForCulling(entity) the entity's box unioned with every part's. Use it in a renderer's shouldRender / getBoundingBoxForCulling

Everything above is automatically generated by the Blockbench plugin's exporter, but it's useful to know what they do. See Creating an Entity.

Limb<T extends MarionettePart<?>>

A chain plus its animator. Mostly talk to animator() after building.

Member
Limb.builder(parent) builder for a chain of plain MarionetteParts.
Limb.builder(parent, factory) builder for a chain of a MarionettePart subclass. factory is (parent, sizeXZ, sizeY, length) -> part
parts() parts array, index 0 = root end
animator() the FabrikAnimator driving it

Limb.Builder

Member
segment(sizeXZ, sizeY, length) append one segment. Chain calls for tapering or mixed lengths
segments(count, sizeXZ, sizeY, length) append count identical segments
followRootOnly(boolean) see FabrikAnimator.setFollowRootOnly
root(Vec3) see FabrikAnimator.setRoot
build() throws IllegalStateException if no segments were added

sizeXZ and sizeY are the segment's hitbox in blocks; length is how far the segment spans along its own direction, also in blocks.

FabrikAnimator

Member
setFabrikTarget(Vec3) / getFabrikTarget() the world-space point the tip reaches for
tickMultipart() one solve, then tick() on every part. tickMarionette() calls this for you
chainRoot() the root end of the first segment
chainEndPos() the tip of the last segment, the point that's chasing the target
setRoot(Vec3) pin the chain's root. Defaults to the owning entity's position()
setFollowRootOnly(boolean) segments follow the root and ignore the target. For worms, tails, trailing cloth, etc.
primeMultipart(Vec3 dir) lay the chain straight along dir from the current root, discarding its shape. Call before the solve to bias which way it folds
primeMultipart(Vec3[] dirs) same, with one direction per segment, index-aligned with parts()

MarionettePart<T extends Entity>

A singlesegment. A Forge PartEntity, directly instantiable; subclass it when a segment needs its own hit, interaction, tick behavior etc.

Member
getLength() segment length in blocks, fixed at construction
getPartDirection() / setPartDirection(Vec3) unit direction along the segment. The setter normalizes
position() the segment's centre, including any position set this tick but not yet committed
setPartPos(Vec3) set the pending centre
getRootPos() / setRootPos(Vec3) the parent-side end
getEndPos() / setEndPos(Vec3) the tip end
tick() commit the pending position and sync previous-position fields for interpolation

Out of the box a part is fire-immune, never saved to disk, forwards hurt and interact to its parent entity, and reports is(parent) == true so parent and part count as the same entity for targeting.

MarionetteModel<T extends Entity>

Extend it, pass segment names in part order. It renders each part and, in setupAnim, positions and rotates each model part from its matching MarionettePart:

  • position from the part's offset to the entity, scaled by 16 and with Y flipped against the (0, 24, 0) rest pose, interpolated by partial ticks
  • yaw and pitch from the direction vector; roll is always zero
  • the Y offset also subtracts half the part's hitbox height, which centres the geometry vertically on the segment

Segment names are resolved with root.getChild(name), a direct lookup, so every segment part must be a top-level child of the model root.

Networking

MarionettePart.hurt and interact are client-side hooks, so they forward to the server over Marionette's own channel (ModMessages / MultipartEntityMessage), which the library registers during FMLCommonSetup. Nothing to do if you depend on the mod jar.

Clone this wiki locally