本文整理汇总了Java中net.minecraft.entity.ai.EntityAINearestAttackableTarget.Sorter方法的典型用法代码示例。如果您正苦于以下问题:Java EntityAINearestAttackableTarget.Sorter方法的具体用法?Java EntityAINearestAttackableTarget.Sorter怎么用?Java EntityAINearestAttackableTarget.Sorter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.ai.EntityAINearestAttackableTarget
的用法示例。
在下文中一共展示了EntityAINearestAttackableTarget.Sorter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EntityAIFindEntityNearestSkins
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的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: EntityAINearestAttackableCivTarget
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public EntityAINearestAttackableCivTarget(EntityToroNpc npc) {
super(npc, false, false);
this.taskOwner = npc;
this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(npc);
this.setMutexBits(1);
this.targetEntitySelector = new Predicate<EntityPlayer>() {
public boolean apply(@Nullable EntityPlayer target) {
if (target == null) {
return false;
}
if (!EntitySelectors.NOT_SPECTATING.apply(target)) {
return false;
}
if (!isSuitableTarget(taskOwner, target, false, true)) {
return false;
}
return shouldAttackPlayerBasedOnCivilization(target);
}
};
}
示例3: EntityAINearestAttackableDragon
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public EntityAINearestAttackableDragon(EntityCreature attacker, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_) {
super(attacker, p_i1665_4_, p_i1665_5_);
this.targetClass = EntityPlayer.class;
this.targetChance = p_i1665_3_;
this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(attacker);
this.setMutexBits(1);
this.targetEntitySelector = new IEntitySelector() {
// private static final String __OBFID = "CL_00001621";
/**
* Return whether the specified entity is applicable to this filter.
*/
public boolean isEntityApplicable(Entity p_82704_1_) {
return !(p_82704_1_ instanceof EntityLivingBase) ? false :
(p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false :
EntityAINearestAttackableDragon.this.isSuitableTarget((EntityLivingBase)p_82704_1_, false));
}
};
}
示例4: DroneAINearestAttackableTarget
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public DroneAINearestAttackableTarget(EntityDrone drone, boolean checkSight, boolean easyTargetsOnly,
ProgWidget widget) {
super(drone, checkSight, easyTargetsOnly);
this.drone = drone;
this.widget = widget;
theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(drone);
setMutexBits(1);
}
示例5: EntityEndermite
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public EntityEndermite(World world) {
super(world);
sorter = new EntityAINearestAttackableTarget.Sorter(this);
experienceValue = 3;
setSize(0.4F, 0.3F);
tasks.addTask(1, new EntityAISwimming(this));
tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
tasks.addTask(3, new EntityAIWander(this, 1.0D));
tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
tasks.addTask(8, new EntityAILookIdle(this));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 10, true));
}
示例6: EntityAINearestAttackableTargetFiltered
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public EntityAINearestAttackableTargetFiltered(EntityCreature creature, Class<T> classTarget, int chance, boolean checkSight, boolean onlyNearby, @Nullable final Predicate<? super T> targetSelector) {
super(creature, checkSight, onlyNearby);
this.targetClass = classTarget;
this.targetChance = chance;
this.sorter = new EntityAINearestAttackableTarget.Sorter(creature);
this.setMutexBits(1);
UUID exclude = creature.getEntityData().getUniqueId("owner");
this.targetEntitySelector = (Predicate<T>) entity -> (entity != null && !entity.getUniqueID().equals(exclude)) && (targetSelector == null || targetSelector.apply(entity) && (EntitySelectors.NOT_SPECTATING.apply(entity) && EntityAINearestAttackableTargetFiltered.this.isSuitableTarget(entity, false)));
}
示例7: shouldExecute
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if ( !pet.hasSkill( Skill.COMBAT_HOSTILE.id ) )
{
return false;
}
else
{
double d0 = 10;//this.getTargetDistance();
List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(EntityMob.class, this.taskOwner.boundingBox.expand(d0, 4.0D, d0), this.targetEntitySelector);
if (!list.isEmpty())
{
if ( pet.getOwner() != null )
{
theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter( pet.getOwner() );
}
else
{
theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter( pet );
}
}
Collections.sort(list, this.theNearestAttackableTargetSorter);
if (list.isEmpty())
{
return false;
}
else
{
this.targetEntity = (EntityLivingBase)list.get(0);
return true;
}
}
}
示例8: EntityAINearestChecked
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public <A extends EntityLivingBase> EntityAINearestChecked(EntityCreature p_i1665_1_, Class<A> p_i1665_2_,
boolean p_i1665_4_, boolean p_i1665_5_, final Predicate<A> p_i1665_6_, boolean targetLock) {
super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
this.targetClass = p_i1665_2_;
this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(p_i1665_1_);
this.setMutexBits(1);
this.targetLock = targetLock;
this.targetEntitySelector = new Predicate<EntityLivingBase>() {
@Override
public boolean apply(EntityLivingBase target) {
if (p_i1665_6_ != null && !p_i1665_6_.apply((A) target))
return false;
else {
// System.out.println("found "+target.getClass().getName()+"
// "+EntityAINearestChecked.this.taskOwner.getClass().getName());
if (target instanceof EntityLivingBase) {
double d0 = EntityAINearestChecked.this.getTargetDistance();
if (target.isSneaking())
d0 *= 0.800000011920929D;
if (target instanceof EntityPlayer && target.isInvisible()) {
float f = ((EntityPlayer) target).getArmorVisibility();
if (f < 0.1F)
f = 0.1F;
d0 *= 0.7F * f;
}
if (target.hasCapability(TF2weapons.WEAPONS_CAP, null)
&& (target.getCapability(TF2weapons.WEAPONS_CAP, null).invisTicks >= 20
|| ItemDisguiseKit.isDisguised(target, taskOwner)))
d0 = taskOwner instanceof EntityBuilding ? 0 : 1;
boolean fastCheck = taskOwner instanceof EntityBuilding || (!(target instanceof EntityPlayer)
&& (TF2ConfigVars.naturalCheck.equals("Fast") && taskOwner instanceof EntityTF2Character
&& ((EntityTF2Character) taskOwner).natural));
if (target.getDistanceToEntity(taskOwner) > d0
|| (!fastCheck && !TF2Util.lookingAtFast(taskOwner, 105,
target.posX, target.posY + target.getEyeHeight(), target.posZ)))
return false;
}
return EntityAINearestChecked.this.isSuitableTarget(target, false);
}
}
};
}
示例9: AISlimeMerge
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
public AISlimeMerge(EntitySlime slimeIn)
{
this.slime = slimeIn;
this.setMutexBits(2);
this.sorter = new EntityAINearestAttackableTarget.Sorter(slimeIn);
}
示例10: EntityAITargetBombs
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; //导入方法依赖的package包/类
/**
* Also see {@link EntityAIDynamicCustomTarget#EntityAIDynamicCustomTarget(EntityCreature, EntityAction, float, boolean, boolean) EntityAIDynamicCustomTarget}
* @param range Additionally used as the radius within which to search for bombs
*/
public EntityAITargetBombs(T entity, EntityAction action, float range, boolean require_ground, boolean require_sight) {
super(entity, action, range, require_ground, require_sight);
this.sorter = new EntityAINearestAttackableTarget.Sorter(entity);
this.range = range;
}