java.lang.Object
me.emafire003.dev.particleanimationlib.Effect
Direct Known Subclasses:
AnimatedBallEffect, SphereEffect, TargetedEffect, YPREffect

public abstract class Effect extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected boolean
     
    protected net.minecraft.entity.Entity
     
    protected int
     
    protected net.minecraft.util.math.Vec3d
     
    protected net.minecraft.util.math.Vec3d
     
    protected net.minecraft.particle.ParticleEffect
     
    protected int
     
     
    protected boolean
     
    protected boolean
    If true and an entity is the origin it will use their head position if possibile
    protected net.minecraft.server.world.ServerWorld
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Effect(net.minecraft.server.world.ServerWorld world, EffectType type, net.minecraft.particle.ParticleEffect particle, net.minecraft.util.math.Vec3d originPos)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static void
    copy(Effect original, Effect copy)
     
    void
    displayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos)
    Needs to be overridden by the other classes Not yet ready, may be scrapped
    void
    displayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.Vec3d vel)
     
    int
     
    net.minecraft.entity.Entity
     
    int
     
    net.minecraft.util.math.Vec3d
     
    @Nullable net.minecraft.util.math.Vec3d
    Already sums the offsets!
    net.minecraft.particle.ParticleEffect
     
    net.minecraft.server.world.ServerWorld
     
    boolean
     
    boolean
     
    protected void
    Main method to extend, here the animation code is run EACH tick
    protected void
    Can be override to add a finishing effect i guess
    void
    run()
    Runs the effect
    void
    run(EffectModifier modifier)
    Runs the effect, you can also provide a custom lambda function to modify the effect while it runs.
    void
    runFor(double seconds)
    Runs the effect for the specified amount of seconds You can do the same thing by setting the number of iterations manually using setIterations(int).
    void
    runFor(double seconds, EffectModifier modifier)
    Runs the effect for the specified amount of seconds
    void
    setDelay(int delay)
     
    void
    setEntityOrigin(net.minecraft.entity.Entity entityOrigin)
     
    void
    setIterations(int iterations)
     
    void
    setOriginOffset(net.minecraft.util.math.Vec3d originOffset)
     
    void
    setOriginPos(net.minecraft.util.math.Vec3d origin_pos)
     
    void
    setParticle(net.minecraft.particle.ParticleEffect particle)
     
    void
    setUpdatePositions(boolean updatePositions)
     
    void
    setUseEyePosAsOrigin(boolean useEyePosAsOrigin)
     
    void
    setWorld(net.minecraft.server.world.ServerWorld world)
     
    void
     

    Methods inherited from class java.lang.Object

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

    • iterations

      protected int iterations
    • originPos

      protected net.minecraft.util.math.Vec3d originPos
    • updatePositions

      protected boolean updatePositions
    • useEyePosAsOrigin

      protected boolean useEyePosAsOrigin
      If true and an entity is the origin it will use their head position if possibile
    • entityOrigin

      protected net.minecraft.entity.Entity entityOrigin
    • originOffset

      protected net.minecraft.util.math.Vec3d originOffset
    • world

      protected net.minecraft.server.world.ServerWorld world
    • particle

      protected net.minecraft.particle.ParticleEffect particle
    • type

      public EffectType type
    • delay

      protected int delay
    • done

      protected boolean done
    • ticks

      protected int ticks
  • Constructor Details

    • Effect

      public Effect(net.minecraft.server.world.ServerWorld world, EffectType type, net.minecraft.particle.ParticleEffect particle, net.minecraft.util.math.Vec3d originPos)
  • Method Details

    • copy

      protected static void copy(Effect original, Effect copy)
    • onRun

      protected void onRun()
      Main method to extend, here the animation code is run EACH tick
    • onStop

      protected void onStop()
      Can be override to add a finishing effect i guess
    • updatePos

      public void updatePos()
    • runFor

      public void runFor(double seconds)
      Runs the effect for the specified amount of seconds You can do the same thing by setting the number of iterations manually using setIterations(int). Each iteration is one tick, and 20 ticks are one second. Does not work with instant effects (wow eh?)
      Parameters:
      seconds - The number of seconds to run the effect for. Will be rounded to the closest tick number once calculated. For example 0.5 seconds will be 10 ticks, 0.01 seconds will be 0 ticks.
    • runFor

      public void runFor(double seconds, EffectModifier modifier)
      Runs the effect for the specified amount of seconds

      You can also provide a custom lambda function to modify the effect while it runs. You have access to the effect instance and the current tick

      You can do the same thing by setting the number of iterations manually using setIterations(int). Each iteration is one tick, and 20 ticks are one second.

      Does not work with instant effects (wow eh?)

      Parameters:
      seconds - The number of seconds to run the effect for. Will be rounded to the closest tick number once calculated. For example 0.5 seconds will be 10 ticks, 0.01 seconds will be 0 ticks.
    • run

      public void run()
      Runs the effect
    • run

      public void run(EffectModifier modifier)
      Runs the effect, you can also provide a custom lambda function to modify the effect while it runs. You have access to the effect instance and the current tick
    • displayParticle

      public void displayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos)
      Needs to be overridden by the other classes Not yet ready, may be scrapped
    • displayParticle

      public void displayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.Vec3d vel)
    • getIterations

      public int getIterations()
    • setIterations

      public void setIterations(int iterations)
    • getDelay

      public int getDelay()
    • setDelay

      public void setDelay(int delay)
    • getOriginPos

      @Nullable public @Nullable net.minecraft.util.math.Vec3d getOriginPos()
      Already sums the offsets!
    • setOriginPos

      public void setOriginPos(net.minecraft.util.math.Vec3d origin_pos)
    • isUpdatePositions

      public boolean isUpdatePositions()
    • setUpdatePositions

      public void setUpdatePositions(boolean updatePositions)
    • getEntityOrigin

      public net.minecraft.entity.Entity getEntityOrigin()
    • setEntityOrigin

      public void setEntityOrigin(net.minecraft.entity.Entity entityOrigin)
    • getOriginOffset

      public net.minecraft.util.math.Vec3d getOriginOffset()
    • setOriginOffset

      public void setOriginOffset(net.minecraft.util.math.Vec3d originOffset)
    • isUseEyePosAsOrigin

      public boolean isUseEyePosAsOrigin()
    • setUseEyePosAsOrigin

      public void setUseEyePosAsOrigin(boolean useEyePosAsOrigin)
    • getWorld

      public net.minecraft.server.world.ServerWorld getWorld()
    • setWorld

      public void setWorld(net.minecraft.server.world.ServerWorld world)
    • getParticle

      public net.minecraft.particle.ParticleEffect getParticle()
    • setParticle

      public void setParticle(net.minecraft.particle.ParticleEffect particle)