Class XParticle
public final class XParticle extends Object
This utility uses
ParticleDisplay
for cleaner code. This class adds the ability
to define the optional values for spawning particles.
While this class provides many methods with options to spawn unique shapes,
it's recommended to make your own shapes by copying the code from these methods.
There are some shapes such as the magic circles, illuminati and the explosion method
that mainly focus on using the other methods to create a new shape.
Note that some of the values for some methods are extremely sensitive and can change
the shape significantly by adding small numbers such as 0.5 Yes, Chaos theory.
Most of the method parameters have a recommended value set to start with.
Note that these values are there to show how the intended normal shape
looks like before you start changing the values.
All the parameters and return types are not null.
It's recommended to use low particle counts.
In most cases, increasing the rate is better than increasing the particle count.
Most of the methods provide an option called "rate" that you can get more particles
by decreasing the distance between each point the particle spawns.
Rates for methods act in two ways. They're either for straight lines like the polygon
method which lower rate means more points (usually 0.1 is used) and shapes that are curved such as
the circle method, which higher rate means more points (these types of rates usually start from 30).
Most of the ParticleDisplay
used in this class are intended to
have 1 particle count and 0 xyz offset and speed.
Particles are rendered as front-facing 2D sprites, meaning they always face the player. Minecraft clients will automatically clear previous particles if you reach the limit. Particle range is 32 blocks. Particle count limit is 16,384. Particles are not entities.
All the methods and operations used in this class are thread-safe.
Most of the methods do not run asynchronous by default.
If you're doing a resource intensive operation it's recommended
to either use CompletableFuture.runAsync(Runnable)
or
BukkitRunnable.runTaskTimerAsynchronously(Plugin, long, long)
for
smoothly animated shapes.
For huge animations you can use splittable tasks.
https://www.spigotmc.org/threads/409003/
By "huge", the algorithm used to generate locations is considered. You should not spawn
a lot of particles at once. This will cause FPS drops for most of
the clients, unless they have a powerful PC.
You can test your 2D shapes at Desmos
Stuff you can do with with
Java Math
Getting started with Vectors
Extra stuff if you want to read more: https://www.spigotmc.org/threads/418399/
Particles: https://minecraft.gamepedia.com/Particles
- Version:
- 4.0.0
- Author:
- Crypto Morin
- See Also:
ParticleDisplay
,Particle
,Location
,Vector
-
Field Summary
Fields Modifier and Type Field Description static double
PII
A full circle has two PIs. -
Constructor Summary
Constructors Constructor Description XParticle()
-
Method Summary
Modifier and Type Method Description static void
atom(int orbits, double radius, double rate, ParticleDisplay orbit, ParticleDisplay nucleus)
Spawns an atom with orbits and a nucleus.static void
atomic(org.bukkit.plugin.java.JavaPlugin plugin, int orbits, double radius, double rate, ParticleDisplay orbit)
Spawns multiple animated atomic-like circles rotating around in their orbit.static void
blackhole(org.bukkit.plugin.java.JavaPlugin plugin, int points, double radius, double rate, int mode, ParticleDisplay display)
Spawn a blackhole.static void
blackSun(double radius, double radiusRate, double rate, double rateChange, ParticleDisplay display)
Creates a blacksun-like increasing circles.static void
cage(org.bukkit.Location start, org.bukkit.Location end, double rate, double barRate, ParticleDisplay display)
Spawns a cage.static org.bukkit.scheduler.BukkitTask
chaoticDoublePendulum(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double gravity, double length, double length2, double mass1, double mass2, boolean Dimension3, int speed, ParticleDisplay display)
Spawns a double pendulum with chaotic movement.static void
circle(double radius, double radius2, double extension, double rate, double limit, ParticleDisplay display)
Spawns a circle.static void
circle(double radius, double rate, ParticleDisplay display)
Spawn a circle.static org.bukkit.scheduler.BukkitTask
circularBeam(org.bukkit.plugin.java.JavaPlugin plugin, double maxRadius, double rate, double radiusRate, double extend, ParticleDisplay display)
Spawns connected 3D ellipses.static org.bukkit.scheduler.BukkitTask
cloud(org.bukkit.plugin.java.JavaPlugin plugin, ParticleDisplay cloud, ParticleDisplay rain)
A simple method to spawn animated clouds effect.static void
cone(double height, double radius, double rate, double circleRate, ParticleDisplay display)
Spawn a cone.static void
crescent(double radius, double rate, ParticleDisplay display)
Spawns a crescent.static void
cube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)
Spawns a cube with the inner space empty.static void
cylinder(double height, double radius, double rate, ParticleDisplay display)
Not really a cylinder.static void
diamond(double radiusRate, double rate, double height, ParticleDisplay display)
Spawns a diamond-shaped rhombus.static void
displayRenderedImage(Map<org.bukkit.Location,org.bukkit.Color> render, org.bukkit.Location location, int quality, int speed, float size)
Display a rendered image repeatedly.static org.bukkit.scheduler.BukkitTask
displayRenderedImage(org.bukkit.plugin.java.JavaPlugin plugin, Map<org.bukkit.Location,org.bukkit.Color> render, Callable<org.bukkit.Location> location, int repeat, long period, int quality, int speed, float size)
Display a rendered image repeatedly.static void
dna(double radius, double rate, double extension, int height, int hydrogenBondDist, ParticleDisplay display, ParticleDisplay hydrogenBondDisplay)
Spawn a DNA double helix string with nucleotides.static org.bukkit.scheduler.BukkitTask
dnaReplication(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double rate, int speed, double extension, int height, int hydrogenBondDist, ParticleDisplay display)
Spawn an animated DNA replication with colored bonds.static void
drawLine(org.bukkit.entity.Player player, double length, double rate, ParticleDisplay display)
Draws a line from the player's looking direction.static void
ellipse(double radius, double otherRadius, double rate, ParticleDisplay display)
Spawn an ellipse.static void
explosionWave(org.bukkit.plugin.java.JavaPlugin plugin, double rate, ParticleDisplay display, ParticleDisplay secDisplay)
A sin/cos based smoothly animated explosion wave.static void
eye(double radius, double radius2, double rate, double extension, ParticleDisplay display)
Spawns an eye-shaped circle.static void
filledCircle(double radius, double rate, double radiusRate, ParticleDisplay display)
Spawns a filled cirlce using circles.static void
filledCube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)
Spawn a cube with all the space filled with particles inside.static void
flower(int count, double radius, ParticleDisplay display, Runnable runnable)
Spawns the given shape(s) in the runnable in a circular form.static org.bukkit.Particle
getParticle(String particle)
An optimized and stable way of getting particles for cross-version support.static org.bukkit.scheduler.BukkitTask
guard(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)
This will move the particle around in an area randomly.static void
heart(double cut, double cutAngle, double depth, double compressHeight, double rate, ParticleDisplay display)
Spawns a circle with heart shaped circles sticking out.static org.bukkit.scheduler.BukkitTask
helix(org.bukkit.plugin.java.JavaPlugin plugin, int strings, double radius, double rate, double extension, int height, int speed, boolean fadeUp, boolean fadeDown, ParticleDisplay display)
Spawns animated helix shapes.static void
hypercube(org.bukkit.Location startOrigin, org.bukkit.Location endOrigin, double rate, double sizeRate, int cubes, ParticleDisplay display)
Inaccurate representation of hypercubes.static void
illuminati(double size, double extension, ParticleDisplay display)
Spawns an illuminati shape.static void
infinity(double radius, double rate, ParticleDisplay display)
Spawn a 3D infinity sign.static void
julia(double size, double zoom, int colorScheme, double moveX, double moveY, ParticleDisplay display)
Spawns a julia set.static void
lightning(org.bukkit.Location start, org.bukkit.util.Vector direction, int entries, int branches, double radius, double offset, double offsetRate, double length, double lengthRate, double branch, double branchRate, ParticleDisplay display)
Spawns a broken line that creates more and extended branches as it gets closer to the end length.static void
line(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)
Spawns a line from a location to another.static org.bukkit.scheduler.BukkitTask
magicCircles(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double rate, double radiusRate, double distance, ParticleDisplay display)
Spawns circles increasing their radius.static void
mandelbrot(double size, double zoom, double rate, double x0, double y0, int color, ParticleDisplay display)
Spawns a mandelbrot set.static void
meguminExplosion(org.bukkit.plugin.java.JavaPlugin plugin, double size, ParticleDisplay display)
This is supposed to be something similar to this: https://www.deviantart.com/pwincessstar/art/701840646 The numbers on this shape are really sensitive.static org.bukkit.scheduler.BukkitTask
moveAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double endRate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)
This will move the particle around in an area randomly.static org.bukkit.scheduler.BukkitTask
moveRotatingAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)
This will move the shape around in an area randomly while rotating them.static void
neopaganPentagram(double size, double rate, double extend, ParticleDisplay star, ParticleDisplay circle)
https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Pentagram_within_circle.svg/800px-Pentagram_within_circle.svg.pngstatic void
polygon(int points, int connection, double size, double rate, double extend, ParticleDisplay display)
Spawns a connected 2D polygon.static void
rainbow(double radius, double rate, double curve, double layers, double compact, ParticleDisplay display)
Spawns a rainbow.static int
randInt(int min, int max)
A thread safe way to get a random integer in a range.static double
random(double min, double max)
A thread safe way to get a random double in a range.static org.bukkit.Color
randomColor()
Generate a random RGB color for particles.static org.bukkit.Particle.DustOptions
randomDust()
Generate a random colorized dust with a random size.static org.bukkit.Particle
randomParticle(String... particles)
Get a random particle from a list of particle names.static void
rectangle(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)
Spawns a rectangle.static CompletableFuture<Map<org.bukkit.Location,org.bukkit.Color>>
renderImage(BufferedImage image, int resizedWidth, int resizedHeight, double compact)
Renders every pixel of the image and saves the location and the particle colors to a map.static CompletableFuture<Map<org.bukkit.Location,org.bukkit.Color>>
renderImage(Path path, int resizedWidth, int resizedHeight, double compact)
Renders a resized image.static void
ring(double rate, double radius, double tubeRadius, ParticleDisplay display)
Spawns a donut-shaped ring.static org.bukkit.scheduler.BukkitTask
rotateAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)
This will rotate the shape around in an area randomly.static org.bukkit.util.Vector
rotateAroundX(org.bukkit.util.Vector vector, double angle)
Rotates vector around the X axis with the specified angle.static org.bukkit.util.Vector
rotateAroundY(org.bukkit.util.Vector vector, double angle)
Rotates vector around the Y axis with the specified angle.static org.bukkit.util.Vector
rotateAroundZ(org.bukkit.util.Vector vector, double angle)
Rotates vector around the Z axis with the specified angle.static void
saveImage(BufferedImage image, Path path)
A simple method used to save images.static void
sphere(double radius, double rate, ParticleDisplay display)
Spawn a sphere.static void
spikeSphere(double radius, double rate, int chance, double minRandomDistance, double maxRandomDistance, ParticleDisplay display)
Spawns a sphere with spikes coming out from the center.static void
spread(org.bukkit.plugin.java.JavaPlugin plugin, int amount, int rate, org.bukkit.Location start, org.bukkit.Location originEnd, double offsetx, double offsety, double offsetz, ParticleDisplay display)
Spawns animated spikes randomly spreading at the end location.static void
star(org.bukkit.plugin.java.JavaPlugin plugin, int points, int spikes, double rate, double spikeLength, double coreRadius, double neuron, boolean prototype, int speed, ParticleDisplay display)
Spawn 3D spiked circles.static CompletableFuture<BufferedImage>
stringToImage(Font font, Color color, String str)
Converts a string to an image which can be used to display as a particle.static void
structuredCube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)
spawn a cube with the inner space and walls empty, leaving only the edges visible.static org.bukkit.scheduler.BukkitTask
tesseract(org.bukkit.plugin.java.JavaPlugin plugin, double size, double rate, double speed, long ticks, ParticleDisplay display)
Animated 4D tesseract using matrix motion.static org.bukkit.scheduler.BukkitTask
testDisplay(org.bukkit.plugin.java.JavaPlugin plugin, Runnable runnable)
A simple test method to spawn a shape repeatedly for diagnosis.static org.bukkit.scheduler.BukkitTask
vortex(org.bukkit.plugin.java.JavaPlugin plugin, int points, double rate, ParticleDisplay display)
Spawns a galaxy-like vortex.static void
waveFunction(double extend, double heightRange, double size, double rate, ParticleDisplay display)
Something similar to Quantum Wave function
-
Field Details
-
PII
public static final double PIIA full circle has two PIs. Don't know what the fuck is a PI? You can watch this YouTube videoPI is a radian number itself. So you can obtain other radians by simply dividing PI. Some simple ones:
Important Radians:
PI / 2 = 90 degrees PI / 3 = 60 degrees PI / 4 = 45 degrees PI / 6 = 30 degrees
Any degree can be converted simply be usingPI/180 * degree
- Since:
- 1.0.0
- See Also:
Math.toRadians(double)
,Math.toDegrees(double)
, Constant Field Values
-
-
Constructor Details
-
XParticle
public XParticle()
-
-
Method Details
-
getParticle
An optimized and stable way of getting particles for cross-version support.- Parameters:
particle
- the particle name.- Returns:
- a particle that matches the specified name.
- Since:
- 1.0.0
-
randomParticle
Get a random particle from a list of particle names.- Parameters:
particles
- the particles name.- Returns:
- a random particle from the list.
- Since:
- 1.0.0
-
random
public static double random(double min, double max)A thread safe way to get a random double in a range.- Parameters:
min
- the minimum number.max
- the maximum number.- Returns:
- a random number.
- Since:
- 1.0.0
- See Also:
randInt(int, int)
-
randInt
public static int randInt(int min, int max)A thread safe way to get a random integer in a range.- Parameters:
min
- the minimum number.max
- the maximum number.- Returns:
- a random number.
- Since:
- 1.0.0
- See Also:
random(double, double)
-
randomColor
public static org.bukkit.Color randomColor()Generate a random RGB color for particles.- Returns:
- a random color.
- Since:
- 1.0.0
-
randomDust
public static org.bukkit.Particle.DustOptions randomDust()Generate a random colorized dust with a random size.- Returns:
- a REDSTONE colored dust.
- Since:
- 1.0.0
-
blackSun
public static void blackSun(double radius, double radiusRate, double rate, double rateChange, ParticleDisplay display)Creates a blacksun-like increasing circles.- Parameters:
radius
- the radius of the biggest circle.radiusRate
- the radius rate change of circles.rate
- the rate of the biggest cirlce points.rateChange
- the rate change of circle points.- Since:
- 1.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
circle
Spawn a circle.- Parameters:
radius
- the circle radius.rate
- the rate of cirlce points/particles.- Since:
- 1.0.0
- See Also:
sphere(double, double, ParticleDisplay)
,circle(double, double, double, double, double, ParticleDisplay)
-
circle
public static void circle(double radius, double radius2, double extension, double rate, double limit, ParticleDisplay display)Spawns a circle. Most common shapes that can be built:The simplest shape, a circle circle(3, 3, 1, 30, 0, display); An ellipse only has a different radius for one of its waves. circle(3, 4, 1, 30, 0, display);
Tutorial: https://www.spigotmc.org/threads/111238/ Uses its own unique directional pattern.
- Parameters:
radius
- the first radius of the circle.radius2
- the second radius of the circle.extension
- the extension of the circle waves.rate
- the rate of the circle points.limit
- the limit of the circle. Usually from 0 to PII. If you choose 0, it'll be a full circlePII
If you choose -1, it'll do a full loop based on the extension.- See Also:
illuminati(double, double, ParticleDisplay)
,eye(double, double, double, double, ParticleDisplay)
-
diamond
Spawns a diamond-shaped rhombus.- Parameters:
radiusRate
- the radius of the diamond. Lower means longer radius.rate
- the rate of the diamond points.height
- the height of the diamond.- Since:
- 4.0.0
-
circularBeam
public static org.bukkit.scheduler.BukkitTask circularBeam(org.bukkit.plugin.java.JavaPlugin plugin, double maxRadius, double rate, double radiusRate, double extend, ParticleDisplay display)Spawns connected 3D ellipses.- Parameters:
plugin
- the timer handler.maxRadius
- the maximum radius for the ellipses.rate
- the rate of the 3D ellipses circle points.radiusRate
- the rate of the circle radius change.extend
- the extension for each ellipse.- Returns:
- the animation handler.
- Since:
- 3.0.0
- See Also:
magicCircles(JavaPlugin, double, double, double, double, ParticleDisplay)
-
flower
Spawns the given shape(s) in the runnable in a circular form. The distance between the shapes are evenly separated.- Parameters:
count
- the count of the shapes.radius
- the radius of the circular form.runnable
- the shape(s) to display.- Since:
- 4.0.0
-
filledCircle
public static void filledCircle(double radius, double rate, double radiusRate, ParticleDisplay display)Spawns a filled cirlce using circles.- Parameters:
radius
- the radius of the circle.rate
- the rate of the circle points.radiusRate
- the radius change of the circle to fill it.- Since:
- 4.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
chaoticDoublePendulum
public static org.bukkit.scheduler.BukkitTask chaoticDoublePendulum(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double gravity, double length, double length2, double mass1, double mass2, boolean Dimension3, int speed, ParticleDisplay display)Spawns a double pendulum with chaotic movement. Note that if this runs for too long it'll stop working due to the limit of doubles resulting in aDouble.NaN
Double pendulum is a way to show Chaos motion. The particles display are showing the path where the second pendulum is going from.
Changing the mass or length to a lower value can make the shape stop producing new paths since it reaches the doubles limit. Source: https://www.myphysicslab.com/pendulum/double-pendulum-en.html
- Parameters:
plugin
- the timer handler.radius
- the radius of the pendulum. Yes this doesn't depend on length since the length needs to be a really high value and this won't work with Minecraft's xyz.gravity
- the gravity of the enviroment. Recommended is -1 positive numbers will mean gravity towards space.length
- the length of the first pendulum. Recommended is 200length2
- the length of the second pendulum. Recommended is 200mass1
- the mass of the first pendulum. Recommended is 50mass2
- the mass of the second pendulum. Recommended is 50Dimension3
- if it should enter 3D mode.speed
- the speed of the animation.- Returns:
- the animation handler.
- Since:
- 4.0.0
-
magicCircles
public static org.bukkit.scheduler.BukkitTask magicCircles(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double rate, double radiusRate, double distance, ParticleDisplay display)Spawns circles increasing their radius.- Parameters:
plugin
- the timer handler.radius
- the radius for the first circle.rate
- the rate of circle points.radiusRate
- the circle radius change rate.distance
- the distance between each circle.- Returns:
- the animation handler.
- Since:
- 3.0.0
- See Also:
circularBeam(JavaPlugin, double, double, double, double, ParticleDisplay)
-
infinity
Spawn a 3D infinity sign.- Parameters:
radius
- the radius of the infinity circles.rate
- the rate of the sign points.- Since:
- 3.0.0
-
cone
public static void cone(double height, double radius, double rate, double circleRate, ParticleDisplay display)Spawn a cone.- Parameters:
height
- the height of the cone.radius
- the radius of the cone circle.rate
- the rate of the cone circles.circleRate
- the rate of the cone circle points.- Since:
- 1.0.0
-
ellipse
public static void ellipse(double radius, double otherRadius, double rate, ParticleDisplay display)Spawn an ellipse.- Parameters:
radius
- the radius of the ellipse.otherRadius
- the curve of the ellipse.rate
- the rate of ellipse points.- Since:
- 2.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
blackhole
public static void blackhole(org.bukkit.plugin.java.JavaPlugin plugin, int points, double radius, double rate, int mode, ParticleDisplay display)Spawn a blackhole.- Parameters:
plugin
- the timer handler.points
- the points of the blackhole pulls.radius
- the radius of the blackhole circle.rate
- the rate of the blackhole circle points.mode
- blackhole mode. There are 5 modes.- Since:
- 3.0.0
-
rainbow
public static void rainbow(double radius, double rate, double curve, double layers, double compact, ParticleDisplay display)Spawns a rainbow.- Parameters:
radius
- the radius of the smallest circle.rate
- the rate of the rainbow points.curve
- the curve the the rainbow circles.layers
- the layers of each rainbow color.compact
- the distance between each circles.- Since:
- 2.0.0
-
crescent
Spawns a crescent.- Parameters:
radius
- the radius of crescent's big circle.rate
- the rate of the crescent's circle points.- Since:
- 1.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
waveFunction
public static void waveFunction(double extend, double heightRange, double size, double rate, ParticleDisplay display)Something similar to Quantum Wave function- Parameters:
extend
- the particle width extension. Recommended value is 3heightRange
- the height range of randomized waves. Recommended value is 1size
- the size of the terrain. Normal size is 3rate
- the rate of waves points. Recommended value is around 30- Since:
- 2.0.0
-
vortex
public static org.bukkit.scheduler.BukkitTask vortex(org.bukkit.plugin.java.JavaPlugin plugin, int points, double rate, ParticleDisplay display)Spawns a galaxy-like vortex. Note that the speed of the particle is important. Speed 0 will spawn static lines.- Parameters:
plugin
- the timer handler.points
- the points of the vortex.rate
- the speed of the vortex.- Returns:
- the task handling the animation.
- Since:
- 2.0.0
-
cylinder
Not really a cylinder. It looks more like a cage. For an actual cylidner just usecircle(double, double, ParticleDisplay)
and use one the xyz axis to build multiple circles.- Parameters:
height
- the height of the cylinder.radius
- the radius of the cylinder circles.rate
- the rate of cylinder points.- Since:
- 1.0.0
-
moveRotatingAround
public static org.bukkit.scheduler.BukkitTask moveRotatingAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)This will move the shape around in an area randomly while rotating them. The position of the shape will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
plugin
- the schedule handler.update
- the timer period in ticks.rate
- the distance between each location. Recommended value is 5.runnable
- the particles to spawn.displays
- the display references used to spawn particles in the runnable.- Returns:
- the async task handling the movement.
- Since:
- 1.0.0
- See Also:
rotateAround(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
,guard(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
-
moveAround
public static org.bukkit.scheduler.BukkitTask moveAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double endRate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)This will move the particle around in an area randomly. The position of the shape will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
plugin
- the schedule handler.update
- the timer period in ticks.rate
- the distance between each location. Recommended value is 5.runnable
- the particles to spawn.displays
- the display references used to spawn particles in the runnable.- Returns:
- the async task handling the movement.
- Since:
- 1.0.0
- See Also:
rotateAround(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
,guard(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
-
testDisplay
public static org.bukkit.scheduler.BukkitTask testDisplay(org.bukkit.plugin.java.JavaPlugin plugin, Runnable runnable)A simple test method to spawn a shape repeatedly for diagnosis.- Parameters:
plugin
- the timer handler.runnable
- the shape(s) to display.- Returns:
- the timer task handling the displays.
- Since:
- 1.0.0
-
rotateAround
public static org.bukkit.scheduler.BukkitTask rotateAround(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)This will rotate the shape around in an area randomly. The position of the shape will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
plugin
- the schedule handler.update
- the timer period in ticks.rate
- the distance between each location. Recommended value is 5.runnable
- the particles to spawn.displays
- the displays references used to spawn particles in the runnable.- Returns:
- the async task handling the movement.
- Since:
- 1.0.0
- See Also:
moveRotatingAround(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
,guard(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
-
guard
public static org.bukkit.scheduler.BukkitTask guard(org.bukkit.plugin.java.JavaPlugin plugin, long update, double rate, double offsetx, double offsety, double offsetz, Runnable runnable, ParticleDisplay... displays)This will move the particle around in an area randomly. The position of the shape will be randomized positively and negatively by the offset parameters on each axis. Note that the ParticleDisplays used in runnable and displays options must be from the same reference.Example
ParticleDisplays display = new ParticleDisplay(...);
WRONG: moveAround(plugin, 1, 5, 1.5, 1.5, 1.5, () -> circle(1, 10, new ParticleDisplay(...)), display);
CORRECT: moveAround(plugin, 1, 5, 1.5, 1.5, 1.5, () -> circle(1, 10, display), display);
- Parameters:
plugin
- the schedule handler.update
- the timer period in ticks.rate
- the distance between each location. Recommended value is 5.runnable
- the particles to spawn.displays
- the displays references used to spawn particles in the runnable.- Returns:
- the async task handling the movement.
- Since:
- 1.0.0
- See Also:
rotateAround(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
,moveRotatingAround(JavaPlugin, long, double, double, double, double, Runnable, ParticleDisplay...)
-
sphere
Spawn a sphere. Tutorial: https://www.spigotmc.org/threads/146338/ Also uses its own unique directional pattern.- Parameters:
radius
- the circle radius.rate
- the rate of cirlce points/particles.- Since:
- 1.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
spikeSphere
public static void spikeSphere(double radius, double rate, int chance, double minRandomDistance, double maxRandomDistance, ParticleDisplay display)Spawns a sphere with spikes coming out from the center. The sphere points will not be visible.- Parameters:
radius
- the radius of the sphere.rate
- the rate of sphere spike points.chance
- the chance to grow a spike randomly.minRandomDistance
- he minimum distance of spikes from sphere.maxRandomDistance
- the maximum distance of spikes from sphere.- Since:
- 1.0.0
- See Also:
sphere(double, double, ParticleDisplay)
-
ring
Spawns a donut-shaped ring. When the tube radius is greater than the main radius, the hole radius in the middle of the circle will increase as the circles come closer to the mid-point.- Parameters:
rate
- the number of circles used to form the ring (tunnel circles)radius
- the radius of the ring.tubeRadius
- the radius of the circles used to form the ring (tunnel circles)- Since:
- 1.0.0
- See Also:
circle(double, double, ParticleDisplay)
-
spread
public static void spread(org.bukkit.plugin.java.JavaPlugin plugin, int amount, int rate, org.bukkit.Location start, org.bukkit.Location originEnd, double offsetx, double offsety, double offsetz, ParticleDisplay display)Spawns animated spikes randomly spreading at the end location.- Parameters:
plugin
- the timer handler.amount
- the amount of spikes to spawn.rate
- rate of spike line points.start
- start location of spikes.originEnd
- end location of spikes.- Since:
- 1.0.0
-
heart
public static void heart(double cut, double cutAngle, double depth, double compressHeight, double rate, ParticleDisplay display)Spawns a circle with heart shaped circles sticking out. This method can be used to create many other shapes other than heart.- Parameters:
cut
- defines the count of two oval pairs. For heart use 2cutAngle
- defines the compression of two oval pairs. For heart use 4depth
- the depth of heart's inner spike.compressHeight
- compress the heart along the y axis.rate
- the rate of the heart points. Will be converted to radians.- Since:
- 1.0.0
-
atomic
public static void atomic(org.bukkit.plugin.java.JavaPlugin plugin, int orbits, double radius, double rate, ParticleDisplay orbit)Spawns multiple animated atomic-like circles rotating around in their orbit.- Parameters:
plugin
- the timer handler.orbits
- the orbits of the atom.radius
- the radius of the atom orbits.rate
- the rate of orbit points.- Since:
- 1.0.0
- See Also:
atom(int, double, double, ParticleDisplay, ParticleDisplay)
-
helix
public static org.bukkit.scheduler.BukkitTask helix(org.bukkit.plugin.java.JavaPlugin plugin, int strings, double radius, double rate, double extension, int height, int speed, boolean fadeUp, boolean fadeDown, ParticleDisplay display)Spawns animated helix shapes.- Parameters:
plugin
- the timer handler.strings
- the amount of helix strings. The rotation angle will split equally for each.radius
- the radius of the helix.rate
- the rate of helix points.extension
- the helix circle extension.height
- the height of the helix.speed
- the speed of the rate builder in each animation tick.fadeUp
- helix radius will decrease to zero as it gets closer to the top.fadeDown
- helix radius will increase to the original radius as it gets closer to the center.- Returns:
- the animation task.
- Since:
- 3.0.0
- See Also:
dnaReplication(JavaPlugin, double, double, int, double, int, int, ParticleDisplay)
-
lightning
public static void lightning(org.bukkit.Location start, org.bukkit.util.Vector direction, int entries, int branches, double radius, double offset, double offsetRate, double length, double lengthRate, double branch, double branchRate, ParticleDisplay display)Spawns a broken line that creates more and extended branches as it gets closer to the end length. This method doesn't support rotations. Use the direction instead.- Parameters:
start
- the starting point of the new branch. For the first call it's the same location as the displays location.direction
- the direction of the lightning. A simple direction would beentity.getLocation().getDirection().normalize()
For a simple end point direction would beendLocation.toVector().subtract(start.toVector()).normalize()
entries
- the number of entries for the main lightning branch. Recommended is 20branches
- the maximum number of branches each entry can have. Recommended is 200radius
- the radius of the lightning branches. Recommended is 0.5offset
- the offset of the lightning branches. Recommended is 2offsetRate
- the offset change rate of the lightning branches. Recommended is 1length
- the length of the lightning branch. Recommended is 1.5lengthRate
- the length change rate of the lightning branch. Recommended is 1branch
- the chance of creating a new branch. Recommended is 0.1branchRate
- the chance change of creating a new branch. Recommended is 1- Since:
- 3.0.0
-
dna
public static void dna(double radius, double rate, double extension, int height, int hydrogenBondDist, ParticleDisplay display, ParticleDisplay hydrogenBondDisplay)Spawn a DNA double helix string with nucleotides.- Parameters:
radius
- the radius of two DNA string circles.rate
- the rate of DNA strings and hydrogen bond points.height
- the height of the DNA strings.hydrogenBondDist
- the distance between each hydrogen bond (read inside method). This distance is also affected by rate.display
- display for strings.hydrogenBondDisplay
- display for hydrogen bonds.- Since:
- 1.0.0
- See Also:
helix(JavaPlugin, int, double, double, double, int, int, boolean, boolean, ParticleDisplay)
,dnaReplication(JavaPlugin, double, double, int, double, int, int, ParticleDisplay)
-
dnaReplication
public static org.bukkit.scheduler.BukkitTask dnaReplication(org.bukkit.plugin.java.JavaPlugin plugin, double radius, double rate, int speed, double extension, int height, int hydrogenBondDist, ParticleDisplay display)Spawn an animated DNA replication with colored bonds.- Parameters:
plugin
- the timer handler.radius
- the radius of DNA helix circle.rate
- the rate of DNA points.speed
- the number of points to build in a single tick. Recommended is 5.extension
- the extension of the DNA helix sin/cos waves.height
- the height of the DNA strings.hydrogenBondDist
- the distance between two DNA string helix points in a single string for each hydrogen bond to be formed.- Returns:
- the timer handling the animation.
- Since:
- 3.0.0
- See Also:
dna(double, double, double, int, int, ParticleDisplay, ParticleDisplay)
-
drawLine
public static void drawLine(org.bukkit.entity.Player player, double length, double rate, ParticleDisplay display)Draws a line from the player's looking direction.- Parameters:
player
- the player to draw the line from.length
- the length of the line.rate
- the rate of points of the line.- Since:
- 1.0.0
- See Also:
line(Location, Location, double, ParticleDisplay)
-
cloud
public static org.bukkit.scheduler.BukkitTask cloud(org.bukkit.plugin.java.JavaPlugin plugin, ParticleDisplay cloud, ParticleDisplay rain)A simple method to spawn animated clouds effect.- Parameters:
plugin
- the timer handler.cloud
- recommended particle isParticle.CLOUD
orParticle.SMOKE_LARGE
and the offset xyz should be higher than 2rain
- recommended particle isParticle.WATER_DROP
orParticle.FALLING_LAVA
and the offset xyz should be the same as cloud.- Returns:
- the timer task handling the animation.
- Since:
- 1.0.0
-
line
public static void line(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)Spawns a line from a location to another. Tutorial: https://www.spigotmc.org/threads/176695/- Parameters:
start
- the starting point of the line.end
- the ending point of the line.rate
- the rate of points of the line.- Since:
- 1.0.0
- See Also:
drawLine(Player, double, double, ParticleDisplay)
-
rectangle
public static void rectangle(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)Spawns a rectangle.- Parameters:
start
- the starting point of the rectangle which is equals to the display location.end
- the ending point of the rectangle.rate
- the rate of the rectangle points.- Since:
- 3.0.0
- See Also:
cube(Location, Location, double, ParticleDisplay)
,cage(Location, Location, double, double, ParticleDisplay)
-
cage
public static void cage(org.bukkit.Location start, org.bukkit.Location end, double rate, double barRate, ParticleDisplay display)Spawns a cage.- Parameters:
start
- the starting point of the cage.end
- the ending point of the cage.rate
- the rate of cage two rectangles and the bar lines.barRate
- the chance of bars for the cage.- Since:
- 3.0.0
- See Also:
rectangle(Location, Location, double, ParticleDisplay)
,cylinder(double, double, double, ParticleDisplay)
-
filledCube
public static void filledCube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)Spawn a cube with all the space filled with particles inside. To spawn a cube with a width, height and depth you can simply add to the original location.Example
Location start = player.getLocation(); Location end = start.clone().add(width, height, depth); filledCube(start, end, 0.3, new ParticleDisplay(Particle.FLAME, null, 1));
- Parameters:
start
- the starting point of the cube.end
- the ending point of the cube.rate
- the rate of cube points.- Since:
- 1.0.0
- See Also:
cube(Location, Location, double, ParticleDisplay)
,structuredCube(Location, Location, double, ParticleDisplay)
-
cube
public static void cube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)Spawns a cube with the inner space empty.- Parameters:
start
- the starting point of the cube.end
- the ending point of the cube.rate
- the rate of cube points.- Since:
- 1.0.0
- See Also:
filledCube(Location, Location, double, ParticleDisplay)
,structuredCube(Location, Location, double, ParticleDisplay)
-
structuredCube
public static void structuredCube(org.bukkit.Location start, org.bukkit.Location end, double rate, ParticleDisplay display)spawn a cube with the inner space and walls empty, leaving only the edges visible.- Parameters:
start
- the starting point of the cube.end
- the ending point of the cube.rate
- the rate of cube points.- Since:
- 1.0.0
- See Also:
filledCube(Location, Location, double, ParticleDisplay)
,cube(Location, Location, double, ParticleDisplay)
-
hypercube
public static void hypercube(org.bukkit.Location startOrigin, org.bukkit.Location endOrigin, double rate, double sizeRate, int cubes, ParticleDisplay display)Inaccurate representation of hypercubes. Just a bunch of tesseracts. New smaller tesseracts will be created as the dimension increases. https://en.wikipedia.org/wiki/HypercubeI'm still looking for a way to make this animated but it's damn confusing: https://www.youtube.com/watch?v=iGO12Z5Lw8s
- Parameters:
startOrigin
- the starting point for the original cube.endOrigin
- the endnig point for the original cube.rate
- the rate of cube points.sizeRate
- the sizecubes
- the dimension of the hypercube starting from 3D. E.g.dimension 1 -> 4D tersseract
- Since:
- 1.0.0
- See Also:
structuredCube(Location, Location, double, ParticleDisplay)
,tesseract(JavaPlugin, double, double, double, long, ParticleDisplay)
-
tesseract
public static org.bukkit.scheduler.BukkitTask tesseract(org.bukkit.plugin.java.JavaPlugin plugin, double size, double rate, double speed, long ticks, ParticleDisplay display)Animated 4D tesseract using matrix motion. Since this is a 4D shape the usage should be highly limited. A failed prototype: https://imgur.com/eziNk7x Final Version: https://imgur.com/Vb2HDQNhttps://en.wikipedia.org/wiki/Tesseract https://en.wikipedia.org/wiki/Rotation_matrix
- Parameters:
plugin
- the timer handler.size
- the size of the tesseract. Recommended is 4rate
- the rate of the tesseract points. Recommended is 0.3speed
- the speed of the tesseract matrix motion. Recommended is 0.01ticks
- the amount of ticks to keep the animation.- Since:
- 4.0.0
- See Also:
hypercube(Location, Location, double, double, int, ParticleDisplay)
-
mandelbrot
public static void mandelbrot(double size, double zoom, double rate, double x0, double y0, int color, ParticleDisplay display)Spawns a mandelbrot set. https://en.wikipedia.org/wiki/Mandelbrot_set- Parameters:
size
- the size of the mandelbrot. Recommended is 5zoom
- the zooming length of the mandelbrot (Does not show the julia set.) Recommended is 1rate
- the rate of the shape points. Recommended is 0.1x0
- the amount of x to move the shape. Recommended is 3y0
- the amount of y to move the shape. Recommended is 0color
- the color set of the mandelbrot. This can change the shape. Recommended is 1000- Since:
- 4.0.0
-
julia
public static void julia(double size, double zoom, int colorScheme, double moveX, double moveY, ParticleDisplay display)Spawns a julia set. https://en.wikipedia.org/wiki/Julia_set- Parameters:
size
- the size of the image.zoom
- the zoom ratio to the set.colorScheme
- the color scheme for the julia set.moveX
- the amount to move in the x axis.moveY
- the amount to move in the y axis.- Since:
- 4.0.0
- See Also:
mandelbrot(double, double, double, double, double, int, ParticleDisplay)
-
star
public static void star(org.bukkit.plugin.java.JavaPlugin plugin, int points, int spikes, double rate, double spikeLength, double coreRadius, double neuron, boolean prototype, int speed, ParticleDisplay display)Spawn 3D spiked circles. Note that the animation is intended to be used with prototype mode enabled. Animations without prototype doesn't really look good. You might want to increase the speed.- Parameters:
plugin
- the timer handler.points
- the number of circle sides with spikes.spikes
- the number of spikes on each side.rate
- the rate of star points.spikeLength
- the length of each spike.coreRadius
- the radius of the center circle.neuron
- the neuron level. Neuron level is affected by the prototype mode. Normal value is 1 if prototype mode is disabled. If the value goes higher than 1 it'll form a neuron-like body cell shape. The value is used in small ranges for when prototype mode is enabled. Usually between 0.01 and 0.1prototype
- if the spikes of the star should use helix instead of a random generator.speed
- the speed of animation. Smoothest/slowest is 1- Since:
- 3.0.0
- See Also:
spikeSphere(double, double, int, double, double, ParticleDisplay)
-
eye
public static void eye(double radius, double radius2, double rate, double extension, ParticleDisplay display)Spawns an eye-shaped circle.- Parameters:
radius
- the radius of the eye.radius2
- the other radius of the eye. Usually the same as the first radius.rate
- the rate of the eye points.extension
- the extension of the eye. Recommended is 0.2- Since:
- 4.0.0
-
illuminati
Spawns an illuminati shape.- Parameters:
size
- the size of the illuminati shape.extension
- the extension of the illuminati eye.- Since:
- 4.0.0
-
polygon
public static void polygon(int points, int connection, double size, double rate, double extend, ParticleDisplay display)Spawns a connected 2D polygon. Tutorial: https://www.spigotmc.org/threads/158678/- Parameters:
points
- the number of polygon points.connection
- the connection level of two points.size
- the size of the shape.rate
- the rate of connection points.extend
- extends the shape, connecting unrelated points together.- Since:
- 1.0.0
-
rotateAroundX
public static org.bukkit.util.Vector rotateAroundX(org.bukkit.util.Vector vector, double angle)Rotates vector around the X axis with the specified angle. Cross-version compatibility.- Parameters:
angle
- the rotation angle, in radians.- Returns:
- the rotated vector.
- Since:
- 1.0.0
-
rotateAroundY
public static org.bukkit.util.Vector rotateAroundY(org.bukkit.util.Vector vector, double angle)Rotates vector around the Y axis with the specified angle. Cross-version compatibility.- Parameters:
angle
- the rotation angle, in radians.- Returns:
- the rotated vector.
- Since:
- 1.0.0
-
rotateAroundZ
public static org.bukkit.util.Vector rotateAroundZ(org.bukkit.util.Vector vector, double angle)Rotates vector around the Z axis with the specified angle. Cross-version compatibility.- Parameters:
angle
- the rotation angle, in radians.- Returns:
- the rotated vector.
- Since:
- 1.0.0
-
neopaganPentagram
public static void neopaganPentagram(double size, double rate, double extend, ParticleDisplay star, ParticleDisplay circle)https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Pentagram_within_circle.svg/800px-Pentagram_within_circle.svg.png- Since:
- 1.0.0
- See Also:
polygon(int, int, double, double, double, ParticleDisplay)
,circle(double, double, ParticleDisplay)
-
atom
public static void atom(int orbits, double radius, double rate, ParticleDisplay orbit, ParticleDisplay nucleus)Spawns an atom with orbits and a nucleus.- Parameters:
orbits
- the number of atom orbits.radius
- the radius of orbits.rate
- the rate of orbit and nucleus points.- Since:
- 1.0.0
- See Also:
atomic(JavaPlugin, int, double, double, ParticleDisplay)
-
meguminExplosion
public static void meguminExplosion(org.bukkit.plugin.java.JavaPlugin plugin, double size, ParticleDisplay display)This is supposed to be something similar to this: https://www.deviantart.com/pwincessstar/art/701840646 The numbers on this shape are really sensitive. Changing a single one can result in a totally different shape.- Parameters:
size
- the shape of the explosion circle. Recommended value is 6- Since:
- 1.0.0
- See Also:
polygon(int, int, double, double, double, ParticleDisplay)
,circle(double, double, ParticleDisplay)
-
explosionWave
public static void explosionWave(org.bukkit.plugin.java.JavaPlugin plugin, double rate, ParticleDisplay display, ParticleDisplay secDisplay)A sin/cos based smoothly animated explosion wave. Source: https://www.youtube.com/watch?v=n8W7RxW5KB4- Parameters:
rate
- the distance between each cos/sin lines.- Since:
- 1.0.0
-
renderImage
public static CompletableFuture<Map<org.bukkit.Location,org.bukkit.Color>> renderImage(Path path, int resizedWidth, int resizedHeight, double compact)Renders a resized image.- Parameters:
path
- the path of the image.resizedWidth
- the resizing width.resizedHeight
- the resizing height.compact
- the pixel compact of the image.- Returns:
- the rendered particle locations.
- Since:
- 1.0.0
-
renderImage
public static CompletableFuture<Map<org.bukkit.Location,org.bukkit.Color>> renderImage(BufferedImage image, int resizedWidth, int resizedHeight, double compact)Renders every pixel of the image and saves the location and the particle colors to a map.- Parameters:
image
- the image to render.resizedWidth
- the new image width.resizedHeight
- the new image height.compact
- particles compact value. Should be lower than 0.5 and higher than 0.1 The recommended value is 0.2- Returns:
- a rendered map of an image.
- Since:
- 1.0.0
-
displayRenderedImage
public static org.bukkit.scheduler.BukkitTask displayRenderedImage(org.bukkit.plugin.java.JavaPlugin plugin, Map<org.bukkit.Location,org.bukkit.Color> render, Callable<org.bukkit.Location> location, int repeat, long period, int quality, int speed, float size)Display a rendered image repeatedly.- Parameters:
plugin
- the scheduler handler.render
- the rendered image map.location
- the dynamic location to display the image at.repeat
- amount of times to repeat displaying the image.period
- the perioud between each repeats.quality
- the quality of the image is exactly the number of particles display for each pixel. Recommended value is 1speed
- the speed is exactly the same value as the speed of particles. Recommended amount is 0size
- the size of the particle. Recommended amount is 0.8- Returns:
- the async bukkit task displaying the image.
- Since:
- 1.0.0
-
displayRenderedImage
public static void displayRenderedImage(Map<org.bukkit.Location,org.bukkit.Color> render, org.bukkit.Location location, int quality, int speed, float size)Display a rendered image repeatedly.- Parameters:
render
- the rendered image map.location
- the dynamic location to display the image at.quality
- the quality of the image is exactly the number of particles display for each pixel. Recommended value is 1speed
- the speed is exactly the same value as the speed of particles. Recommended amount is 0size
- the size of the particle. Recommended amount is 0.8- Since:
- 1.0.0
-
saveImage
A simple method used to save images. Useful to cache text generated images.- Parameters:
image
- the buffered image to save.path
- the path to save the image to.- Since:
- 1.0.0
- See Also:
stringToImage(Font, java.awt.Color, String)
-
stringToImage
Converts a string to an image which can be used to display as a particle.- Parameters:
font
- the font to generate the text with.color
- the color of text.str
- the string to generate the image.- Returns:
- the buffered image.
- Since:
- 1.0.0
- See Also:
saveImage(BufferedImage, Path)
-