Added love wings
This commit is contained in:
parent
33cb3b74fc
commit
03c2ec56b7
@ -5,7 +5,7 @@ import org.bukkit.Location;
|
||||
/**
|
||||
* Interface used by classes which can display visuals at provided locations.
|
||||
*/
|
||||
public interface CosmeticShape
|
||||
public interface ICosmeticShape
|
||||
{
|
||||
/**
|
||||
* Display a visual at the given location
|
@ -1,17 +1,21 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.particles.ColoredParticle;
|
||||
import mineplex.core.common.util.particles.DustSpellColor;
|
||||
|
||||
/**
|
||||
* Some simple wing shapes implementing {@link ICosmeticShape} storing additional particle information
|
||||
*/
|
||||
|
||||
public class ShapeWings extends ShapeGrid implements CosmeticShape
|
||||
public class ShapeWings extends ShapeGrid implements ICosmeticShape
|
||||
{
|
||||
public static final String[] ANGEL_WING_PATTERN = new String[]
|
||||
{
|
||||
@ -168,12 +172,23 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
|
||||
{
|
||||
Shape clone = clone();
|
||||
clone.rotateOnYAxis(Math.toRadians(loc.getYaw()));
|
||||
for(Vector v : clone._points)
|
||||
for (Vector v : clone.getPoints())
|
||||
{
|
||||
Location ploc = loc.clone().add(v);
|
||||
displayParticle(ploc);
|
||||
}
|
||||
}
|
||||
|
||||
public void displayColored(Location loc, Color color)
|
||||
{
|
||||
Shape clone = clone();
|
||||
clone.rotateOnYAxis(Math.toRadians(loc.getYaw()));
|
||||
for (Vector v : clone.getPoints())
|
||||
{
|
||||
Location ploc = loc.clone().add(v);
|
||||
displayColored(ploc, color);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a single particle of the type provided to this shape at the given location.
|
||||
@ -183,4 +198,10 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
|
||||
UtilParticle.PlayParticleToAll(_particle, loc, _offsetData, _speed, _count, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
public void displayColoredParticle(Location loc, Color color)
|
||||
{
|
||||
ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), loc);
|
||||
coloredParticle.display(ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import java.awt.Color;
|
||||
|
||||
public class DustSpellColor extends ParticleColor
|
||||
{
|
||||
|
@ -0,0 +1,50 @@
|
||||
package mineplex.core.gadget.gadgets.particle;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.shape.ShapeWings;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ParticleWingsLove extends ParticleGadget
|
||||
{
|
||||
|
||||
private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
||||
private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.HEART.particleName, new Vector(0, 0, 0), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
||||
|
||||
public ParticleWingsLove(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Love Wings",
|
||||
UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE),
|
||||
-17, Material.NETHER_STAR, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playParticle(Player player, UpdateEvent event)
|
||||
{
|
||||
Location loc = player.getLocation().add(0, 1.2, 0).add(player.getLocation().getDirection().multiply(-0.2));
|
||||
if (Manager.isMoving(player))
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
_wings.displayColoredParticle(loc, Color.PINK);
|
||||
_wingsEdge.displayParticle(loc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST) _wings.displayColored(loc, Color.PINK);
|
||||
if (event.getType() == UpdateType.FAST) _wingsEdge.display(loc);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user