Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.content.entity.model

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
EntityModelDefinitionrecordA box model for a mod mob, in the game's model space: units are pixels (1/16 block), y grows downwards, and a root part with pivot y 24 stands on the ground.
EntityModelDefinition.BuilderclassBuilds an EntityModelDefinition.
KeyframeAnimationrecordA keyframe animation of a mob's box model, like Blockbench's animations: per part and channel, values at points in time, blended in between.
KeyframeAnimation.BuilderclassBuilds a KeyframeAnimation.
KeyframeAnimation.ChannelrecordThe keyframes of one part and target, in time order.
KeyframeAnimation.InterpolationenumHow values are blended between two keyframes.
KeyframeAnimation.KeyframerecordA value at a point in time.
KeyframeAnimation.TargetenumWhat a channel changes.
KeyframeAnimation.TriggerenumWhen an animation plays.
ModelBoxrecordA textured cuboid of a model part, in model pixels (1/16 block) relative to the part's pivot.
ModelPartDefinitionrecordA named part of an entity model: boxes around a pivot, an optional parent part, a rest rotation in degrees, and an animation.
ModelPartDefinition.BuilderclassBuilds a ModelPartDefinition.
PartAnimationenumHow a model part moves on its own while the mob is drawn.

EntityModelDefinition​

record · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public record EntityModelDefinition(int textureWidth, int textureHeight, List<ModelPartDefinition> parts, Map<String,KeyframeAnimation> animations)

A box model for a mod mob, in the game's model space: units are pixels (1/16 block), y grows downwards, and a root part with pivot y 24 stands on the ground. This is the layout that Blockbench's "Modded Entity" projects use. The texture is the mob's texture with textureWidth × textureHeight pixels.

ComponentTypeDescription
textureWidthinttexture width in pixels
textureHeightinttexture height in pixels
partsList<ModelPartDefinition>the parts; parents come before their children
animationsMap<String,KeyframeAnimation>keyframe animations by name ([a-z0-9_]+), in declaration order
Constant or fieldTypeDescription
MAX_ON_DEMAND_ANIMATIONSintAt most this many KeyframeAnimation.Trigger.ON_DEMAND animations per model.

onDemandAnimations()​

public List<String> onDemandAnimations()

Since 0.1.0-alpha.4 or earlier

Names of the KeyframeAnimation.Trigger.ON_DEMAND animations, in declaration order.

Returns List<String>

builder(int, int)​

public static EntityModelDefinition.Builder builder(int textureWidth, int textureHeight)

Since 0.1.0-alpha.4 or earlier

A builder for a model using a textureWidth × textureHeight texture.

ParameterTypeDescription
textureWidthint—
textureHeightint—

Returns EntityModelDefinition.Builder

EntityModelDefinition.Builder​

class · Since 0.1.0-alpha.4 or earlier

public static final class Builder

Builds an EntityModelDefinition.

part(String, Consumer<ModelPartDefinition.Builder>)​

public EntityModelDefinition.Builder part(String name, Consumer<ModelPartDefinition.Builder> part)

Since 0.1.0-alpha.4 or earlier

Adds a part configured by part.

ParameterTypeDescription
nameString—
partConsumer<ModelPartDefinition.Builder>—

Returns EntityModelDefinition.Builder

animation(String, KeyframeAnimation)​

public EntityModelDefinition.Builder animation(String name, KeyframeAnimation animation)

Since 0.1.0-alpha.4 or earlier

Adds a keyframe animation called name; KeyframeAnimation.Trigger.ON_DEMAND ones are started by name with MobView.playAnimation.

ParameterTypeDescription
nameString—
animationKeyframeAnimation—

Returns EntityModelDefinition.Builder

build()​

public EntityModelDefinition build()

Since 0.1.0-alpha.4 or earlier

Creates the model; invalid parts throw IllegalArgumentException.

Returns EntityModelDefinition

KeyframeAnimation​

record · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public record KeyframeAnimation(float lengthSeconds, boolean looping, KeyframeAnimation.Trigger trigger, List<KeyframeAnimation.Channel> channels)

A keyframe animation of a mob's box model, like Blockbench's animations: per part and channel, values at points in time, blended in between. The values are added to the part's rest pose.

ComponentTypeDescription
lengthSecondsfloatlength in seconds
loopingbooleanwhether it starts over at the end; otherwise an Trigger.ON_DEMAND animation ends there and the others hold their last keyframe
triggerKeyframeAnimation.Triggerwhen it plays
channelsList<KeyframeAnimation.Channel>the animated values; at most one channel per part and target

builder(float)​

public static KeyframeAnimation.Builder builder(float lengthSeconds)

Since 0.1.0-alpha.4 or earlier

A builder for an animation lengthSeconds long that plays when the server starts it.

ParameterTypeDescription
lengthSecondsfloat—

Returns KeyframeAnimation.Builder

KeyframeAnimation.Builder​

class · Since 0.1.0-alpha.4 or earlier

public static final class Builder

Builds a KeyframeAnimation.

looping()​

public KeyframeAnimation.Builder looping()

Since 0.1.0-alpha.4 or earlier

Starts over at the end.

Returns KeyframeAnimation.Builder

trigger(KeyframeAnimation.Trigger)​

public KeyframeAnimation.Builder trigger(KeyframeAnimation.Trigger trigger)

Since 0.1.0-alpha.4 or earlier

When the animation plays; Trigger.ON_DEMAND by default.

ParameterTypeDescription
triggerKeyframeAnimation.Trigger—

Returns KeyframeAnimation.Builder

smooth()​

public KeyframeAnimation.Builder smooth()

Since 0.1.0-alpha.4 or earlier

Blends the keyframes added after this call along smooth curves instead of straight lines.

Returns KeyframeAnimation.Builder

rotation(String, float, float, float, float)​

public KeyframeAnimation.Builder rotation(String part, float time, float x, float y, float z)

Since 0.1.0-alpha.4 or earlier

Rotates part by x, y, z degrees at time seconds.

ParameterTypeDescription
partString—
timefloat—
xfloat—
yfloat—
zfloat—

Returns KeyframeAnimation.Builder

position(String, float, float, float, float)​

public KeyframeAnimation.Builder position(String part, float time, float x, float y, float z)

Since 0.1.0-alpha.4 or earlier

Moves part by x, y, z model pixels (y up) at time seconds.

ParameterTypeDescription
partString—
timefloat—
xfloat—
yfloat—
zfloat—

Returns KeyframeAnimation.Builder

scale(String, float, float, float, float)​

public KeyframeAnimation.Builder scale(String part, float time, float x, float y, float z)

Since 0.1.0-alpha.4 or earlier

Scales part by x, y, z (1 keeps the size) at time seconds.

ParameterTypeDescription
partString—
timefloat—
xfloat—
yfloat—
zfloat—

Returns KeyframeAnimation.Builder

keyframe(String, KeyframeAnimation.Target, float, float, float, float, KeyframeAnimation.Interpolation)​

public KeyframeAnimation.Builder keyframe(String part, KeyframeAnimation.Target target, float time, float x, float y, float z, KeyframeAnimation.Interpolation interpolation)

Since 0.1.0-alpha.4 or earlier

Adds a keyframe with every detail given.

ParameterTypeDescription
partString—
targetKeyframeAnimation.Target—
timefloat—
xfloat—
yfloat—
zfloat—
interpolationKeyframeAnimation.Interpolation—

Returns KeyframeAnimation.Builder

build()​

public KeyframeAnimation build()

Since 0.1.0-alpha.4 or earlier

Creates the animation; invalid values throw IllegalArgumentException.

Returns KeyframeAnimation

KeyframeAnimation.Channel​

record · Since 0.1.0-alpha.4 or earlier

public static record Channel(String part, KeyframeAnimation.Target target, List<KeyframeAnimation.Keyframe> keyframes)

The keyframes of one part and target, in time order.

ComponentTypeDescription
partStringmodel part name
targetKeyframeAnimation.Targetwhat the keyframes change
keyframesList<KeyframeAnimation.Keyframe>the keyframes, sorted by time

KeyframeAnimation.Interpolation​

enum · Since 0.1.0-alpha.4 or earlier

public static enum Interpolation

How values are blended between two keyframes.

ConstantDescription
LINEARIn a straight line.
SMOOTHAlong a smooth curve through the neighbouring keyframes (Catmull-Rom).

KeyframeAnimation.Keyframe​

record · Since 0.1.0-alpha.4 or earlier

public static record Keyframe(float time, float x, float y, float z, KeyframeAnimation.Interpolation interpolation)

A value at a point in time.

ComponentTypeDescription
timefloatseconds from the start, 0..lengthSeconds
xfloatvalue for x
yfloatvalue for y
zfloatvalue for z
interpolationKeyframeAnimation.Interpolationhow the value is reached from the previous keyframe

KeyframeAnimation.Target​

enum · Since 0.1.0-alpha.4 or earlier

public static enum Target

What a channel changes.

ConstantDescription
ROTATIONRotation in degrees around x, y and z.
POSITIONOffset in model pixels; y grows upwards, as in Blockbench.
SCALESize factor per axis; 1 keeps the size.

KeyframeAnimation.Trigger​

enum · Since 0.1.0-alpha.4 or earlier

public static enum Trigger

When an animation plays.

ConstantDescription
ALWAYSAll the time, from when the mob appears; usually looping (idle breathing, a spinning part).
WHILE_MOVINGWhile the mob moves, faster the faster it moves; usually looping (walk cycle, wing beats).
ON_DEMANDWhen the server starts it with MobView.playAnimation; every client that sees the mob plays it from the start (attack, wave).

ModelBox​

record · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public record ModelBox(int u, int v, float x, float y, float z, float width, float height, float depth, boolean mirror)

A textured cuboid of a model part, in model pixels (1/16 block) relative to the part's pivot.

ComponentTypeDescription
uinttexture x of the box's net (the game's cube unwrap layout)
vinttexture y of the box's net
xfloatlowest corner x
yfloatlowest corner y (y grows downwards in models)
zfloatlowest corner z
widthfloatsize along x
heightfloatsize along y
depthfloatsize along z
mirrorbooleanmirrors the texture horizontally

ModelPartDefinition​

record · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public record ModelPartDefinition(String name, Optional<String> parent, float pivotX, float pivotY, float pivotZ, float rotationX, float rotationY, float rotationZ, List<ModelBox> boxes, PartAnimation animation)

A named part of an entity model: boxes around a pivot, an optional parent part, a rest rotation in degrees, and an animation.

ComponentTypeDescription
nameStringpart name, unique in the model
parentOptional<String>parent part, or empty for the root
pivotXfloatpivot x relative to the parent's pivot (model pixels)
pivotYfloatpivot y (24 is the ground for root parts, y grows downwards)
pivotZfloatpivot z
rotationXfloatrest rotation around x, degrees
rotationYfloatrest rotation around y, degrees
rotationZfloatrest rotation around z, degrees
boxesList<ModelBox>the part's cuboids
animationPartAnimationhow it moves

ModelPartDefinition.Builder​

class · Since 0.1.0-alpha.4 or earlier

public static final class Builder

Builds a ModelPartDefinition.

parent(String)​

public ModelPartDefinition.Builder parent(String parent)

Since 0.1.0-alpha.4 or earlier

Attaches the part to parent; its pivot becomes relative to the parent's.

ParameterTypeDescription
parentString—

Returns ModelPartDefinition.Builder

pivot(float, float, float)​

public ModelPartDefinition.Builder pivot(float x, float y, float z)

Since 0.1.0-alpha.4 or earlier

The point the part turns around, relative to the parent's pivot (model pixels, y down).

ParameterTypeDescription
xfloat—
yfloat—
zfloat—

Returns ModelPartDefinition.Builder

rotation(float, float, float)​

public ModelPartDefinition.Builder rotation(float x, float y, float z)

Since 0.1.0-alpha.4 or earlier

Rest rotation in degrees.

ParameterTypeDescription
xfloat—
yfloat—
zfloat—

Returns ModelPartDefinition.Builder

box(int, int, float, float, float, float, float, float)​

public ModelPartDefinition.Builder box(int u, int v, float x, float y, float z, float width, float height, float depth)

Since 0.1.0-alpha.4 or earlier

Adds a box whose texture net starts at u, v.

ParameterTypeDescription
uint—
vint—
xfloat—
yfloat—
zfloat—
widthfloat—
heightfloat—
depthfloat—

Returns ModelPartDefinition.Builder

mirroredBox(int, int, float, float, float, float, float, float)​

public ModelPartDefinition.Builder mirroredBox(int u, int v, float x, float y, float z, float width, float height, float depth)

Since 0.1.0-alpha.4 or earlier

Adds a box with a mirrored texture.

ParameterTypeDescription
uint—
vint—
xfloat—
yfloat—
zfloat—
widthfloat—
heightfloat—
depthfloat—

Returns ModelPartDefinition.Builder

animation(PartAnimation)​

public ModelPartDefinition.Builder animation(PartAnimation animation)

Since 0.1.0-alpha.4 or earlier

How the part moves on its own; PartAnimation.NONE by default.

ParameterTypeDescription
animationPartAnimation—

Returns ModelPartDefinition.Builder

PartAnimation​

enum · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public enum PartAnimation

How a model part moves on its own while the mob is drawn.

ConstantDescription
NONEKeeps its pose.
HEADTurns with the mob's head (look direction).
WALK_SWINGSwings forward and back while walking (a leg or arm).
WALK_SWING_OPPOSITESwings opposite to WALK_SWING.
BOBMoves gently up and down all the time.
SPINSpins around its vertical axis all the time.
Buy me a coffee