Class ParticleBuilder
- Since:
- 24/01/2020
- Author:
- ByteZ
-
Constructor Summary
ConstructorsConstructorDescriptionParticleBuilder(ParticleEffect particle) Initializes a newParticleBuilderParticleBuilder(ParticleEffect particle, org.bukkit.Location location) Initializes a newParticleBuilder -
Method Summary
Modifier and TypeMethodDescriptionvoiddisplay()Displays the given particle to all players.voiddisplay(Collection<? extends org.bukkit.entity.Player> players) Displays the given particle to all players in theCollectionvoidDisplay the given particle to online player that match the given filter.voiddisplay(org.bukkit.entity.Player... players) Displays the given particle to the players in the array.intThe amount of particles that should be spawned.org.bukkit.LocationTheLocationof the particle.floatThis field has three uses:floatThis field has three uses:floatThis field has three uses:TheParticleEffectthat should be displayed by the client.The data of the particle which should be displayed.floatgetSpeed()Normally this field is used to multiply the velocity of a particle by the given speed.setAmount(int amount) Sets the amount.Sets the color of the particle.setLocation(org.bukkit.Location location) Sets theLocationof the particle.setOffset(float offsetX, float offsetY, float offsetZ) Sets the offset.setOffset(org.bukkit.util.Vector offset) Sets the offset.setOffsetX(float offsetX) Sets the X offset.setOffsetY(float offsetY) Sets the Y offset.setOffsetZ(float offsetZ) Sets the Z offset.setParticleData(ParticleData particleData) Sets the particleData.setSpeed(float speed) Sets the speed.toPacket()Creates a newParticlePacketwit the given values.
-
Constructor Details
-
ParticleBuilder
Initializes a newParticleBuilder- Parameters:
particle- TheParticleEffectof the builder.location- The location at which the particle should be displayed
-
ParticleBuilder
Initializes a newParticleBuilder- Parameters:
particle- TheParticleEffectof the builder.
-
-
Method Details
-
getParticle
TheParticleEffectthat should be displayed by the client. -
setLocation
Sets theLocationof the particle.- Parameters:
location- The newLocationof the particle.- Returns:
- the current instance to support building operations
-
getLocation
public org.bukkit.Location getLocation()TheLocationof the particle. -
setOffsetX
Sets the X offset.- Parameters:
offsetX- The new value of theoffsetXfield- Returns:
- the current instance to support building operations
-
getOffsetX
public float getOffsetX()This field has three uses:The offsetX defines in which x oriented range the particles can spawn.
It represents the x velocity a particle with the
PropertyType.DIRECTIONALproperty should have.It sets the red value of a
PropertyType.COLORABLEparticle. However, since 1.13 a ParticleParam has to be used to set the colors of redstone. -
setOffsetY
Sets the Y offset.- Parameters:
offsetY- The new value of theoffsetYfield- Returns:
- the current instance to support building operations
-
setOffset
Sets the offset.- Parameters:
offsetX- The new value of theoffsetXfieldoffsetY- The new value of theoffsetYfieldoffsetZ- The new value of theoffsetZfield- Returns:
- the current instance to support building operations
-
getOffsetY
public float getOffsetY()This field has three uses:The offsetY defines in which y oriented range the particles can spawn.
It represents the y velocity a particle with the
PropertyType.DIRECTIONALproperty should have.It sets the green value of a
PropertyType.COLORABLEparticle. However, since 1.13 a ParticleParam has to be used to set the colors of redstone. -
setOffset
Sets the offset.- Parameters:
offset- aVectorcontaining the offset values.- Returns:
- the current instance to support building operations
-
setOffsetZ
Sets the Z offset.- Parameters:
offsetZ- The new value of theoffsetZfield- Returns:
- the current instance to support building operations
-
getOffsetZ
public float getOffsetZ()This field has three uses:The offsetZ defines in which z oriented range the particles can spawn.
It represents the z velocity a particle with the
PropertyType.DIRECTIONALproperty should have.It sets the blue value of a
PropertyType.COLORABLEparticle. However, since 1.13 a ParticleParam has to be used to set the colors of redstone. -
setSpeed
Sets the speed.- Parameters:
speed- The new value of thespeedfield- Returns:
- the current instance to support building operations
-
getSpeed
public float getSpeed()Normally this field is used to multiply the velocity of a particle by the given speed. There are however some special cases where this value is used for something different. (e.g.ParticleEffect.NOTE). -
setAmount
Sets the amount.- Parameters:
amount- The new value of theamountfield- Returns:
- the current instance to support building operations
-
getAmount
public int getAmount()The amount of particles that should be spawned. For the extra data defined in offsetX, offsetY and offsetZ to work the amount has to be set to0. -
setParticleData
Sets the particleData.- Parameters:
particleData- The new value of theparticleDatafield- Returns:
- the current instance to support building operations
-
getParticleData
The data of the particle which should be displayed. This data contains additional information the client needs to display the particle correctly. -
setColor
Sets the color of the particle. Note that particle needs thePropertyType.COLORABLEPropertyType to work.- Parameters:
color- theColorof the particle.- Returns:
- the current instance to support building operations
-
toPacket
Creates a newParticlePacketwit the given values.- Returns:
- the new
ParticlePacket - Throws:
IllegalStateException- if the location field isn't set yet.
-
display
public void display()Displays the given particle to all players. -
display
public void display(org.bukkit.entity.Player... players) Displays the given particle to the players in the array.- Parameters:
players- The players that should see the particle.
-
display
Display the given particle to online player that match the given filter.- Parameters:
filter- aPredicateto filter out specificPlayers.
-
display
Displays the given particle to all players in theCollection- Parameters:
players- a list of players that should receive the particle packet.
-