Jump to content

RenderBiped renders two heads?


fr0st

Recommended Posts

Here I am, after months, with new issues :D

So basically I want to render a pickaxe held by my custom villager, so I use RenderBiped.

Before, it wasn't rendering the item because i was using RenderLiving, but I also haven't had this issue back then, so the problem is RenderBiped itself.

 

Model (Properly generated with techne and adjusted)

 

 

package coalpower.client.model;

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

public class ModelMiner extends ModelBiped
{
  //fields
    ModelRenderer Head;
    ModelRenderer Nose;
    ModelRenderer LeftArm;
    ModelRenderer RightArm;
    ModelRenderer LeftLeg;
    ModelRenderer RightLeg;
    ModelRenderer Body;
    ModelRenderer OverWear;
    ModelRenderer Hat;
  
  public ModelMiner()
  {
    textureWidth = 128;
    textureHeight = 128;
    
    Head = new ModelRenderer(this, 0, 0);
    Head.addBox(-4F, -10F, -4F, 8, 10, ;
    Head.setRotationPoint(0F, 0F, 0F);
    Head.setTextureSize(128, 128);
    Head.mirror = true;
    setRotation(Head, 0F, 0F, 0F);
    Nose = new ModelRenderer(this, 24, 0);
    Nose.addBox(0F, 0F, 0F, 2, 4, 2);
    Nose.setRotationPoint(-1F, -3F, -6F);
    Nose.setTextureSize(128, 128);
    Nose.mirror = true;    
    Head.addChild(Nose);
    setRotation(Nose, 0F, 0F, 0F);
    LeftArm = new ModelRenderer(this, 44, 22);
    LeftArm.addBox(-8F, -2F, -2F, 4, 11, 4);
    LeftArm.setRotationPoint(0F, 3F, 0F);
    LeftArm.setTextureSize(128, 128);
    LeftArm.mirror = true;
    setRotation(LeftArm, 0F, 0F, 0F);
    RightArm = new ModelRenderer(this, 44, 22);
    RightArm.addBox(4F, -2F, -2F, 4, 11, 4);
    RightArm.setRotationPoint(0F, 3F, 0F);
    RightArm.setTextureSize(128, 128);
    RightArm.mirror = true;
    setRotation(RightArm, 0F, 0F, 0F);
    LeftLeg = new ModelRenderer(this, 0, 20);
    LeftLeg.addBox(-2F, 0F, -2F, 4, 12, 4);
    LeftLeg.setRotationPoint(-2F, 12F, 0F);
    LeftLeg.setTextureSize(128, 128);
    LeftLeg.mirror = true;
    setRotation(LeftLeg, 0F, 0F, 0F);
    RightLeg = new ModelRenderer(this, 0, 20);
    RightLeg.addBox(-2F, 0F, -2F, 4, 12, 4);
    RightLeg.setRotationPoint(2F, 12F, 0F);
    RightLeg.setTextureSize(128, 128);
    RightLeg.mirror = true;
    setRotation(RightLeg, 0F, 0F, 0F);
    Body = new ModelRenderer(this, 16, 18);
    Body.addBox(0F, 0F, 0F, 8, 12, 6);
    Body.setRotationPoint(-4F, 0F, -3F);
    Body.setTextureSize(128, 128);
    Body.mirror = true;
    setRotation(Body, 0F, 0F, 0F);
    OverWear = new ModelRenderer(this, 0, 36);
    OverWear.addBox(0.5F, 0F, -0.5F, 9, 18, 7);
    OverWear.setRotationPoint(-5F, 0F, -3F);
    OverWear.setTextureSize(128, 128);
    OverWear.mirror = true;
    setRotation(OverWear, 0F, 0F, 0F);
    Hat = new ModelRenderer(this, 0, 62);
    Hat.addBox(-5F, -11F, -5F, 10, 5, 10);
    Hat.setRotationPoint(0F, 0F, 0F);
    Hat.setTextureSize(128, 128);
    Hat.mirror = true;
    setRotation(Hat, 0F, 0F, 0F);
    Head.addChild(Hat);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Head.render(f5);
    LeftArm.render(f5);
    RightArm.render(f5);
    LeftLeg.render(f5);
    RightLeg.render(f5);
    Body.render(f5);
    OverWear.render(f5);
  }
  
  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)
  {
  this.Head.rotateAngleY = par4 / (180F / (float)Math.PI);
      this.Head.rotateAngleX = par5 / (180F / (float)Math.PI);
      
      this.RightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F;
      this.LeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2 * 0.5F;
      this.RightLeg.rotateAngleY = 0.0F;
      this.LeftLeg.rotateAngleY = 0.0F;
      
      this.RightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F;
      this.LeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2 * 0.5F;
      this.RightArm.rotateAngleY = 0.0F;
      this.LeftArm.rotateAngleY = 0.0F;
  }

}

 

 

 

Render file

 

 

package coalpower.client.render.entity;

import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import coalpower.client.model.ModelMiner;
import coalpower.lib.render.Texture;

public class RenderMiner extends RenderBiped {
protected ModelMiner model;


private Texture[] texture = new Texture[] {Texture.VILLAGER_MINER};

public RenderMiner() {
	super(new ModelMiner(), 0.0F);
	model = new ModelMiner();
}

@Override
protected ResourceLocation getEntityTexture(Entity entity) {
	return texture[0].getResource();
}


    
   
}

 

 

I try my best, so apologies if I said something obviously stupid!

Link to comment
Share on other sites

So actually my actual question is: is there a way to render equipped items without using RenderBiped (Which extends RenderLiving), without copy-pasting renderEquippedItems code (Which I tired, and turned out not to be working)?

I try my best, so apologies if I said something obviously stupid!

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.

Announcements



×
×
  • Create New...

Important Information

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