Class ArmatureContext
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.ArmatureContext
What one armature-driven thing is doing right now: the entity, block entity or item stack it belongs to, its clock, and its
Molang variables. Layer drivers, modifiers, event listeners and Molang queries all read it.
layer.drive(ctx -> ctx.moving() ? Motion.loop("walk") : Motion.loop("idle"));
layer.drive(ctx -> ctx.<Wisp>owner().isCharging() ? Motion.loop("charge") : null);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubleanimTime()The time into the clip being read; only meaningful inside a keyframe expression or an event listener.@Nullable net.minecraft.world.level.block.entity.BlockEntity@Nullable net.minecraft.core.BlockPosblockPos()floatbodyYaw()The body's yaw in degrees (an entity's own yaw if it has no body).booleandead()doubleSeconds since the last update.@Nullable net.minecraft.world.entity.Entityentity()doubleHorizontal speed in blocks per second.floatThe head's pitch in degrees, positive looking down.floatheadYaw()How far the head is turned from the body, in degrees, positive to the entity's right.floathealth()booleaninWater()@Nullable net.minecraft.world.level.Levellevel()doublelifeTime()An entity's age in seconds, ortime()for anything else.floatHow far the limbs have swung in all, vanilla's walk cycle position.floatHow hard the limbs swing now, 0 to about 1.@Nullable net.minecraft.world.entity.LivingEntityliving()floatbooleanmoving()Whether it is walking: a living entity's limbs are swinging, or anything else is sliding along.booleanonGround()<T> Towner()The entity, block entity or item stack, cast to what the caller expects.floatnet.minecraft.world.phys.Vec3position()Where it is in the world: an entity's feet, a block's centre, or the camera for an item.voidsetTempSlot(int slot, double value) setVariable(String name, double value) voidsetVariableSlot(int slot, double value) net.minecraft.world.item.ItemStackstack()The stack, for an item; empty for anything else.doubletempSlot(int slot) doubletime()Seconds this armature has been animating; stops while the game is paused.doubleA Molang variable ("v.charge"or"charge"); 0 until it is set.doublevariableSlot(int slot) doubleVertical speed in blocks per second, up being positive.
-
Constructor Details
-
ArmatureContext
-
-
Method Details
-
owner
public <T> T owner()The entity, block entity or item stack, cast to what the caller expects. -
entity
@Nullable public @Nullable net.minecraft.world.entity.Entity entity() -
living
@Nullable public @Nullable net.minecraft.world.entity.LivingEntity living() -
blockEntity
@Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity() -
stack
public net.minecraft.world.item.ItemStack stack()The stack, for an item; empty for anything else. -
level
@Nullable public @Nullable net.minecraft.world.level.Level level() -
position
public net.minecraft.world.phys.Vec3 position()Where it is in the world: an entity's feet, a block's centre, or the camera for an item. -
blockPos
@Nullable public @Nullable net.minecraft.core.BlockPos blockPos() -
time
public double time()Seconds this armature has been animating; stops while the game is paused. -
deltaTime
public double deltaTime()Seconds since the last update. -
partialTick
public float partialTick() -
animTime
public double animTime()The time into the clip being read; only meaningful inside a keyframe expression or an event listener. -
animLength
public double animLength() -
lifeTime
public double lifeTime()An entity's age in seconds, ortime()for anything else. -
groundSpeed
public double groundSpeed()Horizontal speed in blocks per second. -
verticalSpeed
public double verticalSpeed()Vertical speed in blocks per second, up being positive. -
moving
public boolean moving()Whether it is walking: a living entity's limbs are swinging, or anything else is sliding along. -
limbSwing
public float limbSwing()How far the limbs have swung in all, vanilla's walk cycle position. -
limbSwingAmount
public float limbSwingAmount()How hard the limbs swing now, 0 to about 1. -
onGround
public boolean onGround() -
inWater
public boolean inWater() -
bodyYaw
public float bodyYaw()The body's yaw in degrees (an entity's own yaw if it has no body). -
headYaw
public float headYaw()How far the head is turned from the body, in degrees, positive to the entity's right. -
headPitch
public float headPitch()The head's pitch in degrees, positive looking down. -
health
public float health() -
maxHealth
public float maxHealth() -
dead
public boolean dead() -
variable
A Molang variable ("v.charge"or"charge"); 0 until it is set. -
setVariable
-
variableSlot
public double variableSlot(int slot) -
setVariableSlot
public void setVariableSlot(int slot, double value) -
tempSlot
public double tempSlot(int slot) -
setTempSlot
public void setTempSlot(int slot, double value)
-