Spell Effects - MomoPewpew/MagicSpells GitHub Wiki

Description

Spell effects can be played at selected positions to make the effect play at the start, during or after a spell is cast. For example, you could make lightning strike you when you cast a particle projectile, you could make it cast at the position of the projectile all throughout its flight at a set interval, you could make it strike where the projectile lands, etc.

You can define spell effects in the spell option effects. This is not where the effect options go, but the effect name section which includes all of the effect options.

spell:
    spell-class: ".targeted.DummySpell"
    effects: # <-- Here
      1:
        position: target
        effect: lightning
      2:
        position: caster
        effect: particles
        particle-name: end_rod
        horiz-spread: .5
        vert-spread: .5
        speed: .1
        count: 10

The map keys 1 and 2 are the names of the effects. The name of the effect does not matter. You could use them to describe the effect - you could rename 2 to Particles if you want. It's just important you don't have two same map keys in a map.

Configuration

For a spell effect to load successfully, it needs to have at least a defined position and effect with valid values.

Source Code

General Configuration:

Option Description Default value
delay Defines delay in ticks before the effect is played. 0
chance Defines the chance of the effect playing. -1 (basically 100%)
z-offset Defines offset of the effect location on the Z axis. 0
height-offset Same as above, but for the Y axis. 0
forward-offset Same as above, but for the X-axis. 0
offset Vector offset instead of the above properties. Format: "x,y,z". "0,0,0"
relative-offset Same as above, but it's relative. "0,0,0"
add-pitch Adds pitch to the effect location. "0.0"
add-yaw Adds yaw to the effect location. "0.0"
set-pitch Sets the pitch of the location. "0.0"
set-yaw Sets the yaw of the location. "0.0"
modifiers Modifiers which determine whether the spell effect should be played or not.
location-modifiers Same as above but the conditions check location.
special-effect-interval An effect-specific override for the spell configuration special-effect-interval. Currently only works for the Particle Projectile Spell

Effect Positions (and their options):

The configuration name Description
start or startcast Plays when the spell starts casting. This position does not wait for cast-time to finish.
pos1, position1, caster or actor Plays the effect at the caster's position on the successful cast.
pos2, position2 or target Plays the effect at the target's position or targeted location if either found.
line or trail (Options) If a target or targeted location is present, this position plays the effect as a trail between the caster and the target (or targeted location) in that order.
reverse_line, reverseline or rline (Options) A reverse version of the above.
disabled Plays when: a Beam or BlockBeam spell hits a non-transparent block, a Buff spell fades, the entity has an active Haste spell and they stop sprinting, the entity dismounts from a Steed spell, a Totem spell ends (at it's location), etc.
delayed Plays when a spell ends at the location - when projectiles land or hit something when pulsers or totem spells end, etc.
special Plays the effect instantly at the center of an AreaEffect spell. It can also play at the location of these spells: Beam, BlockBeam, Bomb, HomingMissile, HomingProjectile, ItemProjectile, Orbit, ParticleProjectile, Projectile - on the interval defined by the specific spell option on these spells, until they land or hit something. Or it can play at the location of entities created by the types of conjure spells until they are picked up or despawned. The interval is also specified by their specific spell options.
buff or active(Options) Plays the effect at the affected entity until the buff ends.
orbit (Options) Plays the effect at the orbit's location until the buff ends.

Line position-specific options:

Options Description Default Value
max-distance If the distance between the two points is greater than the max distance defined by this option the effect will not play. 100 (Blocks)
distance-between Defines the distance before the next effect should be played - until the second point is reached. 1.0 (Block distance, double value)

Buff position-specific options:

Options Description Default Value
effect-interval The interval in ticks for the effect - the delay to wait before playing it again until the buff ends. 20

Orbit position-specific options:

Options Description Default Value
orbit-radius The starting radius of the orbit. 1.0 (Block distance)
orbit-y-offset The starting height offset. 0.0 (Block distance)
orbit-horiz-offset The starting horizontal offset. 0.0 (Block distance)
orbit-horiz-expand-radius The horizontal radius to expand on interval defined by orbit-horiz-expand-delay. 0.0 (Block distance)
orbit-horiz-expand-delay The interval in ticks at which to expand the horizontal radius of the orbit - distance is defined by orbit-horiz-expand-radius. 0 ticks
orbit-vert-expand-radius The vertical radius to expand on interval defined by orbit-vert-expand-delay. 0.0 (Block distance)
orbit-vert-expand-delay The interval in ticks at which to expand the vertical radius of the orbit. Distance is defined by orbit-vert-expand-radius. 0 ticks
orbit-seconds-per-revolution Duration of one full cycle of the orbit defined in seconds. 3.0s
orbit-tick-interval The interval in ticks for the orbit effect task. 0 ticks

Effect Types:

The effect types that have a hyperlink include special options that are specific to that effect. Click on the hyperlink to see the configuration of these options.

Types:

  • armorstand
  • actionbartext
  • bossbar
  • broadcast
  • cloud- Creates a cloud of smoke, has the radius option.
  • dragondeath - Creates the visual of an ender dragon death.
  • ender - Plays the effect when an eye of ender is broken.
  • entity
  • explosion - Creates a small explosion.
  • fireworks
  • itemcooldown - Displays item cooldown (like the ender pearl cooldown) for the set duration on the set item material type.
  • itemspray
  • lightning - Creates a lightning strike.
  • nova
  • particles
  • particlespersonal - Same as the particles effect, but it is only played to the player targeted by the effect's spell.
  • particlecloud
  • potion - Creats a potion effect particles. Has duration in ticks and color - hex format.
  • smoketrail - Creates a trail of smoke. Has the duration and interval options.
  • smokeswirl - Creates an orbiting swirl of smoke. Has the duration option.
  • sound
  • soundpersonal - Same as the sound effect, but it is only played to the player targeted by the effect's spell.
  • spawn - Plays the effect when a spawner spawns a mob.
  • splash - Plays the effect when a splash potion is thrown.
  • title
  • effectlib - Plays the effect on position like normal.
  • effectlibline - Use this when you're using position: line.
  • effectlibentity - Use this effect when you want the effect to follow the entity while playing.
  • fontanimation - Use this effect to play a titlebar animation using a resource pack font.