Skip to content
JasperLorelai edited this page Jul 15, 2023 · 57 revisions

Modifiers

Modifiers allow an action to take place when a condition is met upon a spell being casted. For example, spells can require a condition to pass in order to cast successfully.

Source Code

Configuration:

There are two types of modifier configurations:

  • Single - Action done based on one condition.
  • Modifier collections - Action to do based on multiple conditions. A pass condition can be specified where you can decide if the collection passes when ALL conditions pass or if ANY of the listed conditions passing is enough for the whole collection to pass. XOR defines that the collection can pass only if one of the listed conditions passes.

You can take a closer look at modifier collections on this guide, but on this page, we will only cover modifiers that are paired with a condition and an action for the condition.

Modifiers are a general spell option that contains a list of strings. Each of these strings contains a modifier, a pair with one condition and one action. The format for a modifier can be seen below. What's specified in round brackets is always required, what's specified in square brackets is only required if the condition or action expects a var value - more about these variables will be covered on the Modifier Conditions and Modifier Actions pages.

(condition) [condition var] (action) [action var]

You can specify a string to be sent to the caster of the spell if all modifiers fail to cast using the option str-modifier-failed. You can also send a string if a specific modifier fails by separating the message from the modifier with $$. Here's an example:

modifiers:
    - onground require$$You must be on the ground to cast this spell!
    # Color code supported
    - day required$$&4It must be &6day &4for this spell to cast successfully.

If you prepend the character ! (and surround the modifier string in quotes because YAML will screech at you), the condition outcome would be inverted. Say your modifier is day require. An inverted version, a condition that would only pass if it's nighttime, could be day deny and night require, but it can also be "!day require".

You might ask what the point of this is. There is a modifier action castinstead (spell) that will cast a different specified spell if the condition passes. So you could have something like day castinstead setNight.

Some conditions do not have a dualistic sibling (e.g. night and day), an inverted version of the condition. Say you configured the modifier facing to cast a spell if you're facing west - you would usefacing west castinstead (spell). Now, if you want this other spell to only be cast if the caster is not facing west but some other direction, you can use "!facing west castinstead (spell)".

Conditions:

Some conditions don't require a condition variable. If they do it will be specified throughout this documentation as "ConditionVar".

Condition Description
absorption ConditionVar format: [operator][number]
advancement Passes if the entity has the advancement defined in ConditionVar. Remember that minecraft advancements must start with minecraft: namespace key.
age ConditionVar accepts baby or adult
alive Player's time since last death, specified in ticks. ConditionVar format: [operator][number]
always Passes always, just like chance 100, but without any extra processing and math. These mechanics are useful for when you don't care about the condition, but want to perform a modifier action directly.
angle Passes if the entity's location angle is equal/less/more than the defined value to the other location. ConditionVar format: [operator][number]
beneficial Passes if the spell was marked as a beneficial spell.
biome Passes if the entity is in the biome. The value can be one biome or multiple separated by a comma, but no space.
blocking Passes if the player is blocking with a shield.
buffactive Passes if an entity has an active buff spell. ConditionVar accepts the internal name of a buff spell.
canpickupitems If the target can pick up items.
chance This generates a random number below 100. If the ConditionVar is lower than this number, the condition passes. This condition is in that way random.
chestcontains Passes if the chest at the defined location contains the defined magic item. ConditionVar format: world,x,y,z,magicItem.
collection More information about collections can be found on this guide.
customname Passes if the entity's custom name is equal to the ConditionVar. This does not work with players. Spaces must be replaced by "__" or you can check it matches the value of an ms string variable value with %var:stringVar%.
customnamevisible Passes if the entity's custom name is visible.
data Checks if the specified data element is lesser than, greater than or equal to the value supplied. __ can be used to substitute for spaces in the value. Supports variable replacement, including targeted variable replacement using %castervar and %targetvar.
day Passes if time is greater than 0 and less than 13000.
displayname Passes if the target's display name is equal to ConditionVar - case insensitive and it supports color codes.
distance Calculates the block distance between the entity and the targeted entity/location. ConditionVar format: [operator][number]
durability Valid slots: helm, helmet, chestplate, leggings, boots, offhand, hand, mainhand. ConditionVar format: [slot][operator][number],[slot][operator][number]...
elevation The entity's Y level. ConditionVar format: [operator][number]
entitytype If entity's type matches ConditionVar (or if it's a list then at least one element in the list). Valid element (types): player, monster, animal, or an entity type.
facing If the entity is facing one of the valid directions specified by the ConditionVar. Valid directions: south, west, north, east.
falling If the entity is falling.
flying If the player is flying.
food ConditionVar format: [operator][number]
gamemode Use this for ConditionVar reference.
gliding If the entity is gliding (elytra flight can be enabled without them being equipped).
griefpreventionisowner If the claim the player is in recognises them as its owner.
hasitem ConditionVar should be an item using the Cast Item format or multiple, separated by a comma, no space after.
hasitemamount Checks the entity's item quantity of an item using the Cast Item format specified in ConditionVar. Format: [operator][number];[magicItem].
hasitemprecise If the entity has the Magic Item specified in ConditionVar in their inventory.
hasmark If the player has a mark set specified in ConditionVar as the mark's internal spell name.
hasscoreboardtag Passes if the entity has the scoreboard tag specified in ConditionVar - supports variable replacement.
hasspell Passes if the player has the spell defined by its internal name in ConditionVar.
hastarget Passes if the entity has a target.
health Checks the entity's health with ConditionVar's format: [operator][number](%).
holding Passes if the entity is holding the item specified in ConditionVar using the Cast Item format. This could be one item or multiple. separated by a comma, no space after.
holdingprecise Passes if the entity is holding the item specified with the Cast Item format in ConditionVar.
hoveringwith Passes if the entity is hovering with an item using the Cast Item format specified in ConditionVar in an open inventory.
inblock If the entity is inside the block or blocks specified in ConditionVar.
incuboid Passes if the entity is inside the cuboid location specified in ConditionVar. A cuboid region is the region between two opposite corner locations defined by this format: world,x1,y1,z1,x2,y2,z2
innomagiczone Passes if the entity is inside the No Magic Zone specified in ConditionVar.
inregion Passes if the entity is inside the WorldGuard region specified in ConditionVar with the format: world:regionName
isnpc Passes if the target is an NPC.
lastdamagetype Passes if the entity's last Damage Type matches the one specified in ConditionVar.
lastlife Checks the alive time of the previous life, which is specified in ticks using the ConditionVar format: [operator][number]
leaping Passes if the entity is in air because their velocity was changed by the leap spell specified in ConditionVar (the internal name).
level Checks the user's level using the ConditionVar format: [operator][number]
lightlevel Checks the entity's light level using the ConditionVar format: [operator][number]
loopactive Checks if the target currently has a loop active in the spell specified in the ConditionVar.
lookingatblock If the entity is looking at the block type specified in ConditionVar. This can be one block or multiple separated by a comma, with no space after.
mana Checks the player's mana using the ConditionVar format: [operator][number](%)
maxmana Checks the player's max mana using the ConditionVar format: [operator][number](%)
money Checks the player's money using the ConditionVar format: [operator][number]
moonphase Passes if the entity's location present moon phase matches the one specified in ConditionVar. Valid phases: full, new, waning, waxing, waning_gibbous, last_quarter, waning_crescent, waxing_crescent, first_quarter, waxing_gibbous.
name Passes if the player's username or display name is equal to the ConditionVar. This does work with other entities and it does not support the space character - use CustomName condition instead.
namepattern Passes if the entity's name, or the player's username or display name matches the regex pattern specified in the ConditionVar.
night Passes if time is greater than 13000 and less than 23000.
offhand Passes if the entity is holding, in the offhand slot, the item specified in ConditionVar using the format: `type:data
offhandprecise Passes if the entity is holding, in the offhand slot, the item specified in ConditionVar using the Cast Item format. This can be one item or multiple separated by a comma, no space after.
onblock Passes if the entity is standing on the block or blocks specified in ConditionVar. This can be one item or multiple separated by a comma, no space after.
oncooldown Passes if the player has the spell specified in ConditionVar is currently on cooldown.
onfire Passes if the entity is presently on fire.
onground Passes if the entity is on ground.
onleash Passes if the entity is leashed.
onsameteam Passes if the player is in the same scoreboard team as the targeted player.
onteam Passes if the player is in the scoreboard team that matches ConditionVar.
openslots Check the player's empty inventory slots using the ConditionVar format: [operator][number]
outside Passes if the entity or location has no blocks above it.
overblock Passes if the entity or location has blocks specified in ConditionVar using the format: blockType;height. blockType can be multiple block types separated by a comma, no space after.
ownedbuffactive Passes if the entity has a buff spell active casted by the caster of this modifier. ConditionVar accepts an internal name of a buff spell.
ownedloopactive Checks if the target currently has a loop active that was casted by the caster in the spell specified in the ConditionVar.
oxygen Check's the entity's oxygen level using the ConditionVar format: [operator][number]
permission Passes if the player has the permission specified in ConditionVar. This passes anyway if they have the wildcard permission.
pitch Checks the entity's pitch using the ConditionVar format: [operator][number]
playercount Checks the server's player count using the ConditionVar format: [operator][number]
playeronline Passes if an online player's username matches the ConditionVar.
pluginenabled Passes if a presently enabled plugin's name matches ConditionVar.
potioneffect Passes if the entity has an active potion effect that matches the ConditionVar's format: effectType or effectType:potency
power Checks the spell's power using the ConditionVar format: [operator][number]
raining Passes if it's raining at entity's location or targeted location.
receivingredstone Checks the targeted location's redstone signal of power using the ConditionVar format: [operator][number]
richerthan Passes if the player is richer than the targeted player.
riding Passes if the entity is riding the entity type specified in ConditionVar.
riptiding Passes if the entity is in the Riptide animation. Only available in Beta-11+
roof Passes if the entity has a block, that isn't air, above them. You can specify a height to check for in ConditionVar, default is 10.
rotation Check's player's yaw (but supports negative degrees) using the ConditionVar format: [operator][number]
saturation Checks the player's saturation level using the ConditionVar format: [operator][number]
signtext Passes if the sign at the defined location contains the defined text. ConditionVar format: world,x,y,z,signLines, where signLines is a list of lines connected by \n, with spaces replaced by __. Example: world,0,1,0,&6line1\nline__2
slotselected ConditionVar format: [operator][number]
sneaking Passes if the player is sneaking.
spellcaststate Passes if this spell's cast state matches ConditionVar.
spellselected Passes if the currently selected spell of the player's cast/bound item passes the string-based Spell Filter.
spelltag Passes if this spell's tag matches ConditionVar.
sprinting Passes if the player is sprinting.
storm Passes if there's a storm at the entity's location or at the targeted location.
swimming Passes if the player is swimming.
targetmaxhealth Checks the targeted entity's max health using the ConditionVar format: [operator][number]
targeting Passes if the spell is targeting an entity type that matches at least one element of ConditionVar. Valid list: caster or an entity type. One type or multiple separated by a comma, no space after. If nothing is specified it will assume that all types are allowed.
testforblock Passes if the location specified has a block, all specified using ConditionVar's format: world,x,y,z=blockType
thundering Passes if the weather is currently "thunder" at the entity's location or the targeted location.
time Passes if time at the entity's location or the targeted location is within range specified with ConditionVar's format: startTime-endTime
underblock Passes if the entity or location is under a block. ConditionVar format: blockType;height. blockType can be multiple block types separated by a comma, no space after.
uptime Passes if the time in seconds since the server started is greater than the amount specified in ConditionVar.
variable Checks the player's variable using the ConditionVar format: [varName][operator][number/variableName]
variablematches Passes if the player's value of the variable matches the value of the target's variable. The ConditionVar must be the variable name.
variablestringequals Passes if the player's string variable value matches the one specified. ConditionVar format: varName:value . Value must be a string, with no space character. Value can be "null" to check for empty values.
wearing Passes if the player has any of the Cast Item format specified in ConditionVar in the wearable slots. Can be multiple item types separated by a comma, no space after.
wearinginslot Passes if the player has the item specified in the specific wearable slot. ConditionVar format: slot=itemType. Valid slot types: helm (hat, head), chest (tunic), leg (pant), boot (shoe, feet).
wearingprecise Passes if the player is wearing the item specified in ConditionVar using the Cast Item format in any of their wearable slots.
world Passes if the entity or targeted location is in the world specified in ConditionVar.
worldguardbooleanflag Passes if the top-level region the player is standing in has the boolean flag specified in ConditionVar set to TRUE.
worldguardmembership Passes if the player has membership status in the top-level region the player is standing in. Type of membership must be specified in ConditionVar as one of: owner, member, or member_only.
worldguardstateflag Passes if the top-level region the player is standing in has the state flag specified in ConditionVar set to ALLOW.
yaw Checks the entity's yaw value using the ConditionVar format: [operator][number]

Operator:

When [operator] is mentioned in the ConditionVar, the following operators have to be specified:

  • Equals: = or :
  • Less than: <
  • Greater than: >

Actions:

Action Description Value
required or require If the condition fails to pass, the spell will fail. Empty.
denied or deny If the condition passes, the spell will fail. Empty.
power or empower or multiply If the condition passes, the Spell Power will be multiplied by the amount specified in Value. Spell Power (Float)
addpower or add If the condition passes, the amount specified in Value will be added on the current Spell Power. Spell Power (Float)
cooldown If the condition passes, the spell's cooldown will be set to the amount specified in Value. Cooldown Seconds (Float)
reagents If the condition passes, the spell's reagent cost quantity will be multiplied by the amount specified in Value. Multiplier (Float)
casttime If the condition passes, the spell's cast-time will be set to the amount specified in Value. Cast Time seconds (Float)
stop If the condition passes, no other modifiers for the spell will be processed. Empty.
continue If the condition fails to pass, no other modifiers for the spell will be processed. Empty.
cast If the condition passes, the spell specified in Value will be cast. Internal Spell Name
castinstead If the condition passes, the spell specified in Value will be cast instead of this spell. Internal Spell Name
variable If the condition passes, the variable modification specified in Value will be done. Format: [:];[=|+|*|/|^|%|?][-]:]> (Example: varName;=10)
string If the condition passes, the string variable specified in Value will be set to the value also specified there. Format: stringVar newValue.

Source Code

Clone this wiki locally