Started by
Bronze
on
Topic category: Help with Minecraft modding (Java Edition)
So, im making exosuit for Player, like a robot that he's piloting but the problem is that Legs are really mad, they swing really fast and i would want to know if i can somehow make this animation slower, or atleast make my own animation.
Actually nevermind, I searched the code and fixed it
Lol show me the code I wanna see.
I always wanted mob animations.
how did you slow it down i need to do that
I need to know how to slow down the animation how did you do it? like where in the code?
I figured it out too a while back, but I'll help out too because I already see enough topics that end the same way.
In the code for the custom entities you'll wanna scroll to the very bottom. Down there, you will see all the different animations that look like this for example;
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
}
Changing the speed is simple: edit the FIRST value of the swing animation. as an example, let's just use the leg rotations since that is what we are trying to fix.
in that section of the code, edit the number value to a lower or higher value respectively for the speed of the animation.
Edit this here
V
this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
Afterwards, it should look something like this:
this.rightleg.rotateAngleX = MathHelper.cos(f * 0.5F) * 1.0F * f1;
save the code, run the test environment, and you should see some results!
As a bonus:
this.rightleg.rotateAngleX = MathHelper.cos(f * 0.5F) * 1.0F * f1;
^
That there changes the amount of rotation!
And there you have it! Hope this helps!
Sorry if the arrows are a little too far to the left, but they should be pointing to the (f * 1.0F) parts of the code.
Also good thing would be to save the code of animation because everytime while you would want to unlock the code you will need to type it again what is, pretty hard with big models. You can copy it by selecting it and doing ctrl+c
That would be true. There has been instances where I had custom code for the animations of mobs pre MCreator 1.9.1, and it would just get deleted by the code regeneration process. I had mobs with over 20 different moving parts that would get undone. It was some of the largest hassles I had to deal with, not gonna lie. :P
thank you
what file am i supposed to edit to do this?
I can't even locate this part lmao
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
}
I can't find this code element in any way, there is only one object in fashion and there is no animation item in all the proposed codes
like many people here i also had trouble finding the animation code, but i did find it.
You have to open any modded element's generated code, then on the top click on the folder with your mod's name > entity > renderer > the mob's renderer file
then as instructed, the code needed is at the very bottom