Add some of the Easter Particles

This commit is contained in:
2025-03-03 09:35:42 +01:00
parent 85c0db873c
commit 0a60654a28
16 changed files with 251 additions and 36 deletions
@@ -1,10 +1,13 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.Gradient;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import org.bukkit.Particle;
import java.awt.*;
public class DustParticle implements ParticleElement {
private Particle particle;
@@ -13,32 +16,44 @@ public class DustParticle implements ParticleElement {
private float vz = 0.01f;
private double speed = 0.01;
private int count = 5;
private Gradient gradient;
public DustParticle(Particle particle) {
public DustParticle(Particle particle, Gradient gradient) {
this.particle = particle;
this.gradient = gradient;
}
public DustParticle(Particle particle, float vx, float vy, float vz) {
public DustParticle(Particle particle, float vx, float vy, float vz, Gradient gradient) {
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.gradient = gradient;
}
public DustParticle(Particle particle, float vx, float vy, float vz, double speed, int count) {
public DustParticle(Particle particle, float vx, float vy, float vz, double speed, int count, Gradient gradient) {
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.speed = speed;
this.count = count;
this.gradient = gradient;
}
@Override
public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
Particle.DustOptions dustOptions;
if (gradient != null) {
double result = particleTickData.getDeg() % 360;
Color color = gradient.getColor(result, 360);
dustOptions = withColor(color.getRed(), color.getGreen(), color.getBlue());
} else {
dustOptions = randomParticleDust();
}
display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust());
player.spawnParticle(particle, location, count, vx, vy, vz, speed, dustOptions);
});
}
}