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