feat: control lines

This commit is contained in:
gdamms 2022-05-14 19:42:35 +02:00
parent 929cdc5967
commit 6c7f9f2e94
2 changed files with 21 additions and 8 deletions

View file

@ -7,9 +7,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

View file

@ -5,16 +5,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.Bukkit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Particle;
import org.bukkit.World;
@ -56,12 +53,31 @@ public class ShowCurve implements CommandExecutor {
// Get curve iterator
Iterator<Location> curveIterator = Camera.curve.iterator();
// Summon particles
// Draw path
while (curveIterator.hasNext()) {
player.getWorld().spawnParticle(Particle.FLAME,
player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK,
curveIterator.next().clone().add(0, 1.8, 0), 1,
0, 0, 0, 0);
}
// Draw control lines
if (Camera.controlPoints.size() >= 4) {
int nAnchor = (Camera.controlPoints.size() - 1) / 3 + 1;
for (int i = 0; i < nAnchor; i++) {
int indMin = Math.max(3 * i - 1, 0);
int indMax = Math.min(3 * i + 1, Camera.controlPoints.size() - 1);
for (float t = 0; t < 1; t += 0.05) {
player.getWorld().spawnParticle(Particle.COMPOSTER,
Camera.controlPoints.get(indMin).clone().multiply(1 - t)
.add(Camera.controlPoints.get(indMax).clone()
.multiply(t))
.add(0, 1.8, 0),
1,
0, 0, 0, 0);
}
}
}
}
}, 0, 0);