Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void playEffectLine(Effect effect, int effectData, Location pointA, Location pointB, int numberOfPointsBetweenAAndB) {
- int timeIterated = 0;
- double xIncrement = 0, yIncrement = 0, zIncrement = 0;
- double currentX = 0, currentY = 0, currentZ = 0;
- 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(pointA.getWorld(), currentX, currentY, currentZ);
- pointA.getWorld().playEffect(thisLoc, effect, effectData);
- timeIterated++;
- continue;
- }
- currentX -= xIncrement;
- currentY -= yIncrement;
- currentZ -= zIncrement;
- Location thisLoc = new Location(pointA.getWorld(), currentX, currentY, currentZ);
- pointA.getWorld().playEffect(thisLoc, effect, effectData);
- timeIterated++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement