本文整理汇总了Java中net.minecraft.entity.ai.EntityAITarget.isSuitableTarget方法的典型用法代码示例。如果您正苦于以下问题:Java EntityAITarget.isSuitableTarget方法的具体用法?Java EntityAITarget.isSuitableTarget怎么用?Java EntityAITarget.isSuitableTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.ai.EntityAITarget
的用法示例。
在下文中一共展示了EntityAITarget.isSuitableTarget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EntityAIFindEntityNearestSkins
import net.minecraft.entity.ai.EntityAITarget; //导入方法依赖的package包/类
public EntityAIFindEntityNearestSkins(EntityLiving entityLivingIn) {
this.taskOwner = entityLivingIn;
if (entityLivingIn instanceof EntityCreature) {
LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinderMob mobs!");
}
this.predicate = p_apply_1_ -> {
if (!(p_apply_1_ instanceof EntityArmyMember)) {
return false;
} else if (p_apply_1_.getIsInvulnerable()) {
return false;
} else {
double maxTargetRange = EntityAIFindEntityNearestSkins.this.maxTargetRange();
return !((double) p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearestSkins.this.taskOwner) > maxTargetRange) && (EntityAITarget.isSuitableTarget(EntityAIFindEntityNearestSkins.this.taskOwner, (EntityLivingBase) p_apply_1_, false, true) && CAN_ATTACK_ARMY_MEMBER.test((EntityArmyMember) p_apply_1_));
}
};
this.sorter = new EntityAINearestAttackableTarget.Sorter(entityLivingIn);
}
示例2: isEntityValidToAttack
import net.minecraft.entity.ai.EntityAITarget; //导入方法依赖的package包/类
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;
if (entity instanceof EntityMob &&
(getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS ||
getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
{
return true;
}
else if (entity instanceof EntityAnimal &&
(getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS ||
getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
{
return true;
}
else
{
return false;
}
}
示例3: EntityAIFindOtherSlimeNearest
import net.minecraft.entity.ai.EntityAITarget; //导入方法依赖的package包/类
public EntityAIFindOtherSlimeNearest(final EntitySlime mobIn)
{
super(mobIn, EntitySlime.class);
this.slime = mobIn;
Predicate<EntityLivingBase> predicate = entity -> {
double range = EntityAIFindOtherSlimeNearest.this.getFollowRange();
return entity != null
&& entity != mobIn
&& entity.getClass() == mobIn.getClass()
&& entity.ticksExisted > AGE_LIMIT
&& !entity.isInvisible()
&& entity.getDistance(mobIn) <= range
&& ((EntitySlime) entity).getSlimeSize() == mobIn.getSlimeSize()
&& EntityAITarget.isSuitableTarget(mobIn, entity, false, true);
};
try
{
predicateField.set(this, predicate);
}
catch (IllegalAccessException e)
{
throw new ReportedException(new CrashReport("Could not set private field '" + predicateField.getName() + "'", e));
}
}
示例4: isEntityValidToAttack
import net.minecraft.entity.ai.EntityAITarget; //导入方法依赖的package包/类
public boolean isEntityValidToAttack(EntityBombomb bombomb, EntityLivingBase entity)
{
if(entity == bombomb || entity == bombomb.getRidingEntity() || !EntityAITarget.isSuitableTarget(bombomb, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;
return true;
}