Class ArmatureControl
java.lang.Object
net.ixdarklord.coolcatcanvas.api.armature.ArmatureControl
Animating armatures from the server: everyone who can see the entity, block or held item sees the same thing. Each call
is one small packet to the players tracking it (and to the entity itself if it is a player); players whose client
lacks CoolCatLib are skipped. Called on the client, it acts on that client alone.
ArmatureControl.play(golem, "action", Motion.once("slam")); // a one-off on a layer
ArmatureControl.setVariable(golem, "v.rage", 0.8); // read by Molang in the clips
ArmatureControl.play(level, pos, Motion.once("open")); // a block entity, on its base layer
ArmatureControl.playHeld(player, InteractionHand.MAIN_HAND, "base", Motion.once("swing"));
These are moments, not state: someone who comes into range later doesn't see a clip that started before. Keep
lasting state (a mob being angry, a chest being open) in synced data, and have a layer's driver play from it.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe layer used when none is named, as on the client'sAnimator. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidstatic voidstatic voidplay(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, String layer, Motion motion) static voidstatic voidplayHeld(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.InteractionHand hand, String layer, Motion motion) Plays on the animator of the stack in an entity's hand (as drawn in that hand, in slots, and in first person).static voidsetHeldVariable(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.InteractionHand hand, String variable, double value) static voidsetVariable(net.minecraft.world.entity.Entity entity, String variable, double value) Sets a Molang variable ("v.name") the entity's clips can read.static voidsetVariable(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, String variable, double value) static voidBlends a layer back to its driver, or to rest, over its motion's fade time.static voidstatic voidstop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, String layer, float fadeSeconds)
-
Field Details
-
BASE_LAYER
The layer used when none is named, as on the client'sAnimator.- See Also:
-
-
Method Details
-
play
-
play
-
stop
Blends a layer back to its driver, or to rest, over its motion's fade time. -
stop
-
setVariable
public static void setVariable(net.minecraft.world.entity.Entity entity, String variable, double value) Sets a Molang variable ("v.name") the entity's clips can read. -
play
public static void play(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, Motion motion) -
play
-
play
-
stop
public static void stop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, String layer, float fadeSeconds) -
setVariable
public static void setVariable(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, String variable, double value) -
playHeld
-
setHeldVariable
public static void setHeldVariable(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.InteractionHand hand, String variable, double value)
-