#Player Animations

7 messages · Page 1 of 1 (latest)

gusty dune
#

So I'm trying to create a use animation for my custom item and I can't find anything online that shows how to make a player animation and I have no idea how Mojang currently does it. Can anyone point me in a direction? This is the animation:
(Pls ping on reply 😁)

warm tinsel
#

I have the same issue. Cant find a guide.

But a hint i got is to use blockbench, and somehow

  • magically get a player model to rig
  • export the animations data
  • magically use mixin to replace the use animation
  • the method that controls the use animation is in magic path

all the magic part are gaps left to be filled by the lack of documentations

night venture
#

Easiest way i just found is

#
public class PlayerModelMixin<T extends LivingEntity> {

    @SuppressWarnings("all")
    @Inject(at = @At("TAIL"), method = "setupAnim(Lnet/minecraft/world/entity/LivingEntity;FFFFF)V")
    private void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch, CallbackInfo info) {
        if (!(pEntity instanceof Player player))
            return;

        PlayerModel<T> model = (PlayerModel<T>) (Object) this;
        if (!Minecraft.getInstance().options.getCameraType().isFirstPerson()) {
            if (player.getItemInHand(InteractionHand.MAIN_HAND).is(ItemRegistrar.MJOLNIR.get())) {
                model.leftArm.zRot = (float) Math.toRadians(90.0F);
            }
        }
    }
}```
#

As a client mixin

warm tinsel