1

Coding Help

Willsr71's Avatar Willsr719/29/12 2:56 pm
9/29/2012 11:55 pm
Willsr71's Avatar Willsr71
ModelBiped.java
package net.minecraft.src;

public class ModelBiped extends ModelBase
{
public ModelRenderer bipedHead;
public ModelRenderer bipedHeadwear;
public ModelRenderer bipedBody;
public ModelRenderer bipedRightArm;
public ModelRenderer bipedLeftArm;
public ModelRenderer bipedRightLeg;
public ModelRenderer bipedLeftLeg;
public ModelRenderer bipedEars;
public ModelRenderer bipedCloak;

/**
* Records whether the model should be rendered holding an item in the left hand, and if that item is a block.
*/
public int heldItemLeft;

/**
* Records whether the model should be rendered holding an item in the right hand, and if that item is a block.
*/
public int heldItemRight;
public boolean isSneak;

/** Records whether the model should be rendered aiming a bow. */
public boolean aimedBow;

public ModelBiped()
{
this(0.0F);
}

public ModelBiped(float par1)
{
this(par1, 0.0F);
}

public ModelBiped(float par1, float par2)
{
this.heldItemLeft = 0;
this.heldItemRight = 0;
this.isSneak = false;
this.aimedBow = false;
this.bipedCloak = new ModelRenderer(this, 0, 0);
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
this.bipedEars = new ModelRenderer(this, 24, 0);
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1);
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + par2, 0.0F);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + par2, 0.0F);
}

/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
this.setRotationAngles(par2, par3, par4, par5, par6, par7);
this.bipedHead.render(par7);
this.bipedBody.render(par7);
this.bipedRightArm.render(par7);
this.bipedLeftArm.render(par7);
this.bipedRightLeg.render(par7);
this.bipedLeftLeg.render(par7);
this.bipedHeadwear.render(par7);
}

/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
{
this.bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI);
this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI);
this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F;
this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;

if (this.isRiding)
{
this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F);
this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F);
this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F);
this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F);
}

if (this.heldItemLeft != 0)
{
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft;
}

if (this.heldItemRight != 0)
{
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;
}

this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
float var7;
float var8;

if (this.onGround > -9990.0F)
{
var7 = this.onGround;
this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(var7) * (float)Math.PI * 2.0F) * 0.2F;
this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
var7 = 1.0F - this.onGround;
var7 *= var7;
var7 *= var7;
var7 = 1.0F - var7;
var8 = MathHelper.sin(var7 * (float)Math.PI);
float var9 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)var8 * 1.2D + (double)var9));
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F;
}

if (this.isSneak)
{
this.bipedBody.rotateAngleX = 0.5F;
this.bipedRightArm.rotateAngleX += 0.4F;
this.bipedLeftArm.rotateAngleX += 0.4F;
this.bipedRightLeg.rotationPointZ = 4.0F;
this.bipedLeftLeg.rotationPointZ = 4.0F;
this.bipedRightLeg.rotationPointY = 9.0F;
this.bipedLeftLeg.rotationPointY = 9.0F;
this.bipedHead.rotationPointY = 1.0F;
}
else
{
this.bipedBody.rotateAngleX = 0.0F;
this.bipedRightLeg.rotationPointZ = 0.0F;
this.bipedLeftLeg.rotationPointZ = 0.0F;
this.bipedRightLeg.rotationPointY = 12.0F;
this.bipedLeftLeg.rotationPointY = 12.0F;
this.bipedHead.rotationPointY = 0.0F;
}

this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;

if (this.aimedBow)
{
var7 = 0.0F;
var8 = 0.0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - var7 * 0.6F) + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleY = 0.1F - var7 * 0.6F + this.bipedHead.rotateAngleY + 0.4F;
this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
this.bipedLeftArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
}
}

/**
* renders the ears (specifically, deadmau5's)
*/
public void renderEars(float par1)
{
this.bipedEars.rotateAngleY = this.bipedHead.rotateAngleY;
this.bipedEars.rotateAngleX = this.bipedHead.rotateAngleX;
this.bipedEars.rotationPointX = 0.0F;
this.bipedEars.rotationPointY = 0.0F;
this.bipedEars.render(par1);
}

/**
* Renders the cloak of the current biped (in most cases, it's a player)
*/
public void renderCloak(float par1)
{
this.bipedCloak.render(par1);
}
}
Posted by Willsr71's Avatar
Willsr71
Level 53 : Grandmaster Programmer
197

Create an account or sign in to comment.

10

Willsr71
09/29/2012 11:55 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
Yep, I got it, Added the mobs to the RenderManager.class
All good now
1
Willsr71
09/29/2012 11:31 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
Never Mind, I think I just figured it out.
1
Willsr71
09/29/2012 10:39 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
sed11Unless the Entity's name is the same as the Model's and that works, and the Model has the same shapes/dimensions as the regular Wolf model.

made it with MCP, and yes to everything above. I renders as a steve/biped model insteas of a wolf model
1
sed11
09/29/2012 9:21 pm
Level 66 : High Grandmaster Hero
sed11's Avatar
Its easier to make it use a model though with ModLoader.

Unless the Entity's name is the same as the Model's and that works, and the Model has the same shapes/dimensions as the regular Wolf model.

Did you make it with Techne?If you did, did you choose the wolf model and not the biped?
1
Willsr71
09/29/2012 7:27 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
No im trying not to use modloader, but thanks
1
Jas
09/29/2012 7:23 pm
Level 67 : High Grandmaster Sweetheart
Jas's Avatar
Assuming you're using modloader, you need to add the following to your mod_ file:

public void addRenderer(Map map){
map.put(EntitySnowWolf.class, new RenderSnowWolf(new ModelSnowWolf(), 1f));
}
1
Willsr71
09/29/2012 7:44 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
could I also use that directly in the EntitySnowWolf.class file?
1
Willsr71
09/29/2012 7:16 pm
Level 53 : Grandmaster Programmer
Willsr71's Avatar
They use the steve/human/biped model
1
sed11
09/29/2012 5:09 pm
Level 66 : High Grandmaster Hero
sed11's Avatar
Do you mean their Render is like Steve's or that they use the Biped/Human/Steve model?
1
shiny21
09/29/2012 4:42 pm
Level 4 : Apprentice Explorer
shiny21's Avatar
same thing happens to me it renders a a steve in a pig shape
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome