Class VanillaModel

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

public final class VanillaModel extends Object
What CoolCatLib adds to one kind of vanilla mob (or the player) without replacing its model: clips played on its parts, changes to its parts, and armatures worn on them. Get it from VanillaModels; every call adds to it, so several mods can add to the same mob. Set it up while the client sets up.
VanillaModels.player()
        .animations(Armature.of("mymod", "emotes"))        // clips by part name: head, right_arm, left_leg...
        .hide("hat")
        .pose((pose, ctx) -> { if (ctx.living().isCrouching()) pose.scale("head", 1.2F); });
VanillaModels.of(EntityType.ZOMBIE).attach("head", Armature.of("mymod", "party_hat")).offset(0, 8, 0);
  • Method Details

    • animations

      public VanillaModel animations(Armature armature)
      Where its clips come from: an armature (a Blockbench model, or a Bedrock .animation.json alone) whose joints are named after the vanilla parts. Clips played on it (VanillaModels.play, ArmatureControl.play, a layer's driver) move the parts of the same names, on top of vanilla's animation: a part a playing clip moves is taken over from vanilla, the rest walk and look around as usual.
    • animate

      public VanillaModel animate(Consumer<Animator> setup)
      Sets up each entity's animator (layers, drivers, listeners) when it is first drawn.
    • pose

      public VanillaModel pose(VanillaPose.Modifier modifier)
      Changes its parts every time it is drawn, after vanilla and the clips.
    • hide

      public VanillaModel hide(String... parts)
      Hides parts (and what hangs from them) for good.
    • scale

      public VanillaModel scale(String part, float scale)
      Scales a part for good.
    • rotate

      public VanillaModel rotate(String part, float x, float y, float z)
      Turns a part further for good, in degrees.
    • translate

      public VanillaModel translate(String part, float x, float y, float z)
      Moves a part for good, in pixels.
    • attach

      public VanillaAttachment attach(String part, Armature armature)
      Wears an armature on a part; set it up through what this returns.
    • when

      public VanillaModel when(Predicate<net.minecraft.world.entity.LivingEntity> filter)
      Applies everything here only to entities that pass, asked every frame (a cosmetic some players own, a mob with a tag). With several filters, all must pass.
    • overlapRule

      public VanillaModel overlapRule(OverlapRule rule)
      What its clips do on parts another mod is moving (overlapping parts, such as Better Combat's attack swings): OverlapRule.YIELD by default.
    • mirrorLeftHanded

      public VanillaModel mirrorLeftHanded(boolean mirror)
      Mirrors its clips for left-handed entities (a left-handed player's swing comes from the left arm): left and right parts swap, and turns and moves flip sideways. Off by default.
    • torsoJointNames

      public VanillaModel torsoJointNames()
      Reads its clips' joints with torso joint names, common in player emote files: torso is the body part, and body moves the whole model. Without this, body is the body part and only root moves the whole model.
    • firstPersonArms

      public VanillaModel firstPersonArms(boolean show)
      For the player: shows your own arms in first person posed as the clips pose them (an emote waves the arm you see), with what you hold, in place of vanilla's first-person hands, while anything plays on the animator. The arms are drawn in the hand pass, so they never clip into walls, and bend, follow other mods' swings and wear their sleeves as in third person.
    • firstPersonArms

      public VanillaModel firstPersonArms(Predicate<Animator> when)
      As firstPersonArms(boolean), shown only while this holds (asked every frame).
    • showsFirstPersonArms

      @Internal public boolean showsFirstPersonArms(Animator animator)
    • mirrorsLeftHanded

      @Internal public boolean mirrorsLeftHanded()
    • usesTorsoJointNames

      @Internal public boolean usesTorsoJointNames()
    • overlapRule

      @Internal public OverlapRule overlapRule()
    • animations

      @Internal @Nullable public @Nullable Armature animations()
    • setups

      @Internal public List<Consumer<Animator>> setups()
    • modifiers

      @Internal public List<VanillaPose.Modifier> modifiers()
    • attachments

      @Internal public List<VanillaAttachment> attachments()
    • test

      @Internal public boolean test(net.minecraft.world.entity.LivingEntity entity)