mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-07-30 17:31:52 +00:00
Add style 'pulse'
This commit is contained in:
parent
00127ca017
commit
230106ecf7
4 changed files with 95 additions and 5 deletions
|
@ -2,12 +2,9 @@
|
|||
* TODO: v6.4+
|
||||
* + Add new style(s) 'wings_<type>', multiple new wing types: fairy, demon
|
||||
* + Add ability to create/manage fixed effects from the GUI (may get implemented later)
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO: v6.3
|
||||
* + Add named colors to the color data
|
||||
* * Display effects/styles in the GUI formatted to be more readable
|
||||
* + Add effect/style name customization through config files
|
||||
* + Add effect/style settings folder that lets you disable effects/style and edit style properties
|
||||
* + Possibly add a couple new styles (tornado, doubleorbit)
|
||||
*/
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public class DefaultStyles {
|
|||
public static final ParticleStyle ORBIT = new ParticleStyleOrbit();
|
||||
public static final ParticleStyle OVERHEAD = new ParticleStyleOverhead();
|
||||
public static final ParticleStyle POINT = new ParticleStylePoint();
|
||||
public static final ParticleStyle PULSE = new ParticleStylePulse();
|
||||
public static final ParticleStyle QUADHELIX = new ParticleStyleQuadhelix();
|
||||
public static final ParticleStyle RINGS = new ParticleStyleRings();
|
||||
public static final ParticleStyle SPHERE = new ParticleStyleSphere();
|
||||
|
@ -65,6 +66,7 @@ public class DefaultStyles {
|
|||
ParticleStyleManager.registerStyle(ORBIT);
|
||||
ParticleStyleManager.registerStyle(OVERHEAD);
|
||||
ParticleStyleManager.registerStyle(POINT);
|
||||
ParticleStyleManager.registerStyle(PULSE);
|
||||
ParticleStyleManager.registerStyle(QUADHELIX);
|
||||
ParticleStyleManager.registerStyle(RINGS);
|
||||
ParticleStyleManager.registerStyle(SPHERE);
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package com.esophose.playerparticles.styles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.esophose.playerparticles.particles.ParticleEffect;
|
||||
import com.esophose.playerparticles.particles.ParticlePair;
|
||||
import com.esophose.playerparticles.styles.api.PParticle;
|
||||
import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||
|
||||
public class ParticleStylePulse implements ParticleStyle {
|
||||
|
||||
private int points = 50;
|
||||
private double radius = 0.75;
|
||||
private double step = 0;
|
||||
private int numSteps = 15;
|
||||
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<PParticle>();
|
||||
double speed = getSpeedByEffect(particle.getEffect());
|
||||
|
||||
if (step == 0) {
|
||||
for (int i = 0; i < points; i++) {
|
||||
double dx = Math.cos(Math.PI * 2 * ((double)i / points)) * radius;
|
||||
double dy = -0.9;
|
||||
double dz = Math.sin(Math.PI * 2 * ((double)i / points)) * radius;
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = Math.cos(angle);
|
||||
double zAng = Math.sin(angle);
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz), xAng, 0, zAng, speed, true));
|
||||
}
|
||||
}
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
||||
private double getSpeedByEffect(ParticleEffect effect) {
|
||||
switch (effect) {
|
||||
case CRIT:
|
||||
case DAMAGE_INDICATOR:
|
||||
case ENCHANTED_HIT:
|
||||
return 1;
|
||||
case DRAGON_BREATH:
|
||||
return 0.01;
|
||||
case ENCHANT:
|
||||
case NAUTILUS:
|
||||
case PORTAL:
|
||||
return radius;
|
||||
case END_ROD:
|
||||
case SMOKE:
|
||||
case SQUID_INK:
|
||||
return 0.15;
|
||||
case FIREWORK:
|
||||
case SPIT:
|
||||
case SPLASH:
|
||||
return 0.25;
|
||||
case POOF:
|
||||
return 0.2;
|
||||
case TOTEM_OF_UNDYING:
|
||||
return 0.75;
|
||||
default:
|
||||
return 0.1; // Flame
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTimers() {
|
||||
step = (step + 1) % numSteps;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "pulse";
|
||||
}
|
||||
|
||||
public boolean canBeFixed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canToggleWithMovement() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getFixedEffectOffset() {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
}
|
|
@ -338,6 +338,9 @@ gui-icon:
|
|||
- GLOWSTONE
|
||||
point:
|
||||
- STONE_BUTTON
|
||||
pulse:
|
||||
- REDSTONE_TORCH
|
||||
- REDSTONE_TORCH_ON
|
||||
quadhelix:
|
||||
- NAUTILUS_SHELL
|
||||
- ACTIVATOR_RAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue