Jump to content

Recommended Posts

Posted

Hello guys. Could somebody tell me how to make a mob that:

1.Only stays on its place on which i spawned him.

2.Can attack me, but cant turn around.

3.Make an animations, wchich i set  to him.

Here is the code of ModelName file:

 

 

package doorcloser.modding;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.monster.EntityIronGolem;

import net.minecraft.util.MathHelper;

 

@SideOnly(Side.CLIENT)

public class ModelXenTree extends ModelBase {

 

// fields

ModelRenderer main;

ModelRenderer forebody;

ModelRenderer clawa;

ModelRenderer clawb;

ModelRenderer clawc;

ModelRenderer clawmain;

 

public ModelXenTree() {

textureWidth = 64;

textureHeight = 128;

 

main = new ModelRenderer(this, 0, 0);

main.addBox(0F, 0F, 0F, 11, 24, 11);

main.setRotationPoint(-5.5F, 0F, -4F);

main.setTextureSize(64, 128);

main.mirror = true;

setRotation(main, 0F, 0F, 0F);

forebody = new ModelRenderer(this, -1, 99);

forebody.addBox(0F, 0F, 0.2F, 9, 14, 9);

forebody.setRotationPoint(-4.5F, -13F, -3F);

forebody.setTextureSize(64, 128);

forebody.mirror = true;

setRotation(forebody, -0.0743572F, 0F, 0F);

clawa = new ModelRenderer(this, 0, 40);

clawa.addBox(-3.5F, -9.8F, -3F, 7, 10, 8);

clawa.setRotationPoint(0F, -11.5F, 1F);

clawa.setTextureSize(64, 128);

clawa.mirror = true;

setRotation(clawa, 0.2617994F, 0F, 0F);

clawb = new ModelRenderer(this, 0, 63);

clawb.addBox(-3F, -11F, -10F, 6, 5, 9);

clawb.setRotationPoint(0F, -11.5F, 1F);

clawb.setTextureSize(64, 128);

clawb.mirror = true;

setRotation(clawb, 0F, 0F, 0F);

clawc = new ModelRenderer(this, 0, 80);

clawc.addBox(-2.5F, -13F, -17F, 5, 3, 13);

clawc.setRotationPoint(0F, -11.5F, 1F);

clawc.setTextureSize(64, 128);

clawc.mirror = true;

setRotation(clawc, 0.4089647F, 0F, 0F);

clawmain = new ModelRenderer(this, 39, 82);

clawmain.addBox(-1F, 5.8F, -20.5F, 2, 12, 2);

clawmain.setRotationPoint(0F, -11.5F, 1F);

clawmain.setTextureSize(64, 128);

clawmain.mirror = true;

setRotation(clawmain, -0.5205006F, 0F, 0F);

}

 

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);

main.render(f5);

forebody.render(f5);

clawa.render(f5);

clawb.render(f5);

clawc.render(f5);

clawmain.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.clawa.rotateAngleX = 0.3F;

        this.clawb.rotateAngleX = 0.0F;

        this.clawc.rotateAngleX = 0.5F;

        this.clawmain.rotateAngleX = -0.4F;

    }

 

public void setLivingAnimations(EntityLiving par1EntityLiving, float par2,

float par3, float par4) {

EntityXenTree entityxentree = (EntityXenTree) par1EntityLiving;

int i = entityxentree.getAttackTimer();

 

if (i > 0) {

 

this.clawa.rotateAngleX = MathHelper.cos(par2 * -0.5F) * 1.0F * par3;

this.clawb.rotateAngleX = MathHelper.cos(par2 * -0.5F) * 1.0F * par3;

this.clawc.rotateAngleX = MathHelper.cos(par2 * -0.5F) * 1.0F * par3;

this.clawmain.rotateAngleX = MathHelper.cos(par2 * -0.5F) * 1.0F * par3;

 

 

 

}

}

 

private float func_78172_a(float par1, float par2) {

return (Math.abs(par1 % par2 - par2 * 1.0F) - par2 * 0.30F) / (par2 * 0.30F);

}

 

}

 

 

 

Also, it can be just attacking block. Rendering block ofcourse. Anybody help?

 

 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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