当前位置: 首页>>代码示例>>Java>>正文


Java EntityAITarget.isSuitableTarget方法代码示例

本文整理汇总了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);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:21,代码来源:EntityAIFindEntityNearestSkins.java

示例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;
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:MinionAICombat.java

示例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));
    }
}
 
开发者ID:gigaherz,项目名称:Survivalist,代码行数:26,代码来源:SlimeMerger.java

示例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;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:6,代码来源:BombombAICombat.java


注:本文中的net.minecraft.entity.ai.EntityAITarget.isSuitableTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。