Sentient Sword to not attack players unless provoked/auto attack mobs (#1381)
* Should close #1121 Not tested (yet) (because I haven't figured out how to launch the server with a fake player entity... yet). * will close #1121 Tested. Specters only attack players if they attack the owner or the specter. Spectres now autoattack every instance of EntityMob in range. //TODO: (fluff) make Bow Specter change angle based on target position (it currently always looks like it shoots into the ground)
This commit is contained in:
parent
b441e7fc1e
commit
d30dcf1ae5
|
@ -19,6 +19,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.*;
|
import net.minecraft.entity.ai.*;
|
||||||
import net.minecraft.entity.monster.EntityCreeper;
|
import net.minecraft.entity.monster.EntityCreeper;
|
||||||
import net.minecraft.entity.monster.EntityGhast;
|
import net.minecraft.entity.monster.EntityGhast;
|
||||||
|
import net.minecraft.entity.monster.EntityMob;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.projectile.EntityTippedArrow;
|
import net.minecraft.entity.projectile.EntityTippedArrow;
|
||||||
import net.minecraft.init.Enchantments;
|
import net.minecraft.init.Enchantments;
|
||||||
|
@ -67,7 +68,7 @@ public class EntitySentientSpecter extends EntityDemonBase {
|
||||||
|
|
||||||
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
|
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
|
||||||
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
|
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
|
||||||
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
|
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<>(this, EntityMob.class, true));
|
||||||
|
|
||||||
this.targetTasks.addTask(4, new EntityAIHurtByTargetIgnoreTamed(this, false));
|
this.targetTasks.addTask(4, new EntityAIHurtByTargetIgnoreTamed(this, false));
|
||||||
|
|
||||||
|
@ -384,10 +385,9 @@ public class EntitySentientSpecter extends EntityDemonBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) {
|
public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) {
|
||||||
if (!(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast)) {
|
if (!(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast)) {
|
||||||
return super.shouldAttackEntity(attacker, owner);
|
return super.shouldAttackEntity(attacker, owner);
|
||||||
} else {
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue