Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final List<Entity> nearby = player.getNearbyEntities(6, 6, 6);
- Location pointA = player.getEyeLocation();
- Location pointB = player.getEyeLocation().add(player.getEyeLocation().getDirection().normalize().multiply(5));
- int numberOfPointsBetweenAAndB = 25;
- World tempWorld = pointA.getWorld();
- int timeIterated = 0;
- double xIncrement = 0.0D;
- double yIncrement = 0.0D;
- double zIncrement = 0.0D;
- double currentX = 0.0D;
- double currentY = 0.0D;
- double currentZ = 0.0D;
- VisibleCheck:
- for (int i = 0; i < numberOfPointsBetweenAAndB; i++) {
- if (timeIterated > numberOfPointsBetweenAAndB) {
- break VisibleCheck;
- }
- Location thisLoc;
- if (timeIterated == 0) {
- currentX = pointA.getX();
- currentY = pointA.getY();
- currentZ = pointA.getZ();
- xIncrement = (currentX - pointB.getX()) / numberOfPointsBetweenAAndB;
- yIncrement = (currentY - pointB.getY()) / numberOfPointsBetweenAAndB;
- zIncrement = (currentZ - pointB.getZ()) / numberOfPointsBetweenAAndB;
- thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
- timeIterated++;
- } else {
- currentX -= xIncrement;
- currentY -= yIncrement;
- currentZ -= zIncrement;
- thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
- }
- Block block = tempWorld.getBlockAt(thisLoc);
- if (block.getType() != Material.AIR) {
- airOnly = false;
- if (!Raziel.isTransparent(block.getType())) {
- break VisibleCheck;
- }
- }
- for (Entity nearbyEntity : nearby) {
- if (nearbyEntity.getType() == EntityType.PLAYER && !nearbyEntity.equals(player)) {
- final LivingEntity living = (LivingEntity) nearbyEntity;
- final Location loc = nearbyEntity.getLocation();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment