svdragster

Untitled

Nov 26th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. Effect effect = Effect.COLOURED_DUST;
  2. Location pointA = attacker.getEyeLocation();
  3. Location pointB = attacker.getEyeLocation().add(attacker.getEyeLocation().getDirection().normalize().multiply(5));
  4. int numberOfPointsBetweenAAndB = 10;
  5.  
  6. World tempWorld = pointA.getWorld();
  7. int timeIterated = 0;
  8. double xIncrement = 0.0D;
  9. double yIncrement = 0.0D;
  10. double zIncrement = 0.0D;
  11. double currentX = 0.0D;
  12. double currentY = 0.0D;
  13. double currentZ = 0.0D;
  14.  
  15. VisibleCheck:
  16. for (int i = 0; i < numberOfPointsBetweenAAndB; i++) {
  17.     if (timeIterated > numberOfPointsBetweenAAndB) {
  18.         return;
  19.     }
  20.     if (timeIterated == 0) {
  21.         currentX = pointA.getX();
  22.         currentY = pointA.getY();
  23.         currentZ = pointA.getZ();
  24.         xIncrement = (currentX - pointB.getX()) / numberOfPointsBetweenAAndB;
  25.         yIncrement = (currentY - pointB.getY()) / numberOfPointsBetweenAAndB;
  26.         zIncrement = (currentZ - pointB.getZ()) / numberOfPointsBetweenAAndB;
  27.         Location thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
  28.        
  29.         Block block = tempWorld.getBlockAt(thisLoc);
  30.        
  31.         tempWorld.playEffect(thisLoc, effect, 0);
  32.        
  33.         timeIterated++;
  34.     } else {
  35.         currentX -= xIncrement;
  36.         currentY -= yIncrement;
  37.         currentZ -= zIncrement;
  38.         Location thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
  39.        
  40.         Block block = tempWorld.getBlockAt(thisLoc);
  41.  
  42.         tempWorld.playEffect(thisLoc, effect, 0);
  43.         timeIterated++;
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment