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

public abstract class Effect extends Object
  • 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
    • executeOnStop

      public EffectModifier executeOnStop
      A function that executes when the effect stops. For example you could use it to chain effects one after the other
    • 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
    • getExecuteOnStop

      public EffectModifier getExecuteOnStop()
      A function that executes when the effect stops. For example you could use it to chain effects one after the other
    • setExecuteOnStop

      public void setExecuteOnStop(EffectModifier executeOnStop)
      Execute a function when the effect stops. For example you could use it to chain effects one after the other
    • 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.util.math.Vec3d pos, int color, float size)
    • 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)