Jump to content

How can I program animations to entities?


13772

Recommended Posts

I would like to add animations to my pengiun. No cutsom animations just standard walk and look arround. But I don't know how to do it. I only saw videos for Minecraft 1.16 and the code from those videos doesn't work in 1.19 (I'm a beginner by the way).

This is my code for the animation right now:

@Override
	public void setupAnim(PenguinEntity p_102618_, float p_102619_, float p_102620_, float p_102621_, float p_102622_, float p_102623_) {
		float f = p_102621_ - (float)p_102618_.tickCount;
		float f2 = 1.0F;
		this.body.xRot = ((float)Math.PI / 2F) * (float)Math.PI * 0.35F;
		this.body.y = 9.0F * f2 + 11.0F;
		this.Right_Leg.xRot -= (float)Math.PI * 0.45F;
		this.Left_leg.xRot -= (float)Math.PI * 0.45F;
		if (this.young) {
			this.head.y = 10.0F * f2 - 9.0F;
			this.head.z = -16.0F * f2 - 7.0F;
		} else {
			this.head.y = 10.0F * f2 - 14.0F;
			this.head.z = -16.0F * f2 - 3.0F;
		}

		this.head.xRot += (float)Math.PI * 0.15F;
	}

it almost works, but the feet turn all the time and the head is far away from the model and also turns all the time.

can some one help me please?

Edited by 13772
Link to comment
Share on other sites

I found the solution

@Override
	public void setupAnim(PenguinEntity p_102618_, float p_102619_, float p_102620_, float p_102621_, float p_102622_, float p_102623_) {
		this.head.xRot = p_102623_ * ((float)Math.PI / 180F);
		this.head.yRot = p_102622_ * ((float)Math.PI / 180F);
	}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.