Jump to content

[1.7.10] [Forge] [SOLVED] Custom Mob Animation Help


Recommended Posts

I'm having trouble with my mob's walking animation. I want the top part of its leg's to be angled and move and the bottom part to give with the top part. But they both keep spinning.


Here is my code

package common.zeroquest.client.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;

import org.lwjgl.opengl.GL11;

import common.zeroquest.entity.EntityRedZertum;
import common.zeroquest.entity.EntityZertum;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ModelZertum extends ModelBase
    ModelRenderer Nose;
    ModelRenderer Ear2;
    ModelRenderer Ear1;
    ModelRenderer Head;
    ModelRenderer LeftHindLeg2;
    ModelRenderer LeftHindLeg1;
    ModelRenderer RightHindLeg2;
    ModelRenderer RightHindLeg1;
    ModelRenderer Mane1;
    ModelRenderer RightLeg;
    ModelRenderer LeftLeg;
    ModelRenderer Tail1;
    ModelRenderer Mane2;
    ModelRenderer Torso;
    ModelRenderer Tail2;
    ModelRenderer Neck;
  public ModelZertum()
    textureWidth = 128;
    textureHeight = 64;
    Nose = new ModelRenderer(this, 25, 27);
    Nose.addBox(-1.5F, 0F, -3F, 3, 3, 4);
    Nose.setRotationPoint(0F, 2.5F, -15F);
    Nose.setTextureSize(64, 32);
    Nose.mirror = true;
    setRotation(Nose, 0F, 0F, 0F);
    Ear2 = new ModelRenderer(this, 40, 28);
    Ear2.addBox(-1F, -3F, 0F, 2, 3, 1);
    Ear2.setRotationPoint(2F, -0.5F, -10.5F);
    Ear2.setTextureSize(64, 32);
    Ear2.mirror = true;
    setRotation(Ear2, 0F, 0F, 0F);
    Ear1 = new ModelRenderer(this, 40, 28);
    Ear1.addBox(-1F, -3F, 0F, 2, 3, 1);
    Ear1.setRotationPoint(-2F, -0.5F, -10.5F);
    Ear1.setTextureSize(64, 32);
    Ear1.mirror = true;
    setRotation(Ear1, 0F, 0F, 0F);
    Head = new ModelRenderer(this, 25, 15);
    Head.addBox(-3F, -0.5F, -14F, 6, 6, 5);
    Head.setRotationPoint(-0.5F, 6F, -3F);
    Head.setTextureSize(64, 32);
    Head.mirror = true;
    setRotation(Head, 0F, 0F, 0F);
      LeftHindLeg1 = new ModelRenderer(this, 11, 18);
      LeftHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
      LeftHindLeg1.setRotationPoint(1.5F, 13F, 5F);
      LeftHindLeg1.setTextureSize(128, 64);
      LeftHindLeg1.mirror = true;
      setRotation(LeftHindLeg1, -0.2974289F, 0F, 0F);
      LeftHindLeg2 = new ModelRenderer(this, 9, 44);
      LeftHindLeg2.addBox(-1F, 0F, -1F, 2, 8, 2);
      LeftHindLeg2.setRotationPoint(0F, 3F, -1.5F);
      LeftHindLeg2.setTextureSize(128, 64);
      LeftHindLeg2.mirror = true;
      setRotation(LeftHindLeg2, 0F, 0F, 0F);
      RightHindLeg1 = new ModelRenderer(this, 11, 31);
      RightHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
      RightHindLeg1.setRotationPoint(-2.5F, 13F, 5F);
      RightHindLeg1.setTextureSize(128, 64);
      RightHindLeg1.mirror = true;
      setRotation(RightHindLeg1, -0.2974289F, 0F, 0F);
      RightHindLeg2 = new ModelRenderer(this, 0, 44);
      RightHindLeg2.addBox(-1F, 0F, -1F, 2, 8, 2);
      RightHindLeg2.setRotationPoint(0F, 3F, -1.5F);
      RightHindLeg2.setTextureSize(128, 64);
      RightHindLeg2.mirror = true;
      setRotation(RightHindLeg2, 0F, 0F, 0F);
      Mane1 = new ModelRenderer(this, 43, 0);
      Mane1.addBox(-3F, -3F, -3F, 6, 6, 7);
      Mane1.setRotationPoint(-0.5F, 14F, -3F);
      Mane1.setTextureSize(128, 64);
      Mane1.mirror = true;
      setRotation(Mane1, 1.496439F, 0F, 0F);
      Neck = new ModelRenderer(this, 0, 0);
      Neck.addBox(-2.5F, -12F, -4F, 4, 7, 4);
      Neck.setRotationPoint(0.5F, 0F, 0F);
      Neck.setTextureSize(64, 32);
      Neck.mirror = true;
      setRotation(Neck, -0.6015813F, 0F, 0F);
      Mane2 = new ModelRenderer(this, 18, 0);
      Mane2.addBox(-2.5F, -7F, -3.6F, 5, 6, 7);
      Mane2.setRotationPoint(0F, 0F, 0F);
      Mane2.setTextureSize(64, 32);
      Mane2.mirror = true;
      setRotation(Mane2, -0.34653F, 0F, 0F);
      RightLeg = new ModelRenderer(this, 0, 30);
      RightLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
      RightLeg.setRotationPoint(-3F, 14F, -4F);
      RightLeg.setTextureSize(128, 64);
      RightLeg.mirror = true;
      setRotation(RightLeg, 0F, 0F, 0F);
      LeftLeg = new ModelRenderer(this, 0, 16);
      LeftLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
      LeftLeg.setRotationPoint(2F, 14F, -4F);
      LeftLeg.setTextureSize(128, 64);
      LeftLeg.mirror = true;
      setRotation(LeftLeg, 0F, 0F, 0F);
      Tail1 = new ModelRenderer(this, 91, 0);
      Tail1.addBox(-1.5F, 0F, -1F, 4, 8, 4);
      Tail1.setRotationPoint(-1F, 14F, 5F);
      Tail1.setTextureSize(128, 64);
      Tail1.mirror = true;
      setRotation(Tail1, 1.315962F, 0F, 0F);
      Tail2 = new ModelRenderer(this, 110, 0);
      Tail2.addBox(-1.5F, 0F, -1F, 3, 8, 3);
      Tail2.setRotationPoint(0.5F, 6F, 0F);
      Tail2.setTextureSize(64, 32);
      Tail2.mirror = true;
      setRotation(Tail2, 0.141605F, 0F, 0F);
      Torso = new ModelRenderer(this, 69, 0);
      Torso.addBox(-2.5F, -3F, -3F, 5, 9, 5);
      Torso.setRotationPoint(-0.5F, 12.5F, 1F);
      Torso.setTextureSize(128, 64);
      Torso.mirror = true;
      setRotation(Torso, 1.496439F, 0F, 0F);
  public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
      super.render(par1Entity, par2, par3, par4, par5, par6, par7);
      this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
      if (this.isChild)
          float f6 = 2.0F;
          GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7);
          GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
          GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
          GL11.glScalef(1.5F, 1.5F, 1.5F);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
   * Used for easily adding entity-dependent animations. The second and third float params here are the same second
   * and third as in the setRotationAngles method.
  public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
      EntityZertum entityzertum = (EntityZertum)par1EntityLivingBase;
      this.RightHindLeg1.rotateAngleX = RightHindLeg1.rotateAngleX + MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
      this.LeftHindLeg1.rotateAngleX = LeftHindLeg1.rotateAngleX + MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
      this.RightLeg.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
      this.LeftLeg.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
      this.Head.rotateAngleZ = entityzertum.getInterestedAngle(par4) + entityzertum.getShakeAngle(par4, 0.0F);
      this.Mane1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.08F);
      this.Torso.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.16F);
      this.Tail1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.32F);
  private void setRotation(ModelRenderer model, float x, float y, float z)
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
    this.Head.rotateAngleX = par5 / (280F / (float)Math.PI);
    this.Head.rotateAngleY = par4 / (180F / (float)Math.PI);
    this.Mane1.rotateAngleY = par4 / (180F / (float)Math.PI);
    //this.Tail1.rotateAngleX = par3;


Here is what it SUPPOSE to look like:

width=727 height=467http://i1319.photobucket.com/albums/t661/Nova_Leary/ZertumRedesign_zpsf00afd39.png[/img]

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Link to comment
Share on other sites

You keep adding on to your angles so even with a trig function that goes negative, if you keep adding on to your previous it will still generally accumulate in a weird way.  Instead I think you should have a fixed starting angle for each leg and only add the trig to that. 


Maybe something like:

this.RightHindLeg1.rotateAngleX = rightLegStartingRotation + MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;


Where you should replace rightLegStartingRotation with whatever value the middle of the animation is supposed to have (maybe 0 in your case).  Do that for each rotation.




Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

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.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The version of what? I just imported the MDK into Eclipse. I haven't made any edits to the Java code in it or even any other files. I haven't even gotten to changing the modid from "examplemod" yet.
    • Captain WebGenesis is a Cyber skilled hacker with special abilities and skills that enact penetration to help victims of Crypto Fraudulent activities who are faced with cyber challenges get back their lost funds. Simply file your complaint through the website (https://captainwebgenesis. com) and have all your crypto recovered back.
    • The crash log keeps saying something about the tick rate. Can someone please help me fix?   ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 2024-06-21 16:24:55 Description: Exception in server tick loop java.lang.NullPointerException: Cannot invoke "com.cobblemon.mod.common.api.conditional.RegistryLikeCondition.fits(Object, net.minecraft.core.Registry)" because "condition" is null at com.cobblemon.mod.common.api.spawning.condition.SpawningCondition.fits(SpawningCondition.java:85) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.AreaTypeSpawningCondition.fits(AreaTypeSpawningCondition.java:30) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.GroundedTypeSpawningCondition.fits(GroundedTypeSpawningCondition.java:28) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.GroundedTypeSpawningCondition.fits(GroundedTypeSpawningCondition.java:24) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.SpawningCondition.isSatisfiedBy(SpawningCondition.java:68) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.detail.SpawnDetail.isSatisfiedBy(SpawnDetail.java:78) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.Spawner$DefaultImpls.getMatchingSpawns(Spawner.java:42) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner.getMatchingSpawns(TickingSpawner.java:31) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.selection.FlatContextWeightedSelector.getSelectionData(FlatContextWeightedSelector.java:79) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.selection.FlatContextWeightedSelector.select(FlatContextWeightedSelector.java:106) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.AreaSpawner.run(AreaSpawner.java:94) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner.tick(TickingSpawner.java:71) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.SpawnerManager.onServerTick(SpawnerManager.java:58) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.events.ServerTickHandler.onTick(ServerTickHandler.java:20) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.Cobblemon$initialize$7.invoke(Cobblemon.java:368) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.Cobblemon$initialize$7.invoke(Cobblemon.java:368) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.reactive.ObservableSubscription.handle(ObservableSubscription.java:16) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.reactive.SimpleObservable.emit(SimpleObservable.java:39) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.forge.event.ForgePlatformEventHandler.onTick(ForgePlatformEventHandler.kt:172) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.forge.event.__ForgePlatformEventHandler_onTick_ServerTickEvent.invoke(.dynamic) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPostServerTick(ForgeEventFactory.java:950) ~[forge-1.20.1-47.2.17-universal.jar%23138!/:?] {re:classloading} at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:835) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:840) ~[?:?] {re:mixin}
    • okay i've managed to fix it. looks like i made the stupidest error known to man. i hadn't installed forge to the client, which i assumed only affected the launcher which wouldn't affect me because i used a third party one. evidently not. the more you know
    • tried a fresh install of above and beyond with java 8 installed. got a popup that says "Error: Unable to access jarfile forge-1.16.5-36.2.8.jar". every good programmer knows getting a different error means you've made progress!
  • Topics

  • Create New...

Important Information

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