Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.