Examples of distanceSquared()


Examples of org.bukkit.Location.distanceSquared()

            return;
        }

        Location ignored = sessions.getSession(TeleportSession.class, player).getIgnoreLocation();
        if (ignored != null) {
            if (ignored.getWorld().equals(loc.getWorld()) && ignored.distanceSquared(loc) <= 2) {
                return;
            } else {
                sessions.getSession(TeleportSession.class, player).setIgnoreLocation(null);
            }
        }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

    Location loc = walkDistanceCheckMap.get(player);
    if (loc != null) {
      if (loc.getWorld() != position.getWorld()) {
        // Put in proper world
        walkDistanceCheckMap.put(player, position);
      } else if (loc.distanceSquared(position) > 2.25) {
        // Moved outside radius - remove point
        walkDistanceCheckMap.remove(player);
      }
    }
  }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        message.update(newLocation);

        // don't let players move more than 16 blocks in a single packet.
        // this is NOT robust hack prevention - only to prevent client
        // confusion about where its actual location is (e.g. during login)
        if (newLocation.distanceSquared(oldLocation) > 16 * 16) {
            return;
        }

        // call move event if movement actually occurred and there are handlers registered
        if (!oldLocation.equals(newLocation) && PlayerMoveEvent.getHandlerList().getRegisteredListeners().length > 0) {
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

    double bdistance = Double.MAX_VALUE;
    for (AutoRefPlayer apl : match.getPlayers()) if (apl.isOnline())
    {
      Location ploc = apl.getPlayer().getLocation();
      double dist = ploc.distanceSquared(player.getLocation());
      if (dist < bdistance) { bdistance = dist; }
    }

    // if the spectator should be invisible, change visibility and then redo visibility
    boolean vis = bdistance <= SPECTATOR_VISIBILITY_RADIUS * SPECTATOR_VISIBILITY_RADIUS;
 
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

      // get the player who spawned this entity
      Location loc = event.getEntity().getLocation();
      for (Player pl : event.getEntity().getWorld().getPlayers())
      {
        double d = loc.distanceSquared(pl.getLocation());
        if (d < distance && pl.getItemInHand() != null &&
          pl.getItemInHand().getType() == Material.MONSTER_EGG)
        { spawner = pl; distance = d; }
      }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

      {
        // try to determine if this was the first tnt in a chain
        if ((apl = match.getNearestPlayer(tntLocation)) == null) return;

        Location plLocation = apl.getLocation();
        if (plLocation.distanceSquared(tntLocation) > TNT_PRIME_RANGE * TNT_PRIME_RANGE) return;
      }

      // add an owner for this tnt object
      if (apl != null) plugin.setTNTOwner(event.getEntity(), apl);
    }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

    double sqd, bsqd = -1.0;

    for (Vector vec : directions)
    {
      x = TeleportationUtil.checkDirection(c, vec);
      sqd = x.distanceSquared(best);
      if (sqd > bsqd) { bsqd = sqd; best = x; }
    }

    // return a location that is looking at the target
    Location dest = locationLookingAt(best, loc);
View Full Code Here

Examples of org.terasology.math.Vector3i.distanceSquared()

            return score(o1.getPosition()) - score(o2.getPosition());
        }

        private int score(Vector3i chunk) {
            Vector3i playerChunk = TeraMath.calcChunkPos(new Vector3i(localPlayer.getPosition(), 0.5f));
            return playerChunk.distanceSquared(chunk);
        }
    }

    private class ReadyChunkRelevanceComparator implements Comparator<Chunk> {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.