setCustomAnimations doesn't work in latest geckolib Forge 1.16.5
Enthusias720 opened this issue ยท 4 comments
This method does not work:
@Override
public void setCustomAnimations(KobaldEntity animatable, int instanceId, AnimationEvent animationEvent) {
super.setCustomAnimations(animatable, instanceId, animationEvent);
IBone head = this.getAnimationProcessor().getBone("head");
EntityModelData extraData = (EntityModelData) animationEvent.getExtraDataOfType(EntityModelData.class).get(0);
head.setRotationX(extraData.headPitch * ((float) Math.PI / 180F));
head.setRotationY(extraData.netHeadYaw * ((float) Math.PI / 180F));
}
However, the old method does work:
@Override
public void setLivingAnimations(KobaldEntity animatable, Integer instanceId, AnimationEvent animationEvent) {
super.setLivingAnimations(animatable, instanceId, animationEvent);
IBone head = this.getAnimationProcessor().getBone("head");
EntityModelData extraData = (EntityModelData) animationEvent.getExtraDataOfType(EntityModelData.class).get(0);
head.setRotationX(extraData.headPitch * ((float) Math.PI / 180F));
head.setRotationY(extraData.netHeadYaw * ((float) Math.PI / 180F));
}
public class KobaldModel extends AnimatedGeoModel<KobaldEntity> {
@Override
public ResourceLocation getAnimationFileLocation(KobaldEntity animatable) {
return new ResourceLocation("saotest", "animations/kobald.animation.json");
}
@Override
public ResourceLocation getModelLocation(KobaldEntity animatable) {
return new ResourceLocation("saotest", "geo/kobald.geo.json");
}
@Override
public ResourceLocation getTextureLocation(KobaldEntity animatable) {
return new ResourceLocation("saotest", "textures/entities/kobald.png");
}
@Override
public void setCustomAnimations(KobaldEntity animatable, int instanceId, AnimationEvent animationEvent) {
super.setCustomAnimations(animatable, instanceId, animationEvent);
IBone head = this.getAnimationProcessor().getBone("head");
EntityModelData extraData = (EntityModelData) animationEvent.getExtraDataOfType(EntityModelData.class).get(0);
head.setRotationX(extraData.headPitch * ((float) Math.PI / 180F));
head.setRotationY(extraData.netHeadYaw * ((float) Math.PI / 180F));
}
}