net.minecraft.world.World.getNearestAttackablePlayer()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中net.minecraft.world.World.getNearestAttackablePlayer()方法的一些代码示例,展示了World.getNearestAttackablePlayer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getNearestAttackablePlayer()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getNearestAttackablePlayer

World.getNearestAttackablePlayer介绍

暂无

代码示例

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@Nullable
public EntityPlayer getNearestAttackablePlayer(@Nonnull BlockPos pos, double maxXZDistance, double maxYDistance) {
 return wrapped.getNearestAttackablePlayer(pos, maxXZDistance, maxYDistance);
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@Nullable
public EntityPlayer getNearestAttackablePlayer(@Nonnull Entity entityIn, double maxXZDistance, double maxYDistance) {
 return wrapped.getNearestAttackablePlayer(entityIn, maxXZDistance, maxYDistance);
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@Nullable
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance,
  @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_) {
 return wrapped.getNearestAttackablePlayer(posX, posY, posZ, maxXZDistance, maxYDistance, playerToDouble, p_184150_12_);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance,
                        Function<EntityPlayer, Double> playerToDouble, Predicate<EntityPlayer> p_184150_12_) {
  return getActualWorld().getNearestAttackablePlayer(posX, posY, posZ, maxXZDistance, maxYDistance, playerToDouble, p_184150_12_);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public EntityPlayer getNearestAttackablePlayer(Entity entityIn, double maxXZDistance, double maxYDistance) {
  return getActualWorld().getNearestAttackablePlayer(entityIn, maxXZDistance, maxYDistance);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public EntityPlayer getNearestAttackablePlayer(BlockPos pos, double maxXZDistance, double maxYDistance) {
  return getActualWorld().getNearestAttackablePlayer(pos, maxXZDistance, maxYDistance);
}

代码示例来源:origin: Silentine/GrimoireOfGaia

/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
  double d0 = getTargetDistance();
  player = enderman.world.getNearestAttackablePlayer(enderman.posX, enderman.posY, enderman.posZ, d0, d0, null, p -> p != null && shouldAttackPlayer(p));
  return player != null;
}

代码示例来源:origin: Silentine/GrimoireOfGaia

/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
  double d0 = getTargetDistance();
  player = enderman.world.getNearestAttackablePlayer(enderman.posX, enderman.posY, enderman.posZ, d0, d0, null, p -> p != null && shouldAttackPlayer(p));
  return player != null;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {
  if(cockatrice.isTamed()){
    return false;
  }
  double d0 = this.getTargetDistance();
  this.player = this.cockatrice.world.getNearestAttackablePlayer(this.cockatrice.posX, this.cockatrice.posY, this.cockatrice.posZ, d0, d0, (Function) null, new Predicate<EntityPlayer>() {
    public boolean apply(@Nullable EntityPlayer p_apply_1_) {
      return p_apply_1_ != null && EntityGorgon.isEntityLookingAt(p_apply_1_, CockatriceAIAggroLook.this.cockatrice, EntityCockatrice.VIEW_RADIUS);
    }
  });
  return this.player != null;
}

代码示例来源:origin: TeamWizardry/Wizardry

/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {
  if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) {
    return false;
  } else if (this.targetClass != EntityPlayer.class && this.targetClass != EntityPlayerMP.class) {
    List<T> list = this.taskOwner.world.getEntitiesWithinAABB(this.targetClass, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);
    if (list.isEmpty()) {
      return false;
    } else {
      list.sort(this.sorter);
      this.targetEntity = list.get(0);
      return true;
    }
  } else {
    this.targetEntity = (T) this.taskOwner.world.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double) this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>() {
      @Nullable
      public Double apply(@Nullable EntityPlayer player) {
        return 1.0D;
      }
    }, (Predicate<EntityPlayer>) this.targetEntitySelector);
    return this.targetEntity != null;
  }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

this.targetEntity = (T) this.taskOwner.world.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double) this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>() {
  @Nullable
  public Double apply(@Nullable EntityPlayer player) {

代码示例来源:origin: TeamWizardry/Wizardry

this.targetEntity = (T) this.taskOwner.world.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double) this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>() {
  @Nullable
  public Double apply(@Nullable EntityPlayer p_apply_1_) {

相关文章

微信公众号

最新文章

更多

World类方法