Class ParticleEffect

java.lang.Object
tk.airshipcraft.commonlib.particles.ParticleEffect

public class ParticleEffect extends Object
Represents a customizable particle effect in Minecraft, providing methods to create, configure, and display particle effects in the game world. This class encapsulates various parameters such as the type of particle, offset, speed, and count, enabling fine-tuned control over the appearance and behavior of particle effects.
Since:
2023-03-30
Version:
1.0.0
Author:
notzune
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParticleEffect(org.bukkit.Particle particle, float offsetX, float offsetY, float offsetZ, float speed, int particleCount)
    Constructs a new ParticleEffect with specified properties, allowing for the creation of diverse visual effects ranging from simple to complex animations.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a copy of this ParticleEffect.
    boolean
    Checks if two ParticleEffect objects are equal based on their properties.
    float
     
    float
     
    float
     
    org.bukkit.Particle
     
    int
     
    float
     
    void
    playEffect(org.bukkit.Location location)
    Displays the configured particle effect at a specific location in the game world.
    void
    setParticle(org.bukkit.Particle particle)
    Sets a new particle type for this effect.
    Generates a string representation of the ParticleEffect, providing details about the particle type and its properties.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ParticleEffect

      public ParticleEffect(org.bukkit.Particle particle, float offsetX, float offsetY, float offsetZ, float speed, int particleCount)
      Constructs a new ParticleEffect with specified properties, allowing for the creation of diverse visual effects ranging from simple to complex animations.
      Parameters:
      particle - The type of particle to use for this effect.
      offsetX - The maximum random offset on the X axis for each particle.
      offsetY - The maximum random offset on the Y axis for each particle.
      offsetZ - The maximum random offset on the Z axis for each particle.
      speed - The speed at which particles move after being spawned.
      particleCount - The number of particles to spawn for this effect.
  • Method Details

    • getParticle

      public org.bukkit.Particle getParticle()
      Returns:
      the type of particle used in this effect
    • setParticle

      public void setParticle(org.bukkit.Particle particle)
      Sets a new particle type for this effect.
      Parameters:
      particle - The new particle type.
    • getOffsetX

      public float getOffsetX()
      Returns:
      the amount to be randomly offset by in the X axis
    • getOffsetY

      public float getOffsetY()
      Returns:
      the amount to be randomly offset by in the Y axis
    • getOffsetZ

      public float getOffsetZ()
      Returns:
      the amount to be randomly offset by in the Z axis
    • getSpeed

      public float getSpeed()
      Returns:
      the speed of the particles
    • getParticleCount

      public int getParticleCount()
      Returns:
      the amount of particle to display.
    • playEffect

      public void playEffect(org.bukkit.Location location)
      Displays the configured particle effect at a specific location in the game world. This method is typically used to visually indicate events, enhance ambiance, or signal in-game actions.
      Parameters:
      location - The location where the particle effect should be played.
      Throws:
      IllegalArgumentException - if the location's world is null, as particles need a world context.
    • equals

      public boolean equals(Object obj)
      Checks if two ParticleEffect objects are equal based on their properties.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare with.
      Returns:
      true if the objects are equal, false otherwise.
    • copy

      public ParticleEffect copy()
      Creates a copy of this ParticleEffect.
      Returns:
      a new ParticleEffect instance with the same properties.
    • toString

      public String toString()
      Generates a string representation of the ParticleEffect, providing details about the particle type and its properties. Useful for logging and debugging.
      Overrides:
      toString in class Object
      Returns:
      A formatted string containing information about the ParticleEffect.