GeckoLib

GeckoLib

155M Downloads

setCustomAnimations doesn't work in latest geckolib Forge 1.16.5

Enthusias720 opened this issue ยท 4 comments

commented

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));
	}
commented

Show the full code of your model (where you attempted using setCustomAnimations)

commented
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));
	}
}
commented

Please test the version I just pushed.

commented

Fixed in above