Change Legend Aura to green

This commit is contained in:
Graphica 2017-06-28 18:33:00 -04:00 committed by cnr
parent 2021a7e321
commit c33c8998f8
1 changed files with 25 additions and 34 deletions

View File

@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.particle;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -19,32 +18,27 @@ import mineplex.core.inventory.ClientItem;
import mineplex.core.inventory.data.Item; import mineplex.core.inventory.data.Item;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.util.Vector;
import java.awt.Color; import java.awt.Color;
import java.util.Random;
public class ParticleLegend extends ParticleGadget public class ParticleLegend extends ParticleGadget
{ {
private static final double PI = Math.PI; private static final double PI = Math.PI;
private static final int BASE_PILLARS = 9; private static final int BASE_PILLARS = 9;
private static final int PILLAR_VARIANCE = 7; private static final int PILLAR_VARIANCE = 8;
private static final int COLOR_VARIANCE = 5;
private static final int MOVING_PARTICLES = 8; private static final int MOVING_PARTICLES = 8;
private static final double VERTICAL_SPEED = 0.1; private static final double VERTICAL_SPEED = 0.1;
private static final double HEIGHT_VARIANCE = 0.8; private static final double HEIGHT_VARIANCE = 0.8;
private static final double ROTATIONAL_SPEED = .03; private static final double ROTATIONAL_SPEED = .03;
private static final double RADIAL_VARIANCE = 0.09; private static final double RADIAL_VARIANCE = 0.09;
private static final double DARK_PARTICLE_CHANCE = 0.5;
private static final double BASE_RADIUS = 1.30; private static final double BASE_RADIUS = 1.30;
private static final double HEIGHT_MODIFIER_BASE = 0.1; private static final double HEIGHT_MODIFIER_BASE = 0.1;
private static final double HEIGHT_MODIFIER_MAX = 1.3; private static final double HEIGHT_MODIFIER_MAX = 1.3;
private static final double HEIGHT_MODIFIER_INTERVAL = 0.2; private static final double HEIGHT_MODIFIER_INTERVAL = 0.15;
private static final Color[] SELECTABLE_COLORS = { private static final Color[] SELECTABLE_COLORS = {
new Color(170, 100, 170), new Color(60, 170, 25),
new Color(50, 10, 60), new Color(33, 92, 13),
new Color(120, 10, 170), new Color(0, 0, 0)
new Color(65, 20, 80)
}; };
private final int _pillars = pillars(); private final int _pillars = pillars();
@ -58,7 +52,7 @@ public class ParticleLegend extends ParticleGadget
public ParticleLegend(GadgetManager manager) public ParticleLegend(GadgetManager manager)
{ {
super(manager, "Legendary Aura", super(manager, "Legendary Aura",
UtilText.splitLineToArray(C.cGray + "Let the energy of the End protect you.", LineFormat.LORE), UtilText.splitLineToArray(C.cGray + "Legendary energy protects you.", LineFormat.LORE),
-1, -1,
Material.ENDER_PORTAL_FRAME, (byte)0); Material.ENDER_PORTAL_FRAME, (byte)0);
} }
@ -73,12 +67,19 @@ public class ParticleLegend extends ParticleGadget
if (Manager.isMoving(player)) if (Manager.isMoving(player))
{ {
Location loc = player.getLocation().add(0, 1.5, 0);
for (int i = 0; i < MOVING_PARTICLES; i++) for (int i = 0; i < MOVING_PARTICLES; i++)
{ {
UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST, if (_colors[i].getGreen() == 0)
UtilMath.gauss(loc, 8, 4, 8), 0, UtilParticle.ViewDist.NORMAL); {
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SMOKE,
UtilMath.gauss(player.getLocation(), 8, 4, 8), null, 0, 1, UtilParticle.ViewDist.NORMAL);
}
else
{
UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST,
UtilMath.gauss(player.getLocation(), 8, 4, 8), 0, UtilParticle.ViewDist.NORMAL);
}
} }
} }
else else
@ -96,12 +97,14 @@ public class ParticleLegend extends ParticleGadget
for (double h = HEIGHT_MODIFIER_BASE; h <= HEIGHT_MODIFIER_MAX; h+= HEIGHT_MODIFIER_INTERVAL) for (double h = HEIGHT_MODIFIER_BASE; h <= HEIGHT_MODIFIER_MAX; h+= HEIGHT_MODIFIER_INTERVAL)
{ {
UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST, if (_colors[i].getGreen() == 0)
new Location(player.getWorld(), x, y + h, z), 0, UtilParticle.ViewDist.NORMAL);
if (Math.random() < DARK_PARTICLE_CHANCE)
{ {
UtilParticle.playColoredParticleToAll(Color.BLACK, UtilParticle.ParticleType.RED_DUST, UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SMOKE,
new Location(player.getWorld(), x, y + h, z), null, 0, 1, UtilParticle.ViewDist.NORMAL);
}
else
{
UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST,
new Location(player.getWorld(), x, y + h, z), 0, UtilParticle.ViewDist.NORMAL); new Location(player.getWorld(), x, y + h, z), 0, UtilParticle.ViewDist.NORMAL);
} }
} }
@ -175,23 +178,11 @@ public class ParticleLegend extends ParticleGadget
private Color[] colors() private Color[] colors()
{ {
Random random = new Random();
Color[] array = new Color[_pillars]; Color[] array = new Color[_pillars];
for (int i = 0; i < _pillars; i++) for (int i = 0; i < _pillars; i++)
{ {
Color color = SELECTABLE_COLORS[i % SELECTABLE_COLORS.length]; array[i] = SELECTABLE_COLORS[i % SELECTABLE_COLORS.length];
int r = color.getRed() + (int) (random.nextGaussian() * COLOR_VARIANCE);
int g = color.getGreen() + (int) (random.nextGaussian() * COLOR_VARIANCE);
int b = color.getBlue() + (int) (random.nextGaussian() * COLOR_VARIANCE);
r = Math.min(255, Math.max(0, r));
g = Math.min(255, Math.max(0, g));
b = Math.min(255, Math.max(0, b));
array[i] = new Color(r, g, b);
} }
return array; return array;
@ -213,7 +204,7 @@ public class ParticleLegend extends ParticleGadget
return value; return value;
} }
@EventHandler @EventHandler
public void legendOwner(PlayerJoinEvent event) public void legendOwner(PlayerJoinEvent event)
{ {