Posted July 9, 201411 yr My custom tamed entity will attempt to attack a player but it will deal 0 damage. Why does this happen?
July 9, 201411 yr I think you should add this to entity constructor: this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); And to set damage use this: protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); }
July 9, 201411 yr Author Is there a way to prevent the mob attacking players in the first place because I don't really want them to?
July 9, 201411 yr Author I want my custom entity to never even try to attack the player, if you know what I mean.
July 9, 201411 yr Author The problem is that I have just got 3 target tasks that will make i attack whatever attacks it, its owner or whatever the owner attacks. I want it to be so that if the entity is a player don't try to attack. That is all the AI I have: this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 6.0F, 3.0F)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); 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, true)); this.targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(3, new EntityAIOwnerHurtTarget(this));
July 9, 201411 yr It isn't hard to make a custom AI class. Just copy the one that is closest and change what you need and add it to the list instead. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
July 9, 201411 yr Author Well I tried using this in the attackEntityAsMob() method but it has no affect: if(par1Entity instanceof EntityPlayer) { return false; }
July 9, 201411 yr Author In the attackEntityAsMob() method, if it returns true does that mean it will attack that target or it will deal damage to the set target?
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.