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

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

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

World.findNearestEntityWithinAABB介绍

暂无

代码示例

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

@Override
@Nullable
public <T extends Entity> T findNearestEntityWithinAABB(@Nonnull Class<? extends T> entityType, @Nonnull AxisAlignedBB aabb, @Nonnull T closestTo) {
 return wrapped.findNearestEntityWithinAABB(entityType, aabb, closestTo);
}

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

@Override
public <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, AxisAlignedBB aabb, T closestTo) {
  return getActualWorld().findNearestEntityWithinAABB(entityType, aabb, closestTo);
}

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

public static double getDistanceSqToNearestPlayer(@Nonnull Entity entity, double maxRange) {
 AxisAlignedBB bounds = getBoundsAround(entity, maxRange);
 EntityPlayer nearest = (EntityPlayer) entity.getEntityWorld().findNearestEntityWithinAABB(EntityPlayer.class, bounds, entity);
 if (nearest == null) {
  return 1;
 }
 return nearest.getDistanceSq(entity);
}

代码示例来源:origin: ata4/dragon-mounts

/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
  if (random.nextFloat() >= watchChance) {
    return false;
  }
  
  watchedEntity = null;
  
  if (watchedEntity == null) {
    AxisAlignedBB aabb = dragon.getEntityBoundingBox().expand(maxDist, dragon.height, maxDist);
    Class clazz = EntityLiving.class;
    watchedEntity = world.findNearestEntityWithinAABB(clazz, aabb, dragon);
  }
  if (watchedEntity != null) {
    // don't try to look at the rider when being ridden
    if (watchedEntity == dragon.getRidingPlayer()) {
      watchedEntity = null;
    }
    
    // watch the owner a little longer
    if (watchedEntity == dragon.getOwner()) {
      watchTicks *= 3;
    }
  }
  return watchedEntity != null;
}

代码示例来源:origin: ldtteam/minecolonies

/**
 * {@inheritDoc}
 * Returns whether the EntityAIBase should begin execution.
 * This will execute if the status for the citizen is set to MOURN
 * It will determine the location of the mourn location and start to move
 * entity toward that location.   Once there it will random move the citizen around.
 * It will determine a nearby citizen and look at that citizen.  To appear they are communicating.
 * If citizen gets to far away then they will move back to the mourn location.
 */
@Override
public boolean shouldExecute()
{
  if (citizen.getDesiredActivity() != DesiredActivity.MOURN)
  {
    return false;
  }
  if ((citizen.getCitizenJobHandler().getColonyJob() instanceof AbstractJobGuard)
    || (reachedFinalDestination && checkForRandom()))
  {
    closestEntity = this.citizen.world.findNearestEntityWithinAABB(EntityCitizen.class,
            citizen.getEntityBoundingBox().grow((double) maxDistanceForPlayer, 3.0D, (double)maxDistanceForPlayer), citizen);
    if (closestEntity == null)
    {
      continueLooking = false;
    }
    return false;
  }
  citizen.getCitizenStatusHandler().setStatus(Status.MOURN);
  return true;
}

相关文章

微信公众号

最新文章

更多

World类方法