Jump to content

Recommended Posts

Posted

Hello@All ,

 

Lets say, im trying and trying whole day ...

 

can someone tell me , how to make a "throwable" item ..

i got already a class with the "functionality"  ... it throw it and explode after ,

 

i got another "Entity Class" which is a "Ball"  ...

 

i know it sound weird but ... what is left to do, i know it sometimes and then its wrong ... -_-

 

here my entityball for anyone who needs it maybe:

public class ModelBall
  extends ModelBase
{
  ModelRenderer Shape1;
  ModelRenderer Shape2;
  ModelRenderer Shape3;
  ModelRenderer Shape4;
  ModelRenderer Shape5;
  ModelRenderer Shape6;
  ModelRenderer Shape7;
  
  public ModelBall()
  {
    this.textureWidth = 64;
    this.textureHeight = 64;
    
    this.Shape1 = new ModelRenderer(this, 0, 0);
    this.Shape1.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4);
    this.Shape1.setRotationPoint(-1.0F, 0.0F, -3.0F);
    this.Shape1.setTextureSize(64, 64);
    this.Shape1.mirror = true;
    setRotation(this.Shape1, 0.0F, 0.0F, 0.0F);
    this.Shape2 = new ModelRenderer(this, 0, 0);
    this.Shape2.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape2.setRotationPoint(-0.5F, -0.7F, -2.5F);
    this.Shape2.setTextureSize(64, 64);
    this.Shape2.mirror = true;
    setRotation(this.Shape2, 0.0F, 0.0F, 0.0F);
    this.Shape3 = new ModelRenderer(this, 0, 0);
    this.Shape3.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape3.setRotationPoint(-0.5F, 3.7F, -2.5F);
    this.Shape3.setTextureSize(64, 64);
    this.Shape3.mirror = true;
    setRotation(this.Shape3, 0.0F, 0.0F, 0.0F);
    this.Shape4 = new ModelRenderer(this, 0, 0);
    this.Shape4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape4.setRotationPoint(-1.7F, 0.5F, -2.5F);
    this.Shape4.setTextureSize(64, 64);
    this.Shape4.mirror = true;
    setRotation(this.Shape4, 0.0F, 0.0F, 0.0F);
    this.Shape5 = new ModelRenderer(this, 0, 0);
    this.Shape5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape5.setRotationPoint(2.7F, 0.5F, -2.5F);
    this.Shape5.setTextureSize(64, 64);
    this.Shape5.mirror = true;
    setRotation(this.Shape5, 0.0F, 0.0F, 0.0F);
    this.Shape6 = new ModelRenderer(this, 0, 0);
    this.Shape6.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape6.setRotationPoint(-0.5F, 0.5F, 0.7F);
    this.Shape6.setTextureSize(64, 64);
    this.Shape6.mirror = true;
    setRotation(this.Shape6, 0.0F, 0.0F, 0.0F);
    this.Shape7 = new ModelRenderer(this, 0, 0);
    this.Shape7.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape7.setRotationPoint(-0.5F, 0.5F, -3.7F);
    this.Shape7.setTextureSize(64, 64);
    this.Shape7.mirror = true;
    setRotation(this.Shape7, 0.0F, 0.0F, 0.0F);
  }
  
  public void func_78088_a(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);
    this.Shape1.render(f5);
    this.Shape2.render(f5);
    this.Shape3.render(f5);
    this.Shape4.render(f5);
    this.Shape5.render(f5);
    this.Shape6.render(f5);
    this.Shape7.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 f, float f1, float f2, float f3, float f4, float f5)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
  }
}

 

here the functionality which it will have :

 

public class Test2Skill extends EntityThrowable {

public int explosionRadius = 10;
  
  public Test2Skill(World par1World)
  {
    super(par1World);
  }
  
  public Test2Skill(World par1World, EntityPlayer par3EntityPlayer)
  {
    super(par1World, par3EntityPlayer);
  }
  
  public Test2Skill(World par1World, double par2, double par4, double par6)
  {
    super(par1World, par2, par4, par6);
  }
  
  public int ticks = 30;
  
  public void onEntityUpdate()
  {
    if (this.ticks <= 0)
    {
      this.ticks = 30;
      setDead();
    }
    else
    {
      this.ticks -= 1;
    }
  }
  
  protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
  {
    if (par1MovingObjectPosition.entityHit != null) {
      par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 20.0F);
    }
    if (!this.worldObj.isRemote)
    {
      this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, true);
      setDead();
    }
  }
  
  protected float getGravityVelocity()
  {
    return 0.001F;
  }
}

 

 

and now ... what is left to code -_- ....

 

:x:X:X

 

 

 

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.