Fixed it so that if the Sentient Specters hit each other and they have the same owner they will not attack each other

This commit is contained in:
WayofTime 2016-08-16 21:41:02 -04:00
parent 939e1c3946
commit 5592e8661b
9 changed files with 298 additions and 27 deletions

View file

@ -0,0 +1,32 @@
package WayofTime.bloodmagic.entity.ai;
import java.util.UUID;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityOwnable;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
public class EntityAIHurtByTargetIgnoreTamed extends EntityAIHurtByTarget
{
public EntityAIHurtByTargetIgnoreTamed(EntityCreature creatureIn, boolean entityCallsForHelpIn, Class<?>... targetClassesIn)
{
super(creatureIn, true, targetClassesIn);
}
@Override
public boolean isSuitableTarget(EntityLivingBase target, boolean includeInvincibles)
{
if (this.taskOwner instanceof IEntityOwnable && target instanceof IEntityOwnable)
{
UUID thisId = ((IEntityOwnable) this.taskOwner).getOwnerId();
UUID targetId = ((IEntityOwnable) target).getOwnerId();
if (thisId != null && targetId != null && thisId.equals(targetId))
{
return false;
}
}
return super.isSuitableTarget(target, includeInvincibles);
}
}