Skip to content
JasperLorelai edited this page Jul 16, 2026 · 21 revisions

Source Code

spell-class: ".targeted.LoopSpell"
ValueSupported
entitytrue
locationtrue
entity_from_locationfalse
  • delayed - Plays the effect at the loop's location when the loop ends.

Description:

The LoopSpell allows for the caster to repeatedly cast spells at either a target, the target's location or their own location for some duration of time and a certain amount of iterations. The LoopSpell can also be used without a target or location if the targeted option is set to false.

Configuration:

Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.

OptionDescriptionTypeDefaultSupports expressions
delayDefines how long, in ticks, before the loop starts. Since 4.0 Beta 13: With negative values, the iterations are done immediately, instead of at the beginning of the next tick.Long0true
durationDefines how long, in ticks, the loop will last. If less than or equal to 0, the loop will last indefinitely unless iterations are specified.Long0true
intervalDefines how long, in ticks, the interval between casting the spells. Since 4.0 Beta 13: When <=0, all of the iterations of the loop are done at once.Long20true
iterationsDefines how many total iterations the loop will do. If less than or equal to 0, the loop will last indefinitely unless duration is specified.Integer0true
y-offsetVertical offset when casting at a locationDouble0true
targetedIf true, depending on require-entity-target and point-blank, the loop will target an entity or location. If false, spells will be cast without an entity or location target.Booleantruetrue
point-blankWhen true and require-entity-target: false, the spell will be cast on the caster's location. When false, the spell will be cast on the targeted block.Booleanfalsetrue
stop-on-failIf true, if a spell fails to cast, the loop will stop.Booleanfalsetrue
only-count-on-successIf true, an iteration of the loop only counts towards iterations if all of the subspells in spells succeed.Booleanfalsetrue
pass-targetingWhen false, sub-spells will recheck their individual can-target lists.Booleantruetrue
cancel-on-deathIf true, dying will cancel the loop. Will always cancel if targeting a non-player entity.Booleanfalsetrue
require-entity-targetIf true, targets an entity for the loop.Booleanfalsetrue
cast-random-spell-insteadIf true, the loop will instead randomly cast one spell in spells each iteration.Booleanfalsetrue
skip-firstIf true, skips loop-modifiers, variable-mods-loop, loop-target-modifiers, loop-location-modifiers and variable-mods-target-loop on the first iteration of the loop.Booleanfalsetrue
skip-first-loop-modifiersIf true, skip loop-modifiers on the first iteration of the loop. Uses the value of skip-first as its default.BooleanskipFirsttrue
skip-first-variable-mods-loopIf true, skip variable-mods-loop on the first iteration of the loop. Uses the value of skip-first as its default.BooleanskipFirsttrue
skip-first-loop-target-modifiersIf true, skip loop-target-modifiers on the first iteration of the loop. Uses the value of skip-first as its default.BooleanskipFirsttrue
skip-first-loop-location-modifiersIf true, skip loop-location-modifiers on the first iteration of the loop. Uses the value of skip-first as its default.BooleanskipFirsttrue
skip-first-variable-mods-target-loopIf true, skip variable-mods-target-loop on the first iteration of the loop. Uses the value of skip-first as its default.BooleanskipFirsttrue
str-fade-selfMessage sent to the caster when the loop ends.Rich Texttrue
str-fade-targetMessage sent to the target when the loop ends.Rich Texttrue
spell-on-endSub-spell casted when the loop ends.Stringfalse
spellsList of sub-spells casted on each iteration of the loop.String Listfalse
variable-mods-loopList of variable modifications performed on the caster on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked.String Listfalse
variable-mods-target-loopList of variable modifications performed on the target on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked.String Listfalse
loop-modifiersList of modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed.String Listfalse
loop-target-modifiersList of target modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed.String Listfalse
loop-location-modifiersList of location modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed.String Listfalse

Example:

Strikes targeted entity with lightning for up to 200 ticks (10 seconds). If the entity dies before the duration of the LoopSpell ends, the loop will cancel.

PerpetualLightning:
spell-class: ".targeted.LoopSpell"delay: 10duration: 200require-entity-target: truecancel-on-death: truestr-fade-self: "The foe has been slain, thus the lightning strikes cease."spells: - lightning

Variable Example:

Increments a variable by 1 each time a loop occurs. When the variable reaches its maximum value, the loop ends.

variables:
increasingvar:
type: playerpermanent: falsedefault: 0min: 0max: 10IncreasingVariableLoop:
spell-class: ".targeted.LoopSpell"require-entity-target: falsevariable-mods-loop: - increasingvar +1str-fade-self: "The variable has reached its maximum value of %var:increasingvar%"spells:
- IncreasingVarDummy(mode=full)loop-modifiers:
- variable increasingvar=10 deniedIncreasingVarDummy:
spell-class: ".targeted.DummySpell"target-self: truestr-cast-self: "The current value of the variable is %var:increasingvar%"helper-spell: true

Clone this wiki locally