Class ArmatureQueries

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.molang.ArmatureQueries

public final class ArmatureQueries extends Object
The query.* values Molang can read. The Bedrock names animations use most are built in; a mod adds its own before the expressions that use them are first read (resource reload), usually while the client sets up.
ArmatureQueries.register("query.mymod_charge", ctx -> ctx.<Wisp>owner().getCharge());
ArmatureQueries.register("query.is_angry", ctx -> ctx.entity() instanceof Wolf wolf && wolf.isAngry());
Built in: anim_time, anim_length, life_time, delta_time, time_stamp, ground_speed, vertical_speed, modified_move_speed, modified_distance_moved, limb_swing, limb_swing_amount, head_x_rotation, head_y_rotation, body_y_rotation, yaw_speed, is_on_ground, is_in_water, is_in_water_or_rain, is_on_fire, is_sneaking, is_sprinting, is_swimming, is_riding, is_baby, is_moving, is_alive, health, max_health, hurt_time, death_time, scale, time_of_day, moon_phase, distance_from_camera and item_count. A query no one registered reads as 0, with one warning in the log.
  • Method Details

    • register

      public static void register(String name, ToDoubleFunction<ArmatureContext> query)
      Adds or replaces a query.
      Parameters:
      name - "query.name" or "q.name"; the query. is added if it is left out
    • register

      public static void register(String name, ArmatureQueries.Query query)
      Adds or replaces a query that takes arguments, as in q.my_query(2, 'x') (strings read as 0).
    • get

      @Nullable public static @Nullable ArmatureQueries.Query get(String name)
      A query by its whole name, "query.ground_speed"; null if there is none.