public class ParticleBuilder extends Object
World.spawnParticle(Particle, Location, int, double, double, double, double, Object)
APIConstructor and Description |
---|
ParticleBuilder(Particle particle) |
Modifier and Type | Method and Description |
---|---|
ParticleBuilder |
allPlayers()
Sends this particle to all players in the world.
|
ParticleBuilder |
color(Color color)
Sets the particle Color.
|
ParticleBuilder |
color(int r,
int g,
int b)
Sets the particle Color.
|
int |
count() |
ParticleBuilder |
count(int count)
Sets the number of particles to spawn
|
<T> T |
data()
Gets the particle custom data.
|
<T> ParticleBuilder |
data(T data)
Sets the particle custom data.
|
double |
extra()
Gets the Particle extra data.
|
ParticleBuilder |
extra(double extra)
Sets the particle extra data.
|
ParticleBuilder |
force(boolean force)
Sets whether the particle is forcefully shown to the player.
|
boolean |
hasReceivers()
Example use:
builder.receivers(16);
if (builder.hasReceivers()) {
sendParticleAsync(builder);
}
|
Location |
location() |
ParticleBuilder |
location(Location location)
Sets the location of where to spawn the particle
|
ParticleBuilder |
location(World world,
double x,
double y,
double z)
Sets the location of where to spawn the particle
|
ParticleBuilder |
offset(double offsetX,
double offsetY,
double offsetZ)
Sets the particle offset.
|
double |
offsetX()
Particle offset X.
|
double |
offsetY()
Particle offset Y.
|
double |
offsetZ()
Particle offset Z.
|
Particle |
particle() |
ParticleBuilder |
particle(Particle particle)
Changes what particle will be sent
|
List<Player> |
receivers() |
ParticleBuilder |
receivers(Collection<Player> receivers) |
ParticleBuilder |
receivers(int radius)
Selects all players within a cuboid selection around the particle location, within the specified bounding box.
|
ParticleBuilder |
receivers(int radius,
boolean byDistance)
Selects all players within the specified radius around the particle location.
|
ParticleBuilder |
receivers(int xzRadius,
int yRadius)
Selects all players within a cuboid selection around the particle location, within the specified bounding box.
|
ParticleBuilder |
receivers(int xzRadius,
int yRadius,
boolean byDistance)
Selects all players within the specified radius around the particle location.
|
ParticleBuilder |
receivers(int xRadius,
int yRadius,
int zRadius)
Selects all players within a cuboid selection around the particle location, within the specified bounding box.
|
ParticleBuilder |
receivers(List<Player> receivers) |
ParticleBuilder |
receivers(Player... receivers) |
Player |
source() |
ParticleBuilder |
source(Player source)
Sets the source of this particle for visibility concerns (Vanish API)
|
ParticleBuilder |
spawn()
Sends the particle to all receiving players (or all).
|
public ParticleBuilder(Particle particle)
public ParticleBuilder spawn()
public Particle particle()
public ParticleBuilder particle(Particle particle)
particle
- The particle@Nullable public List<Player> receivers()
public boolean hasReceivers()
public ParticleBuilder allPlayers()
public ParticleBuilder receivers(@Nullable List<Player> receivers)
receivers
- List of players to receive this particle, or null for all players in the worldpublic ParticleBuilder receivers(@Nullable Collection<Player> receivers)
receivers
- List of players to receive this particle, or null for all players in the worldpublic ParticleBuilder receivers(Player... receivers)
receivers
- List of players to be receive this particle, or null for all players in the worldpublic ParticleBuilder receivers(int radius)
receivers(int, boolean)
radius
- amount to add on all axispublic ParticleBuilder receivers(int radius, boolean byDistance)
receivers(int, int)
If byDistance is true, radius is tested by distance in a spherical shaperadius
- amount to add on each axisbyDistance
- true to use a spherical radius, false to use a cuboidpublic ParticleBuilder receivers(int xzRadius, int yRadius)
receivers(int, int, boolean)
If you want a more spherical check, see receivers(int, boolean)
xzRadius
- amount to add on the x/z axisyRadius
- amount to add on the y axispublic ParticleBuilder receivers(int xzRadius, int yRadius, boolean byDistance)
receivers(int, int)
If byDistance is true, radius is tested by distance on the y plane and on the x/z plane, in a cylinder shape.xzRadius
- amount to add on the x/z axisyRadius
- amount to add on the y axisbyDistance
- true to use a cylinder shape, false to use cuboidpublic ParticleBuilder receivers(int xRadius, int yRadius, int zRadius)
receivers(int, int, boolean)
If you want a more spherical check, see receivers(int, boolean)
xRadius
- amount to add on the x axisyRadius
- amount to add on the y axiszRadius
- amount to add on the z axispublic Player source()
public ParticleBuilder source(Player source)
source
- The player who is considered the sourcepublic Location location()
public ParticleBuilder location(Location location)
location
- The location of the particlepublic ParticleBuilder location(World world, double x, double y, double z)
world
- World to spawn particle inx
- X locationy
- Y locationz
- Z locationpublic int count()
public ParticleBuilder count(int count)
count
- Number of particlespublic double offsetX()
public double offsetY()
public double offsetZ()
public ParticleBuilder offset(double offsetX, double offsetY, double offsetZ)
offsetX
- Particle offset XoffsetY
- Particle offset YoffsetZ
- Particle offset Zpublic double extra()
public ParticleBuilder extra(double extra)
extra
- the extra particle datapublic <T> T data()
T
- The Particle data typepublic <T> ParticleBuilder data(T data)
T
- The Particle data typedata
- The new particle datapublic ParticleBuilder force(boolean force)
force
- true to force, false for normalpublic ParticleBuilder color(Color color)
color
- the new particle colorpublic ParticleBuilder color(int r, int g, int b)
r
- red color componentg
- green color componentb
- blue color componentCopyright © 2021. All rights reserved.