Item AzAnimator Basics

The AzItemAnimator is a framework specifically designed to handle animations for ItemStack instances in AzureLib. By extending the base functionality of AzAnimator, it provides an easy-to-use API for creating animation systems tailored to items.

Overview of AzItemAnimator

The AzItemAnimator builds on the generic animation system outlined in the AzAnimator but focuses explicitly on animating item stacks. It simplifies item animation setup and configuration by abstracting much of the common functionality.

Key Features

  • Purpose-built for animating ItemStack instances.
  • Maintains compatibility with AzureLib's baked animation and MoLang systems.
  • Fully integrates with the AzAnimator APIs, including animation controllers and context handling.

Constructor

The AzItemAnimator requires a configuration object (AzAnimatorConfig) to initialize:

public AzItemAnimator(AzAnimatorConfig config) { super(config); }

To simplify setup, you can use the defaultConfig for common scenarios:

public YourItemAnimator() { super(AzAnimatorConfig.defaultConfig()); }

Example: YourItemAnimator

Below is a working example of a custom animator for an animated item using the AzItemAnimator.

java public class YourItemAnimator extends AzItemAnimator {
private static final ResourceLocation ANIMATIONS = CommonMod.modResource(
"animations/item/youritem.animation.json"
);
public YourItemAnimator() {
super(AzAnimatorConfig.defaultConfig());
}
@Override
public void registerControllers(AzAnimationControllerContainer<ItemStack> animationControllerContainer) {
animationControllerContainer.add(
AzAnimationController.builder(this, "base_controller")
.build()
);
}
@Override
public @NotNull ResourceLocation getAnimationLocation(ItemStack animatable) {
return ANIMATIONS;
}
}