Class ArmatureItems

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.render.ArmatureItems

public final class ArmatureItems extends Object
Items drawn with an armature. The model comes from the item's model file in a resource pack, assets/<namespace>/items/<item>.json:
{
  "model": {
    "type": "minecraft:special",
    "base": "mymod:item/wand",
    "model": { "type": "coolcatlib:armature", "armature": "mymod:wand", "animation": "idle" }
  }
}
base is an ordinary item model, for its display transforms (how it sits in a hand, a slot, a frame) and its particle texture. animation is a clip looped for every stack; texture swaps the first texture. For more, register a setup: each stack gets its own animator, whose context has the stack.
ArmatureItems.register(MyItems.WAND, animator -> animator.layer("base")
        .drive(ctx -> ctx.stack().has(MyComponents.CHARGED) ? GLOW : IDLE));
  • Method Details

    • register

      public static void register(net.minecraft.world.item.Item item, Consumer<Animator> setup)
      Sets up the animator of every stack of an item. Register while the client sets up.
    • register

      public static void register(Supplier<? extends net.minecraft.world.item.Item> item, Consumer<Animator> setup)
      As register(Item, Consumer), for an item that isn't registered yet.
    • setup

      @Nullable public static @Nullable Consumer<Animator> setup(net.minecraft.world.item.Item item)