java.lang.Object
com.github.fierioziy.particlenativeapi.core.asm.utils.ParticleRegistry

public class ParticleRegistry extends Object

A registry representing all particle name changes between various Spigot versions.

It consist of list containing a maps of ParticleNode nodes for each significant Spigot version change.

This approach allows for fast access to ParticleNode nodes of current particle name in running Spigot version using SpigotParticleVersion enum as index in the list. Next, it uses particle name as a key for returned map that returns ParticleNode associated with current particle.

This node is then used to find certain's particle in desired Spigot version.

This registry takes some memory, but it only exists during class generation and will be garbage collected after implementations of interface instantiation finishes.

  • Constructor Details

    • ParticleRegistry

      public ParticleRegistry()
  • Method Details

    • find

      Attempts to convert particle name from provided Spigot version to target Spigot version.

      Parameters:
      from - a SpigotParticleVersion enum representing Spigot version of parameter particle name.
      name - a particle name in parameter from Spigot version.
      to - a SpigotParticleVersion enum representing Spigot version to which attempt of conversion should happen.
      Returns:
      an Optional containing converted particle name or empty if particle has been removed or non-existent in target Spigot version.