Jump to content

[1.12.2] Cannot Seem to get Entity Animations to Work


Recommended Posts

Posted (edited)

I've been scratching my head for hours now trying to get my custom villager to walk around without having static legs. I know I have probably made a simple error, but I cannot seem to find it. I looked over tutorials and the source code, and I am still stumped. (I'm pretty new to minecraft modding so yeah)

 

Model Class:

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

public class ModelMiner extends ModelBase{
    public ModelRenderer MinerHead;
    public ModelRenderer RightArmUpper;
    public ModelRenderer LeftArmUpper;
    public ModelRenderer MinerLeftLeg;
    public ModelRenderer Torso;
    public ModelRenderer Robe;
    public ModelRenderer MinerRightLeg;
    public ModelRenderer Nose;
    public ModelRenderer RightArm;
    public ModelRenderer LeftArm;
    
    public ModelMiner() {
        this.textureWidth = 64;
        this.textureHeight = 64;
        this.RightArmUpper = new ModelRenderer(this, 44, 22);
        this.RightArmUpper.setRotationPoint(0.0F, 3.0F, -1.0F);
        this.RightArmUpper.addBox(-8.0F, -2.0F, -2.0F, 4, 8, 4, 0.0F);
        this.setRotateAngle(RightArmUpper, 0.0F, 0.0F, 0.091106186954104F);
        this.MinerLeftLeg = new ModelRenderer(this, 0, 22);
        this.MinerLeftLeg.mirror = true;
        this.MinerLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F);
        this.MinerLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
        this.LeftArmUpper = new ModelRenderer(this, 44, 22);
        this.LeftArmUpper.setRotationPoint(0.0F, 3.0F, -1.0F);
        this.LeftArmUpper.addBox(4.0F, -2.0F, -2.0F, 4, 8, 4, 0.0F);
        this.setRotateAngle(LeftArmUpper, 0.0F, 0.0F, -0.091106186954104F);
        this.Torso = new ModelRenderer(this, 16, 20);
        this.Torso.setRotationPoint(0.0F, 0.0F, 0.0F);
        this.Torso.addBox(-4.0F, 0.0F, -3.0F, 8, 12, 6, 0.0F);
        this.RightArm = new ModelRenderer(this, 44, 22);
        this.RightArm.setRotationPoint(0.0F, 3.0F, -1.0F);
        this.RightArm.addBox(-8.0F, -0.15F, 0.3F, 4, 8, 4, 0.0F);
        this.setRotateAngle(RightArm, -0.8651597102135892F, 0.0F, 0.0F);
        this.Robe = new ModelRenderer(this, 0, 38);
        this.Robe.setRotationPoint(0.0F, 0.0F, 0.0F);
        this.Robe.addBox(-4.0F, 0.0F, -3.0F, 8, 18, 6, 0.5F);
        this.MinerHead = new ModelRenderer(this, 0, 0);
        this.MinerHead.setRotationPoint(0.0F, 0.0F, 0.0F);
        this.MinerHead.addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, 0.0F);
        this.Nose = new ModelRenderer(this, 24, 0);
        this.Nose.setRotationPoint(0.0F, -2.0F, 0.0F);
        this.Nose.addBox(-1.0F, -1.0F, -6.0F, 2, 4, 2, 0.0F);
        this.LeftArm = new ModelRenderer(this, 44, 22);
        this.LeftArm.setRotationPoint(0.0F, 3.0F, -1.0F);
        this.LeftArm.addBox(4.0F, -0.15F, 0.3F, 4, 8, 4, 0.0F);
        this.setRotateAngle(LeftArm, -0.8651597102135892F, 0.0F, 0.0F);
        this.MinerRightLeg = new ModelRenderer(this, 0, 22);
        this.MinerRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F);
        this.MinerRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
        this.RightArmUpper.addChild(this.RightArm);
        this.MinerHead.addChild(this.Nose);
        this.LeftArmUpper.addChild(this.LeftArm);
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { 
        this.RightArmUpper.render(f5);
        this.MinerLeftLeg.render(f5);
        this.LeftArmUpper.render(f5);
        this.Torso.render(f5);
        this.Robe.render(f5);
        this.MinerHead.render(f5);
        this.MinerRightLeg.render(f5);
    }

    public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
    
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
    {
        this.MinerHead.rotateAngleY = netHeadYaw * 0.017453292F;
        this.MinerHead.rotateAngleX = headPitch * 0.017453292F;
        this.MinerRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F;
        this.MinerLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount * 0.5F;
        this.MinerRightLeg.rotateAngleY = 0.0F;
        this.MinerLeftLeg.rotateAngleY = 0.0F;
    }

}

 

Render Class:

package com.reeb.moreores.entity.render;

import com.reeb.moreores.entity.EntityMiner;
import com.reeb.moreores.util.Reference;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import reeb.moreores.entity.model.ModelMiner;

public class RenderMiner extends RenderLiving<EntityMiner>{
	
	public static final ResourceLocation TEXTURES = new ResourceLocation(Reference.MOD_ID + ":textures/entity/miner.png");

	public RenderMiner(RenderManager manager) {
		super(manager, new ModelMiner(), 0.5f);
	}
	
	@Override
	protected ResourceLocation getEntityTexture(EntityMiner entity) {
		
		return TEXTURES;
		
	}
	
	@Override
	protected void applyRotations(EntityMiner entityLiving, float p_77043_2_, float rotationYaw, float partialTicks) {
		 
		super.applyRotations(entityLiving, p_77043_2_, rotationYaw, partialTicks);
		
	}

}

 

Entity Class:

package com.reeb.moreores.entity;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
import net.minecraft.entity.ai.EntityAIFollowGolem;
import net.minecraft.entity.ai.EntityAILookAtTradePlayer;
import net.minecraft.entity.ai.EntityAIMoveIndoors;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAIOpenDoor;
import net.minecraft.entity.ai.EntityAIRestrictOpenDoor;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITradePlayer;
import net.minecraft.entity.ai.EntityAIVillagerInteract;
import net.minecraft.entity.ai.EntityAIVillagerMate;
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.EntityAIWatchClosest2;
import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class EntityMiner extends EntityVillager {

	public EntityMiner(World worldIn) {
		
		super(worldIn);
		this.setSize(0.6F, 1.95F);
		this.setCanPickUpLoot(true);
		
	}
	
	@Override
	public EntityVillager createChild(EntityAgeable ageable) {
		
		return new EntityMiner(world);
		
	}
	
}

 

HELP!

Edited by Reeb

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.

Announcements



×
×
  • Create New...

Important Information

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