Posted May 7, 201411 yr So, I noticed that I keep getting a reoccuring bug whenever I used the new AI. The mob will walk towards me but it will be facing on an angle (slightly away from me) while it does it. My entity class: public class EntityRunner extends EntityMob { public EntityRunner (World par1World) { super(par1World); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); this.setSize(1.0F, 1.0F); // TODO Auto-generated constructor stub } protected String getLivingSound(){ return "darkMod:RunnerLiving"; } protected String getDeathSound(){ return "darkMod:RunnerDeath"; } protected String getHurtSound(){ return "darkMod:RunnerHurt"; } protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.pig.step", 0.15F, 1.0F); } protected Entity findPlayerToAttack(){ EntityPlayer entityPlayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 32.0D); return entityPlayer != null && this.canEntityBeSeen(entityPlayer) ? entityPlayer : null; } public void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(52.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.54D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D); } @Override protected boolean isAIEnabled() { return true; } }
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.