Class VanillaModels

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.vanilla.VanillaModels

public final class VanillaModels extends Object
Armatures on vanilla mobs and players, without replacing their models: play clips on their parts, change their parts, wear armatures on them. Set up while the client sets up; works for any living entity drawn by a vanilla-style renderer, including other mods' mobs.
// Emotes for players: clips named after the player's parts (head, body, right_arm, left_arm, right_leg, left_leg).
VanillaModels.player().animations(Armature.of("mymod", "emotes"));
VanillaModels.play(player, "emote", Motion.once("wave"));                // here, on this client
ArmatureControl.play(serverPlayer, "emote", Motion.once("wave"));        // from the server, seen by everyone

// Changes to the player's model.
VanillaModels.player().hide("hat").scale("head", 1.1F);

// A tail on every zombie, swinging on a spring.
VanillaModels.of(EntityType.ZOMBIE).attach("body", Armature.of("mymod", "tail"))
        .offset(0, -10, 2)
        .animate(animator -> animator.spring("tail"));
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable Animator
    animator(net.minecraft.world.entity.Entity entity)
    The entity's animator, once it has been drawn.
    static @Nullable VanillaModel
    find(net.minecraft.world.entity.EntityType<?> type)
     
    static boolean
    hasOverlap(@Nullable net.minecraft.world.entity.LivingEntity entity)
    Whether another mod is animating the entity right now, such as a Better Combat attack: a driver can hold an emote back while it does.
    of(Supplier<? extends net.minecraft.world.entity.EntityType<?>> type)
    As of(EntityType), for a type not registered yet (a RegistryEntry).
    of(net.minecraft.world.entity.EntityType<?> type)
    One kind of mob; the same object every time.
     
    static void
    play(net.minecraft.world.entity.Entity entity, String layer, Motion motion)
     
    static void
    play(net.minecraft.world.entity.Entity entity, Motion motion)
    Plays a clip from the mob's VanillaModel.animations on its base layer.
    Every player (yours and others'), in first person not at all: first-person arms stay vanilla.
    static void
    Makes another mod that animates vanilla models known, so clips share parts with it (see VanillaModel.overlapRule(OverlapRule)).
    static void
    stop(net.minecraft.world.entity.Entity entity, String layer)
    Blends a layer back to vanilla's own animation.

    Methods inherited from class Object

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

    • player

      public static VanillaModel player()
      Every player (yours and others'), in first person not at all: first-person arms stay vanilla.
    • of

      public static VanillaModel of(net.minecraft.world.entity.EntityType<?> type)
      One kind of mob; the same object every time.
    • of

      public static VanillaModel of(Supplier<? extends net.minecraft.world.entity.EntityType<?>> type)
      As of(EntityType), for a type not registered yet (a RegistryEntry).
    • play

      public static void play(net.minecraft.world.entity.Entity entity, Motion motion)
      Plays a clip from the mob's VanillaModel.animations on its base layer.
    • play

      public static void play(net.minecraft.world.entity.Entity entity, String layer, Motion motion)
    • stop

      public static void stop(net.minecraft.world.entity.Entity entity, String layer)
      Blends a layer back to vanilla's own animation.
    • animator

      @Nullable public static @Nullable Animator animator(net.minecraft.world.entity.Entity entity)
      The entity's animator, once it has been drawn.
    • registerOverlap

      public static void registerOverlap(AnimationOverlap overlap)
      Makes another mod that animates vanilla models known, so clips share parts with it (see VanillaModel.overlapRule(OverlapRule)). The player animation mod Better Combat uses is known already.
    • hasOverlap

      public static boolean hasOverlap(@Nullable @Nullable net.minecraft.world.entity.LivingEntity entity)
      Whether another mod is animating the entity right now, such as a Better Combat attack: a driver can hold an emote back while it does.
      layer.drive(ctx -> VanillaModels.hasOverlap(ctx.living()) ? null : IDLE_POSE);
      
    • overlaps

      @Internal public static List<AnimationOverlap> overlaps()
    • find

      @Internal @Nullable public static @Nullable VanillaModel find(net.minecraft.world.entity.EntityType<?> type)