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

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

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

World.getNearestAttackablePlayer介绍

暂无

代码示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns whether the EntityAIBase should begin execution.
  3. */
  4. public boolean shouldExecute() {
  5. if(cockatrice.isTamed()){
  6. return false;
  7. }
  8. double d0 = this.getTargetDistance();
  9. this.player = this.cockatrice.world.getNearestAttackablePlayer(this.cockatrice.posX, this.cockatrice.posY, this.cockatrice.posZ, d0, d0, (Function) null, new Predicate<EntityPlayer>() {
  10. public boolean apply(@Nullable EntityPlayer p_apply_1_) {
  11. return p_apply_1_ != null && EntityGorgon.isEntityLookingAt(p_apply_1_, CockatriceAIAggroLook.this.cockatrice, EntityCockatrice.VIEW_RADIUS);
  12. }
  13. });
  14. return this.player != null;
  15. }

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

  1. /**
  2. * Returns whether the EntityAIBase should begin execution.
  3. */
  4. public boolean shouldExecute() {
  5. if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) {
  6. return false;
  7. } else if (this.targetClass != EntityPlayer.class && this.targetClass != EntityPlayerMP.class) {
  8. List<T> list = this.taskOwner.world.getEntitiesWithinAABB(this.targetClass, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);
  9. if (list.isEmpty()) {
  10. return false;
  11. } else {
  12. list.sort(this.sorter);
  13. this.targetEntity = list.get(0);
  14. return true;
  15. }
  16. } else {
  17. 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>() {
  18. @Nullable
  19. public Double apply(@Nullable EntityPlayer player) {
  20. return 1.0D;
  21. }
  22. }, (Predicate<EntityPlayer>) this.targetEntitySelector);
  23. return this.targetEntity != null;
  24. }
  25. }

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

  1. 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>() {
  2. @Nullable
  3. public Double apply(@Nullable EntityPlayer player) {

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

  1. 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>() {
  2. @Nullable
  3. public Double apply(@Nullable EntityPlayer p_apply_1_) {

相关文章

World类方法