Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Effect effect = Effect.COLOURED_DUST;
- Location pointA = attacker.getEyeLocation();
- Location pointB = attacker.getEyeLocation().add(attacker.getEyeLocation().getDirection().normalize().multiply(5));
- int numberOfPointsBetweenAAndB = 10;
- 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) {
- return;
- }
- 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;
- Location thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
- Block block = tempWorld.getBlockAt(thisLoc);
- tempWorld.playEffect(thisLoc, effect, 0);
- timeIterated++;
- } else {
- currentX -= xIncrement;
- currentY -= yIncrement;
- currentZ -= zIncrement;
- Location thisLoc = new Location(tempWorld, currentX, currentY, currentZ);
- Block block = tempWorld.getBlockAt(thisLoc);
- tempWorld.playEffect(thisLoc, effect, 0);
- timeIterated++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment