how do I make an flying mob attack entities like the player? i've looked in the ghast and it only has the fireball attack and the ender dragon is very confusing with its multiple parts.
Ok, so then you'll need to add a new task something like EntityAISwoopAttack, and add this task to the entity and give it a pretty high priority, maybe 0 or 1, idk.
Here is a scaffold of what the new ai should look like:
public class EntityAISwoopAttack
extends EntityAIBase
{
private final EntityLiving entityHost;
private EntityLivingBase attackTarget;
private boolean hasSwooped = false;
private Class class;
public EntityAISwoopAttack(EntityLiving host,Class targClass)
{
entityHost = host;
class = targClass;
}
public boolean shouldExecute()
{
//return true if there are no blocks in the way.
}
public boolean continueExecuting()
{
//return true if there are no blocks in the way AND !hasSwooped "!hasSwooped" means that if the entity has already dived in then it should NOT continue the task, reset it and then this task shall be repeated (the entity swoops dwn another time) ONLY IF shouldExecute says so.
}
public void resetTask()
{
//set everything to null and stuff.
}
public void updateTask()
{
//Do the actual stuff here, such as making the entity fly towards the location of the attackTarget entity. Then once there, set hasSwooped to true
}
i was wondering if u could help show me what to write? I mean where to get the code. I understand what you wrote in the code just not how to write it properly.
Here is a scaffold of what the new ai should look like: