Skip to content

Item Rendering

MehVahdJukaar edited this page Jul 25, 2026 · 1 revision

Item Rendering and Animations

Interfaces you implement on an item to change how it's held, animated and drawn.

Vanilla decides all of this for you. These hooks let an item pose the player's arms, move itself in first person, render like a spyglass (in player space rather than hand space), or use a fully custom renderer. It's how telescopes, flutes and lanterns end up not looking like a stick.

Getting Started

Implement the interfaces you need on the item, or attach one provider object per item with the interface's attach methods if you can't touch the item class:

public class MyItem extends Item implements IFirstPersonAnimationProvider, IThirdPersonAnimationProvider {

    @Override
    public UseAnim getUseAnimation(ItemStack stack) {
        return UseAnim.NONE;   // so vanilla doesn't animate on top of yours
    }

    @Override
    public void animateItemFirstPerson(Player player, ItemStack stack, InteractionHand hand, HumanoidArm arm,
                                       PoseStack poseStack, float partialTicks, float pitch,
                                       float attackAnim, float handHeight) {
        if (player.isUsingItem() && player.getUsedItemHand() == hand) {
            float t = stack.getUseDuration(player) - (player.getUseItemRemainingTicks() - partialTicks + 1);
            poseStack.translate(0, 0, t * 0.04F);
        }
    }

    @Override
    public <T extends LivingEntity> boolean poseRightArm(ItemStack stack, HumanoidModel<T> model, T entity, HumanoidArm mainHand) {
        model.rightArm.yRot = -10;
        return true;   // true means you handled the pose
    }
}

Example: ItemAnimationExample

The interfaces

Interface For
IFirstPersonAnimationProvider Move the item in first person
IThirdPersonAnimationProvider Pose the player's arms
IFirstPersonSpecialItemRenderer / IThirdPersonSpecialItemRenderer Render in player space instead of hand space, like the spyglass
ICustomItemRendererProvider A full custom renderer for the item (BEWLR on Forge, its Fabric equivalent)
IItemDecoratorRenderer Draw over the item's inventory slot
ILeftClickReact React to a left click, which vanilla doesn't give items

Ready made animations live in api/client/anim: SwingAnimation, SwayingAnimation, PendulumAnimation, for things that hang or swing as you move.

Clone this wiki locally