Class Effect
java.lang.Object
me.emafire003.dev.particleanimationlib.Effect
- Direct Known Subclasses:
AnimatedBallEffect,SphereEffect,TargetedEffect,YPREffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected net.minecraft.entity.EntityA function that executes when the effect stops.booleanWeather or not the particles spawned have the "forced" property aka rendered much further away and bypass the option to not show them on the clientprotected intintEvery N iterations specified here the number of maximum particles spawned in that time frame isparticleLimitprotected net.minecraft.util.math.Vec3dprotected net.minecraft.util.math.Vec3dprotected net.minecraft.particle.ParticleEffectintThe limit of particles spawned at a given time (like on one iteration)booleanLimits the number of particles spawned every N iterations specified belowbooleanSet this to true to limit the max number of particles spawned each iteration, to save up on memory By default it's on and is capped at 5000 particles per tick.booleanSet this to true to skip some iteration of particles spawning to save up on server and client resourcesintHow many iterations to skip between a particle spawning and the other.protected intprotected booleanprotected booleanIf true and an entity is the origin it will use their head position if possibleprotected net.minecraft.server.world.ServerWorld -
Constructor Summary
ConstructorsConstructorDescriptionEffect(net.minecraft.server.world.ServerWorld world, EffectType type, net.minecraft.particle.ParticleEffect particle, net.minecraft.util.math.Vec3d originPos) -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidvoiddisplayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos) Needs to be overridden by the other classes Not yet ready, may be scrappedvoiddisplayParticle(net.minecraft.particle.ParticleEffect effect, net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.Vec3d vel) voiddisplayParticle(net.minecraft.util.math.Vec3d pos, int color, float size) intgetDelay()net.minecraft.entity.EntityA function that executes when the effect stops.intintnet.minecraft.util.math.Vec3d@Nullable net.minecraft.util.math.Vec3dAlready sums the offsets!net.minecraft.particle.ParticleEffectintintgetType()net.minecraft.server.world.ServerWorldgetWorld()net.minecraft.registry.RegistryKey<net.minecraft.world.World> booleanisForced()booleanbooleanprotected voidonRun()Main method to extend, here the animation code is run EACH tickprotected voidonStop()Can be override to add a finishing effect i guessvoidrun()Runs the effectvoidrun(EffectModifier modifier) Runs the effect, you can also provide a custom lambda function to modify the effect while it runs.voidrunFor(double seconds) Runs the effect for the specified amount of seconds You can do the same thing by setting the number of iterations manually usingsetIterations(int).voidrunFor(double seconds, EffectModifier modifier) Runs the effect for the specified amount of secondsvoidsetDelay(int delay) voidsetEntityOrigin(net.minecraft.entity.Entity entityOrigin) voidsetExecuteOnStop(EffectModifier executeOnStop) Execute a function when the effect stops.voidsetForced(boolean forced) voidsetIterations(int iterations) voidsetLimitParticlesEveryNIterations(int limitParticlesEveryNIterations) voidsetOriginOffset(net.minecraft.util.math.Vec3d originOffset) voidsetOriginPos(net.minecraft.util.math.Vec3d origin_pos) voidsetParticle(net.minecraft.particle.ParticleEffect particle) voidsetParticleLimit(int particleLimit) voidsetShouldLimitParticlesEveryNIterations(boolean shouldLimitParticlesEveryNIterations) voidsetShouldLimitParticlesSpawnedPerIteration(boolean shouldLimitParticlesSpawnedPerIteration) voidsetShouldSpawnParticlesEveryNIteration(boolean shouldSpawnParticlesEveryNIteration) voidsetSpawnParticlesEveryNIteration(int spawnParticlesEveryNIteration) voidsetUpdatePositions(boolean updatePositions) voidsetUseEyePosAsOrigin(boolean useEyePosAsOrigin) voidsetWorld(net.minecraft.server.world.ServerWorld world) booleanbooleanbooleanvoid
-
Field Details
-
iterations
protected int iterations -
originPos
protected net.minecraft.util.math.Vec3d originPos -
updatePositions
protected boolean updatePositions -
useEyePosAsOrigin
protected boolean useEyePosAsOriginIf true and an entity is the origin it will use their head position if possible -
entityOrigin
protected net.minecraft.entity.Entity entityOrigin -
originOffset
protected net.minecraft.util.math.Vec3d originOffset -
executeOnStop
A function that executes when the effect stops. For example, you could use it to chain effects one after the other -
shouldSpawnParticlesEveryNIteration
public boolean shouldSpawnParticlesEveryNIterationSet this to true to skip some iteration of particles spawning to save up on server and client resources -
spawnParticlesEveryNIteration
public int spawnParticlesEveryNIterationHow many iterations to skip between a particle spawning and the other. By default, it's a quarter of a second Only works ifshouldSpawnParticlesEveryNIterationis enabled -
shouldLimitParticlesSpawnedPerIteration
public boolean shouldLimitParticlesSpawnedPerIterationSet this to true to limit the max number of particles spawned each iteration, to save up on memory By default it's on and is capped at 5000 particles per tick. Which is a lot. -
particleLimit
public int particleLimitThe limit of particles spawned at a given time (like on one iteration) -
shouldLimitParticlesEveryNIterations
public boolean shouldLimitParticlesEveryNIterationsLimits the number of particles spawned every N iterations specified below -
limitParticlesEveryNIterations
public int limitParticlesEveryNIterationsEvery N iterations specified here the number of maximum particles spawned in that time frame isparticleLimit -
forced
public boolean forcedWeather or not the particles spawned have the "forced" property aka rendered much further away and bypass the option to not show them on the client -
world
protected net.minecraft.server.world.ServerWorld world -
particle
protected net.minecraft.particle.ParticleEffect particle -
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
-
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
A function that executes when the effect stops. For example you could use it to chain effects one after the other -
setExecuteOnStop
Execute a function when the effect stops. For example you could use it to chain effects one after the other -
getType
-
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 usingsetIterations(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
Runs the effect for the specified amount of secondsYou 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
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() -
getWorldRegistryKey
public net.minecraft.registry.RegistryKey<net.minecraft.world.World> getWorldRegistryKey() -
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) -
getLimitParticlesEveryNIterations
public int getLimitParticlesEveryNIterations() -
setLimitParticlesEveryNIterations
public void setLimitParticlesEveryNIterations(int limitParticlesEveryNIterations) -
shouldLimitParticlesEveryNIterations
public boolean shouldLimitParticlesEveryNIterations() -
setShouldLimitParticlesEveryNIterations
public void setShouldLimitParticlesEveryNIterations(boolean shouldLimitParticlesEveryNIterations) -
getParticleLimit
public int getParticleLimit() -
setParticleLimit
public void setParticleLimit(int particleLimit) -
getSpawnParticlesEveryNIteration
public int getSpawnParticlesEveryNIteration() -
setSpawnParticlesEveryNIteration
public void setSpawnParticlesEveryNIteration(int spawnParticlesEveryNIteration) -
shouldSpawnParticlesEveryNIteration
public boolean shouldSpawnParticlesEveryNIteration() -
setShouldSpawnParticlesEveryNIteration
public void setShouldSpawnParticlesEveryNIteration(boolean shouldSpawnParticlesEveryNIteration) -
shouldLimitParticlesSpawnedPerIteration
public boolean shouldLimitParticlesSpawnedPerIteration() -
setShouldLimitParticlesSpawnedPerIteration
public void setShouldLimitParticlesSpawnedPerIteration(boolean shouldLimitParticlesSpawnedPerIteration) -
isForced
public boolean isForced() -
setForced
public void setForced(boolean forced)
-