Git Product home page Git Product logo

particlelib's Introduction

Codacy Badge HitCount GitHub issues GitHub stars GitHub license Maven Build

ParticleLib

A spigot library to support all particles from 1.8 to 1.16.1

Maven

<dependencies>
    <dependency>
        <groupId>xyz.xenondevs</groupId>
        <artifactId>particle</artifactId>
        <version>1.5.1</version>
    </dependency>
</dependencies>

How to use this library

Choose the particle you want to display and then use the display method.

Example:

ParticleEffect.FLAME.display(player.getLocation());

Parameter explanation:

  1. The location at which the particle should be displayed.
  2. The players that will see the particle.

You can also give extra data to the particle.

Directional Particles

If a particle has the PropertyType "Directional" it can have a custom velocity. This velocity can be specified in the offsetX, offsetY and offsetZ parameters. However, you can also specify a Vector in the display method.

Special: The particles Enchantment_Table and Nautilus will be displayed at the offset location and fly to the original location.

Example:

ParticleEffect.CAMPFIRE_SIGNAL_SMOKE.display(player.getLocation(), new Vector(1, 0, 1), 1f, 0, null, Bukkit.getOnlinePlayers());

Parameter explanation:

  1. The location at which the particle should be displayed.
  2. The velocity at which the particle will fly off.
  3. The speed of the particle.
  4. The amount of particles. This parameter has to be 0, or it won't have the defined velocity.
  5. Since our particle doesn't need any extra data, the ParticleData is set to null
  6. The players that will see the particle.

Color Particles

If a particle has the PropertyType "Colorable" it can have a user defined color. This color can be set with a implementation of the ParticleColor class. The RGB values of the color can be set as the offsetX, offsetY and offsetZ values of the particle.

Special:

  • Since 1.13 redstone has a own object for its RGB values. Therefore, offsetX, offsetY and offsetZ can be used.
  • Note colors don't have a RGB value. They only support a note value from 0 to 24. Use "NoteColor" for this particle.

Example:

ParticleEffect.SPELL_MOB.display(player.getLocation(), new RegularColor(new Color(52, 152, 219)));

Parameter explanation:

  1. The location at which the particle should be displayed.
  2. A new RegularColor object to specify the color the particle will have.

Texture Particles

If a particle has the PropertyType "Requires Block" or "Requires Item" a texture of either a block or item can be defined. This texture can be set with an implementation of the ParticleTexture class.

Block texture example:

ParticleEffect.FALLING_DUST.display(player.getLocation(), 5, 0, 5, 1f, 5, new BlockTexture(Material.REDSTONE_BLOCK), Bukkit.getOnlinePlayers());

Parameter explanation:

  1. The location at which the particle should be displayed.
  2. The x offset of the particle.
  3. The y offset of the particle.
  4. The Z offset of the particle.
  5. The speed at which the particle flies of.
  6. The amount of particles that will be displayed
  7. The texture the particle will should have. (In this case it's a redstone block.)
  8. The players that will see the particle.

Item texture example:

ParticleEffect.ITEM_CRACK.display(player.getLocation(), 5, 0, 5, 1f, 5, new ItemTexture(new ItemStack(Material.DIAMOND_SWORD)), Bukkit.getOnlinePlayers());

Parameter explanation:

  1. The location at which the particle should be displayed.
  2. The x offset of the particle.
  3. The y offset of the particle.
  4. The Z offset of the particle.
  5. The speed at which the particle flies of.
  6. The amount of particles that will be displayed
  7. The texture the particle will should have. (In this case it's a Diamond sword.)
  8. The players that will see the particle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.