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

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

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

World.findNearestEntityWithinAABB介绍

暂无

代码示例

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

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

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

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

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

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

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

  1. /**
  2. * Returns whether the EntityAIBase should begin execution.
  3. */
  4. @Override
  5. public boolean shouldExecute() {
  6. if (random.nextFloat() >= watchChance) {
  7. return false;
  8. }
  9. watchedEntity = null;
  10. if (watchedEntity == null) {
  11. AxisAlignedBB aabb = dragon.getEntityBoundingBox().expand(maxDist, dragon.height, maxDist);
  12. Class clazz = EntityLiving.class;
  13. watchedEntity = world.findNearestEntityWithinAABB(clazz, aabb, dragon);
  14. }
  15. if (watchedEntity != null) {
  16. // don't try to look at the rider when being ridden
  17. if (watchedEntity == dragon.getRidingPlayer()) {
  18. watchedEntity = null;
  19. }
  20. // watch the owner a little longer
  21. if (watchedEntity == dragon.getOwner()) {
  22. watchTicks *= 3;
  23. }
  24. }
  25. return watchedEntity != null;
  26. }

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

  1. /**
  2. * {@inheritDoc}
  3. * Returns whether the EntityAIBase should begin execution.
  4. * This will execute if the status for the citizen is set to MOURN
  5. * It will determine the location of the mourn location and start to move
  6. * entity toward that location. Once there it will random move the citizen around.
  7. * It will determine a nearby citizen and look at that citizen. To appear they are communicating.
  8. * If citizen gets to far away then they will move back to the mourn location.
  9. */
  10. @Override
  11. public boolean shouldExecute()
  12. {
  13. if (citizen.getDesiredActivity() != DesiredActivity.MOURN)
  14. {
  15. return false;
  16. }
  17. if ((citizen.getCitizenJobHandler().getColonyJob() instanceof AbstractJobGuard)
  18. || (reachedFinalDestination && checkForRandom()))
  19. {
  20. closestEntity = this.citizen.world.findNearestEntityWithinAABB(EntityCitizen.class,
  21. citizen.getEntityBoundingBox().grow((double) maxDistanceForPlayer, 3.0D, (double)maxDistanceForPlayer), citizen);
  22. if (closestEntity == null)
  23. {
  24. continueLooking = false;
  25. }
  26. return false;
  27. }
  28. citizen.getCitizenStatusHandler().setStatus(Status.MOURN);
  29. return true;
  30. }

相关文章

World类方法