Class ParticleControllerInstance
java.lang.Object
at.minecraftschurli.mods.arsmagicalegacy.api.client.particle.ParticleControllerInstance
An instance of a
ParticleController, holding runtime context.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal @Nullable net.minecraft.world.entity.LivingEntityfinal ParticleControllerfinal @Nullable net.minecraft.world.entity.Entityfinal @Nullable net.minecraft.world.phys.HitResultfinal ControlledParticle -
Constructor Summary
ConstructorsConstructorDescriptionParticleControllerInstance(ControlledParticle particle, ParticleController controller, @Nullable net.minecraft.world.entity.LivingEntity caster, @Nullable net.minecraft.world.entity.Entity directEntity, @Nullable net.minecraft.world.phys.HitResult hitResult) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()Marks the instance as finished and (ifParticleController.killOnFinish()is true) removes the particle.<T> @Nullable TgetContext(String key) @Nullable net.minecraft.world.phys.Vec3Tries to get theEntityfrom theHitResult.@Nullable net.minecraft.world.entity.EntityTries to get theEntityfrom theHitResult.intbooleanhasContext(String key) boolean<T> voidsetContext(String key, T value) Puts an extra instance context value.voidtick()Ticks the instance.
-
Field Details
-
particle
-
controller
-
caster
public final @Nullable net.minecraft.world.entity.LivingEntity caster -
directEntity
public final @Nullable net.minecraft.world.entity.Entity directEntity -
hitResult
public final @Nullable net.minecraft.world.phys.HitResult hitResult
-
-
Constructor Details
-
ParticleControllerInstance
public ParticleControllerInstance(ControlledParticle particle, ParticleController controller, @Nullable net.minecraft.world.entity.LivingEntity caster, @Nullable net.minecraft.world.entity.Entity directEntity, @Nullable net.minecraft.world.phys.HitResult hitResult) - Parameters:
particle- TheControlledParticlethe controller belongs to.controller- TheParticleControllerto query for values.caster- TheLivingEntitycasting theSpell. May be null if this is not called from a spell cast.directEntity- The entity applying theSpell, e.g. a projectile. May or may not be identical to the caster. May be null if this is not called from a spell cast.hitResult- TheHitResultof the spell cast. May be null if this is not called from a spell cast.
-
-
Method Details
-
tick
public void tick()Ticks the instance. -
finish
public void finish()Marks the instance as finished and (ifParticleController.killOnFinish()is true) removes the particle. -
isFinished
public boolean isFinished()- Returns:
- Whether the instance is marked as finished.
-
getTickCount
public int getTickCount()- Returns:
- The amount of ticks this instance has been active so far.
-
hasContext
- Parameters:
key- The key of the context value to check.- Returns:
- Whether the instance contains a context value by the given key.
-
getContext
- Type Parameters:
T- The type of the context value.- Parameters:
key- The key of the context value to get.- Returns:
- The associated context value.
-
setContext
Puts an extra instance context value.- Type Parameters:
T- The type of the context value.- Parameters:
key- The key of the context value.value- The context value.
-
getTargetOrFinish
public @Nullable net.minecraft.world.entity.Entity getTargetOrFinish()Tries to get theEntityfrom theHitResult. If unsuccessful, finishes the controller and returns null.- Returns:
- The target
Entityor null.
-
getLocationOrFinish
public @Nullable net.minecraft.world.phys.Vec3 getLocationOrFinish()Tries to get theEntityfrom theHitResult. If unsuccessful, finishes the controller and returns null.- Returns:
- The target
Entityor null.
-