Class ArmatureContext

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.ArmatureContext

public final class ArmatureContext extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
     
    double
    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.BlockPos
     
    float
    The body's yaw in degrees (an entity's own yaw if it has no body).
    boolean
     
    double
    Seconds since the last update.
    @Nullable net.minecraft.world.entity.Entity
     
    double
    Horizontal speed in blocks per second.
    float
    The head's pitch in degrees, positive looking down.
    float
    How far the head is turned from the body, in degrees, positive to the entity's right.
    float
     
    boolean
     
    @Nullable net.minecraft.world.level.Level
     
    double
    An entity's age in seconds, or time() for anything else.
    float
    How far the limbs have swung in all, vanilla's walk cycle position.
    float
    How hard the limbs swing now, 0 to about 1.
    @Nullable net.minecraft.world.entity.LivingEntity
     
    float
     
    boolean
    Whether it is walking: a living entity's limbs are swinging, or anything else is sliding along.
    boolean
     
    <T> T
    The entity, block entity or item stack, cast to what the caller expects.
    float
     
    net.minecraft.world.phys.Vec3
    Where it is in the world: an entity's feet, a block's centre, or the camera for an item.
    void
    setTempSlot(int slot, double value)
     
    setVariable(String name, double value)
     
    void
    setVariableSlot(int slot, double value)
     
    net.minecraft.world.item.ItemStack
    The stack, for an item; empty for anything else.
    double
    tempSlot(int slot)
     
    double
    Seconds this armature has been animating; stops while the game is paused.
    double
    A Molang variable ("v.charge" or "charge"); 0 until it is set.
    double
    variableSlot(int slot)
     
    double
    Vertical speed in blocks per second, up being positive.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArmatureContext

      public ArmatureContext(Object owner)
  • 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, or time() 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

      public double variable(String name)
      A Molang variable ("v.charge" or "charge"); 0 until it is set.
    • setVariable

      public ArmatureContext setVariable(String name, double value)
    • 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)