Jump to content

Recommended Posts

Posted

 

So I currently have a ranged mob, which will fire at me and then fire in that direction 5ish times before deciding to change it's direction and fire at me again. It repeats this at all times.

 

 

public class EntityBoomer extends EntityMob implements IRangedAttackMob {

private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), 20, 60, 15.0F);

 

public EntityBoomer (World par1World) {

super(par1World);

    float moveSpeed = 0.45F;

    this.tasks.addTask(7, new EntityAIArrowAttack(this, this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), 20, 64.0F));   

        this.tasks.addTask(1, new EntityAISwimming(this));

        this.tasks.addTask(2, new EntityAIRestrictSun(this));

        this.tasks.addTask(5, new EntityAIWander(this, moveSpeed));

        this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));

        this.tasks.addTask(6, new EntityAILookIdle(this));

        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));

        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

this.setSize(0.6F, 2.3F);

// TODO Auto-generated constructor stub

}

 

protected String getLivingSound(){

return "eternisles:BoomerLiving";

}

 

protected String getDeathSound(){

return "eternisles:BoomerDeath";

}

 

protected String getHurtSound(){

    return "eternisles:BoomerHit";

}

 

@Override

    public void onLivingUpdate(){

super.onLivingUpdate();

}

 

    @Override

    protected void entityInit()

    {

        super.entityInit();

        this.dataWatcher.addObject(16, new Integer(5));

    }

 

    @Override

public void applyEntityAttributes(){

super.applyEntityAttributes();

 

this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D);

this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);

this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);

 

 

}

 

@Override

  public boolean isAIEnabled()

    {

        return true;

    }

 

 

@Override

public void attackEntityWithRangedAttack(EntityLivingBase var1, float f){

 

        EntityBoomerBallvar2 = new EntityBoomerBall(this.worldObj, this, 4.0F);

       

 

        this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));

        this.worldObj.spawnEntityInWorld(var2);

    }

 

 

}

 

 

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.