Class ParticleWizardry

java.lang.Object
net.minecraft.client.particle.Particle
net.minecraft.client.particle.SingleQuadParticle
net.minecraft.client.particle.TextureSheetParticle
com.binaris.wizardry.api.client.particle.ParticleWizardry
Direct Known Subclasses:
ParticleBuff, ParticleCloud, ParticleDarkMagic, ParticleDust, ParticleFlash, ParticleIce, ParticleLeaf, ParticleLightningPulse, ParticleMagicBubble, ParticleMagicFire, ParticlePath, ParticleScorch, ParticleSnow, ParticleSpark, ParticleSparkle, ParticleSphere, ParticleTargeted

public abstract class ParticleWizardry extends net.minecraft.client.particle.TextureSheetParticle
Abstract superclass for all of wizardry's particles.

The new system is as follows:

- All particle classes have a single constructor which takes a world and a position only.
- Each particle class defines any relevant default values in its constructor, including velocity.
- The particle builder then overwrites any other values that were set during building.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected float
     
    protected @Nullable net.minecraft.world.entity.Entity
    The entity this particle is linked to.
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected float
    The pitch angle this particle is facing, or NaN if this particle always faces the viewer (default behaviour).
    static final Map<net.minecraft.core.particles.SimpleParticleType,BiFunction<net.minecraft.client.multiplayer.ClientLevel,net.minecraft.world.phys.Vec3,ParticleWizardry>>
     
    protected double
     
    protected Random
     
    protected double
    Velocity of this particle relative to the linked entity.
    protected double
    Velocity of this particle relative to the linked entity.
    protected double
    Velocity of this particle relative to the linked entity.
    protected double
    Coordinates of this particle relative to the linked entity.
    protected double
    Coordinates of this particle relative to the linked entity.
    protected double
    Coordinates of this particle relative to the linked entity.
    protected long
    A long value used by the renderer as a random number seed, ensuring anything that is randomized remains the same across multiple frames.
    protected boolean
    True if the particle is shaded, false if the particle always renders at full brightness.
    protected double
     
    protected float
    The yaw angle this particle is facing, or NaN if this particle always faces the viewer (default behaviour).

    Fields inherited from class net.minecraft.client.particle.TextureSheetParticle

    sprite

    Fields inherited from class net.minecraft.client.particle.SingleQuadParticle

    quadSize

    Fields inherited from class net.minecraft.client.particle.Particle

    age, alpha, bbHeight, bbWidth, bCol, friction, gCol, gravity, hasPhysics, level, lifetime, onGround, oRoll, rCol, removed, roll, speedUpWhenYMotionIsBlocked, x, xd, xo, y, yd, yo, z, zd, zo
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParticleWizardry(net.minecraft.client.multiplayer.ClientLevel world, double x, double y, double z, net.minecraft.client.particle.SpriteSet spriteSet, boolean updateTextureOnTick)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    drawParticle(com.mojang.blaze3d.vertex.VertexConsumer buffer, net.minecraft.client.Camera camera, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
     
    protected int
    getLightColor(float f)
     
    @NotNull net.minecraft.client.particle.ParticleRenderType
     
    void
    move(double dx, double dy, double dz)
     
    void
    render(@NotNull com.mojang.blaze3d.vertex.VertexConsumer vertexConsumer, net.minecraft.client.Camera camera, float tickDelta)
     
    void
    setCollisions(boolean canCollide)
    Sets this particle's collisions.
    void
    setColor(float red, float green, float blue)
    Sets the base color of the particle.
    void
    setEntity(net.minecraft.world.entity.Entity entity)
    Links this particle to the given entity.
    void
    setFacing(float yaw, float pitch)
    Sets the direction this particle faces.
    void
    setFadeColour(float r, float g, float b)
    Sets the fade color of the particle.
    void
    setGravity(boolean gravity)
    Sets this particle's gravity.
    void
    setParticleSpeed(double velocityX, double velocityY, double velocityZ)
    Sets the velocity of the particle.
    void
    setSeed(long seed)
    Sets the seed for this particle's randomly generated values and resets random to use that seed.
    void
    setShaded(boolean shaded)
    Sets whether the particle should render at full brightness or not.
    void
    setSpin(double radius, double speed)
    Sets the spin parameters of the particle.
    void
     
    protected void
    updateEntityLinking(float partialTicks)
     

    Methods inherited from class net.minecraft.client.particle.TextureSheetParticle

    getU0, getU1, getV0, getV1, pickSprite, setSprite, setSpriteFromAge

    Methods inherited from class net.minecraft.client.particle.SingleQuadParticle

    getQuadSize, scale

    Methods inherited from class net.minecraft.client.particle.Particle

    getBoundingBox, getLifetime, getParticleGroup, getPos, isAlive, remove, setAlpha, setBoundingBox, setLifetime, setLocationFromBoundingbox, setPos, setPower, setSize, shouldCull, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • PROVIDERS

      public static final Map<net.minecraft.core.particles.SimpleParticleType,BiFunction<net.minecraft.client.multiplayer.ClientLevel,net.minecraft.world.phys.Vec3,ParticleWizardry>> PROVIDERS
    • seed

      protected long seed
      A long value used by the renderer as a random number seed, ensuring anything that is randomized remains the same across multiple frames. For example, lightning particles use this to keep their shape across ticks. This value can also be set during particle creation, allowing users to keep randomized properties the same even across multiple particles. If unspecified, the seed is chosen at random.
    • random

      protected Random random
    • shaded

      protected boolean shaded
      True if the particle is shaded, false if the particle always renders at full brightness. Defaults to false.
    • initialRed

      protected float initialRed
    • initialGreen

      protected float initialGreen
    • initialBlue

      protected float initialBlue
    • fadeRed

      protected float fadeRed
    • fadeGreen

      protected float fadeGreen
    • fadeBlue

      protected float fadeBlue
    • angle

      protected float angle
    • radius

      protected double radius
    • speed

      protected double speed
    • entity

      @Nullable protected @Nullable net.minecraft.world.entity.Entity entity
      The entity this particle is linked to. The particle will move with this entity.
    • relativeX

      protected double relativeX
      Coordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used.
    • relativeY

      protected double relativeY
      Coordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used.
    • relativeZ

      protected double relativeZ
      Coordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used.
    • relativeMotionX

      protected double relativeMotionX
      Velocity of this particle relative to the linked entity. If the linked entity is null, these are not used.
    • relativeMotionY

      protected double relativeMotionY
      Velocity of this particle relative to the linked entity. If the linked entity is null, these are not used.
    • relativeMotionZ

      protected double relativeMotionZ
      Velocity of this particle relative to the linked entity. If the linked entity is null, these are not used.
    • yaw

      protected float yaw
      The yaw angle this particle is facing, or NaN if this particle always faces the viewer (default behaviour).
    • pitch

      protected float pitch
      The pitch angle this particle is facing, or NaN if this particle always faces the viewer (default behaviour).
    • adjustQuadSize

      protected boolean adjustQuadSize
  • Constructor Details

    • ParticleWizardry

      public ParticleWizardry(net.minecraft.client.multiplayer.ClientLevel world, double x, double y, double z, net.minecraft.client.particle.SpriteSet spriteSet, boolean updateTextureOnTick)
  • Method Details

    • setSeed

      public void setSeed(long seed)
      Sets the seed for this particle's randomly generated values and resets random to use that seed. Implementations will differ between particle types; for example, ParticleLightning has an update period which changes the seed every few ticks, whereas ParticleVine simply retains the same seed for its entire lifetime.
    • setShaded

      public void setShaded(boolean shaded)
      Sets whether the particle should render at full brightness or not. True if the particle is shaded, false if the particle always renders at full brightness. Defaults to false.
    • setGravity

      public void setGravity(boolean gravity)
      Sets this particle's gravity. True to enable gravity, false to disable. Defaults to false.
    • setCollisions

      public void setCollisions(boolean canCollide)
      Sets this particle's collisions. True to enable block collisions, false to disable. Defaults to false.
    • setParticleSpeed

      public void setParticleSpeed(double velocityX, double velocityY, double velocityZ)
      Sets the velocity of the particle.
      Overrides:
      setParticleSpeed in class net.minecraft.client.particle.Particle
      Parameters:
      velocityX - The x velocity
      velocityY - The y velocity
      velocityZ - The z velocity
    • setSpin

      public void setSpin(double radius, double speed)
      Sets the spin parameters of the particle.
      Parameters:
      radius - The spin radius
      speed - The spin speed in rotations per tick
    • setEntity

      public void setEntity(net.minecraft.world.entity.Entity entity)
      Links this particle to the given entity. This will cause its position and velocity to be relative to the entity.
      Parameters:
      entity - The entity to link to.
    • setColor

      public void setColor(float red, float green, float blue)
      Sets the base color of the particle. Note that this also sets the fade colour so that particles without a fade colour do not change colour at all; as such fade colour must be set after calling this method.
      Overrides:
      setColor in class net.minecraft.client.particle.Particle
      Parameters:
      red - The red color component
      green - The green color component
      blue - The blue colour component
    • setFadeColour

      public void setFadeColour(float r, float g, float b)
      Sets the fade color of the particle.
      Parameters:
      r - The red color component
      g - The green color component
      b - The blue colour component
    • setFacing

      public void setFacing(float yaw, float pitch)
      Sets the direction this particle faces. This will cause the particle to render facing the given direction.
      Parameters:
      yaw - The yaw angle of this particle in degrees, where 0 is south.
      pitch - The pitch angle of this particle in degrees, where 0 is horizontal.
    • getRenderType

      @NotNull public @NotNull net.minecraft.client.particle.ParticleRenderType getRenderType()
      Specified by:
      getRenderType in class net.minecraft.client.particle.Particle
    • getLightColor

      protected int getLightColor(float f)
      Overrides:
      getLightColor in class net.minecraft.client.particle.Particle
    • render

      public void render(@NotNull @NotNull com.mojang.blaze3d.vertex.VertexConsumer vertexConsumer, net.minecraft.client.Camera camera, float tickDelta)
      Overrides:
      render in class net.minecraft.client.particle.SingleQuadParticle
    • drawParticle

      protected void drawParticle(com.mojang.blaze3d.vertex.VertexConsumer buffer, net.minecraft.client.Camera camera, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
    • updateEntityLinking

      protected void updateEntityLinking(float partialTicks)
    • tick

      public void tick()
      Overrides:
      tick in class net.minecraft.client.particle.Particle
    • move

      public void move(double dx, double dy, double dz)
      Overrides:
      move in class net.minecraft.client.particle.Particle