Modifiers - TheComputerGeek2/MagicSpells GitHub Wiki
Modifiers allow an action to take place when a condition is met upon a spell being cast. For example, spells can require a condition to pass to be cast successfully.
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.
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 use facing 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)"
.
Some conditions don't require a condition variable. If they do it will be specified throughout this documentation as "ConditionVar".
Condition | Description | ConditionVar | Has Entity Target | Has Location Target |
---|---|---|---|---|
absorption |
[operator][number] |
true |
false |
|
advancement |
Passes if the entity has the advancement defined in ConditionVar. Remember that Minecraft advancements must start with the minecraft: namespace key. |
In Description | true |
false |
age |
baby or adult
|
true |
false |
|
alive |
Player's time since last death, specified in ticks. | [operator][number] |
true |
false |
always |
Passes always, just like chance 100 , but without any extra processing and math. These mechanics are useful when you don't care about the condition but want to perform a modifier action directly. |
true |
true |
|
angle |
Passes if the location angle is equal/less/more than the defined value to the other location (does not support caster-checked modifiers ). |
[operator][number] |
true |
true |
attributebase |
Since 4.0 Beta 14. Compares the base value of the specified attribute. | [attribute name][operator][number] |
true |
false |
attribute |
Since 4.0 Beta 14. Compares the current value of the specified attribute. | [attribute name][operator][number] |
true |
false |
attributedefault |
Since 4.0 Beta 14. Compares the default value of the specified attribute. | [attribute name][operator][number] |
true |
false |
biome |
Passes if the entity is in the biome. |
biome_1,biome_2,... (biome list) |
true |
true |
beneficial |
Passes if the spell was marked as a beneficial spell. | true |
true |
|
blocking |
Passes if the player is blocking with a shield. | true |
false |
|
blocktag |
Since 4.0 Beta 14. Passes if the checked block has at least one block tag. |
Block tags separated by , . |
false |
true |
buffactive |
Passes if an entity has an active buff spell. | Internal name of a buff spell. | true |
false |
buildable |
Since 4.0 Beta 14. Passes if this block is solid. Determined by Minecraft, typically a block a player can use to place a new block to build things. An example of a non buildable block would be: liquids, flowers, or fire. | false |
true |
|
burnable |
Since 4.0 Beta 14. Passes if this block is a block that fire can destroy. | false |
true |
|
canpickupitems |
If the target can pick up items. | true |
false |
|
cast |
Since 4.0 Beta 14. Passes if the specified sub-spell successfully casts. | Sub-spell | true |
true |
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. | In Description |
false (not needed) |
false (not needed) |
chestcontains |
Passes if the chest at the defined location contains the defined magic item. |
world,x,y,z,item . item should be written using the Magic Item String format. |
false (not needed) |
false (not needed) |
clientname |
Since 4.0 Beta 14. If the client didn't send this information, the brand name will be null . For the Notchian client this name defaults to vanilla . Some modified clients report other names such as forge & fabric . |
Value to compare to. | true |
true (caster) |
climbing |
Since 4.0 Beta 14. Passes if the checked entity is climbing. | true |
false |
|
collection |
modifier collection name | |||
collidable |
Since 4.0 Beta 14. Passes if this block is collidable. | false |
true |
|
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% . |
In Description | true |
false |
customnamevisible |
Passes if the entity's custom name is visible. | true |
false |
|
data |
Checks if the specified data element in ConditionVar 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 . |
In Description | true |
true (checks caster's modifiers ) |
day |
Passes if time is greater than 0 and less than 13000 . |
true |
false |
|
displayname |
Passes if the target's display name is equal to ConditionVar - case insensitive and it supports color codes. | In Description | true |
false |
distance |
Calculates the block distance between the entity and the targeted entity/location. | [operator][number] |
true |
false |
durability |
Valid slots: helm , helmet , chestplate , leggings , boots , offhand , hand , mainhand . |
[slot][operator][number],[slot][operator][number]... |
true |
false |
elevation |
The entity's Y level. | [operator][number] |
true |
true |
entitytype |
If the entity's type matches ConditionVar (or if it's a list then at least one element in the list). |
player , monster , animal , or an entity type. |
true |
false |
entitytypetag |
Since 4.0 Beta 14. Passes if the checked entity has at least one entity type tag. |
Entity type tags separated by , . |
true |
false |
facing |
If the entity is facing one of the valid directions specified. |
south , west , north , or east . |
true |
true |
falling |
If the entity is falling. | true |
false |
|
fixedpose |
Since 4.0 Beta 14. Passes if the target has a fixed pose. | true |
false |
|
fixedtime |
Since 4.0 Beta 16. Passes if the world has fixed time. | true |
true |
|
flying |
If the player is flying. | true |
false |
|
food |
[operator][number] |
true |
false |
|
gamemode |
Game Mode | true |
false |
|
gliding |
If the entity is gliding (elytra flight can be enabled without them being equipped). | true |
false |
|
griefpreventionisowner |
If the claim the player is in recognises them as its owner. | true |
true |
|
hasitemamount |
Checks the entity's item quantity of an item using the Magic Item String format specified in ConditionVar. | [operator][number];[magicItem] |
true |
true (for inventory blocks) |
hasitem |
Passes if the entity is holding the item specified in ConditionVar. |
material:durability|customName .material refers to Materialdurability can be omitted or you can put * .If customName has spaces, replace them with __ . |
true |
true (for inventory blocks) |
hasitemprecise |
If the entity has the item specified in their inventory. | Magic Item | true |
true (for inventory blocks) |
hasmark |
If the player has a mark set specified. | Mark spell internal name | true |
false |
hasscoreboardtag |
Passes if the entity has the scoreboard tag specified in ConditionVar. Supports variable replacement. | In Description | true |
false |
hasspell |
Passes if the player has the spell defined. | Spell's internal name | true |
false |
hastarget |
Passes if the entity has a target. | true |
false |
|
health |
Checks the entity's health. | [operator][number](%) |
true |
false |
holding |
Passes if the entity is holding the items specified. |
itemFormat,itemFormat,... itemFormat follows format: material:durability|customName material refers to Material,durability can be omitted or you can put * .If customName has spaces, replace them with __ . |
true |
false |
holdingprecise |
Passes if the entity is holding the item specified. | Magic Item | true |
false |
hoveringwith |
Passes if the entity is hovering with an item specified in an open inventory. | Magic Item | true |
false |
inblock |
If the entity is inside the block or blocks specified in ConditionVar. This can be one or multiple blocks, separated by a comma, with no space after. | In Description | true |
true |
incuboid |
Passes if the entity is inside the cuboid location specified. A cuboid region is a region between two opposite corner locations. | world,x1,y1,z1,x2,y2,z2 |
true |
true |
innomagiczone |
Passes if the entity is inside the No Magic Zones specified in ConditionVar. | In Description | true |
true |
inregion |
Passes if the entity is inside the WorldGuard region specified. | world:regionName |
true |
true |
isnpc |
Passes if the target is an NPC. | true |
false |
|
lastdamagetype |
Passes if the entity's last Damage Type matches the one specified in ConditionVar. | true |
false |
|
lastlife |
Checks the lifetime of the previous life, which is specified in ticks. | [operator][number] |
true |
false |
leaping |
Passes if the entity is in the air because its velocity was changed by the Leap spell specified. | Leap spell's internal name | true |
false |
leashed |
Since 4.0 Beta 14. Passes if the checked entity is leashed. | true |
false |
|
level |
Checks the user's level. | [operator][number] |
true |
false |
lightlevel |
Checks the entity's light level. |
lightType[operator][number] lightType may only be used since 4.0 Beta 13, and its valid values are: block , sky , or any (default if omitted). |
true |
true |
los |
Since 4.0 Beta 13. Checks if the caster has a line of sight towards the target. | true |
true |
|
lookingatblock |
If the entity is looking at the block specified in ConditionVar. This can be one block or multiple separated by a comma, with no space after. | true |
false |
|
loopactive |
Checks if the target currently has a loop active in the spell specified. |
Before 4.0 Beta 14: loopSpellName Since 4.0 Beta 14: loopSpellName[operator][number]
|
true |
false |
mana |
Checks the player's mana. | [operator][number](%) |
true |
false |
maxmana |
Checks the player's max mana. | [operator][number](%) |
true |
false |
money |
Checks the player's money. | [operator][number] |
true |
false |
moonphase |
Passes if the entity's location present moon phase matches the one specified. |
Since 4.0 Beta 14: MoonPhase Before 4.0 Beta 14: full , new , waning , waxing , waning_gibbous , last_quarter , waning_crescent , waxing_crescent , first_quarter , or waxing_gibbous
|
true |
true |
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 the customname condition instead. |
In Description | true |
false |
namepattern |
Passes if the entity's name, or the player's username or display name matches the regex pattern specified in the ConditionVar. | In Description | true |
false |
night |
Passes if time is greater than 13000 and less than 23000 . |
true |
true |
|
offhand |
Passes if the entity is holding, in the offhand slot, the item specified. |
type:durability|name - __ can be used to replace spaces. Multiple items like these can be specified, separated by a comma. |
true |
false |
offhandprecise |
Passes if the entity is holding, in the offhand slot, the item specified in ConditionVar using the Magic Item String format. This can be one item or multiple separated by a comma, with no space after. | In Description | true |
false |
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, with no space after. | In Description | true |
true |
oncooldown |
Passes if the player has the spell specified is currently on cooldown. | Spell internal name | true |
false |
onfire |
Passes if the entity is presently on fire. | true |
true |
|
onground |
Passes if the entity is on the ground. | true |
false |
|
onleash |
Passes if the entity is leashed. | true |
false |
|
onsameteam |
Passes if the player is in the same scoreboard team as the targeted player. | true |
false |
|
onteam |
Passes if the player is in the scoreboard team. | Team name | true |
false |
openslots |
Check the player's empty inventory slots. | [operator][number] |
true |
false |
outside |
Passes if the entity or location has no blocks above it. | true |
true |
|
overblock |
Passes if the entity or location has blocks specified. |
block;height block refers to block data, and it can be multiple block types separated by a comma, with no space after. |
true |
true |
overground |
Since 4.0 Beta 13. Passes if the entity is over a solid block within the specified depth. | Depth (Integer) | true |
true |
ownedbuffactive |
Passes if the entity has a buff spell active cast by the caster of this modifier. | Buff spell internal name | true |
false |
ownedloopactive |
Checks if the target currently has a loop active that was cast by the caster. |
Before 4.0 Beta 14: loopSpellName Since 4.0 Beta 14: loopSpellName[operator][number]
|
true |
false |
oxygen |
Checks the entity's oxygen level. | [operator][number] |
true |
false |
passable |
Since 4.0 Beta 14. Passes for blocks if it has no colliding parts that would prevent players from moving through it. | false |
true |
|
permission |
Passes if the player has the permission specified. This passes anyway if they have the wildcard permission. | Permission | true |
false |
pitch |
Checks the entity's pitch. | [operator][number] |
true |
false |
playercount |
Checks the server's player count. | [operator][number] |
false (not needed) |
false (not needed) |
playeronline |
Passes if an online player's username matches the ConditionVar. | In Description |
false (not needed) |
false (not needed) |
pluginenabled |
Passes if a presently enabled plugin's name matches ConditionVar. | In Description |
false (not needed) |
false (not needed) |
potioneffect |
Passes if the entity has an active potion effect that matches. |
effectType or effectType:potency Since 4.0 Beta 13 potion type and potency can be separated by an operator for comparison. |
true |
false |
power |
Checks the spell's power. | [operator][number] |
true |
true |
pulseractive |
Since 4.0 Beta 14. Checks how many pulsers the target has. Operator and value are optional. | pulserName[operator][amount] |
true |
false |
raining |
Passes if it's raining at the entity's location or targeted location. | true |
true |
|
receivingredstone |
Checks the targeted location's redstone signal of power. | [operator][number] |
true |
true |
replaceable |
Since 4.0 Beta 14. Passes if this block is replaceable. Determined by Minecraft, representing a block that is not AIR that you can still place a new block at, such as flowers. | false |
true |
|
richerthan |
Passes if the player is richer than the targeted player. | true |
false |
|
riding |
Passes if the entity is riding the entity type specified. | Entity Type | true |
false |
riptiding |
Passes if the entity is in the Riptide animation. | true |
false |
|
roof |
Passes if the entity has a block, that isn't air, above them. You can specify a height to check for in ConditionVar, the default is 10. | In Description | true |
true |
rotation |
Check's player's yaw (but supports negative degrees). | [operator][number] |
true |
true |
saturation |
Checks the player's saturation level. | [operator][number] |
true |
false |
signtext |
Passes if the sign at the defined location contains the defined text. |
Before 4.0 Beta 14: world,x,y,z,line__1\nline__2 Since 4.0 Beta 14: side;world,x,y,z,line__1,line__2 (side; is optional and can be front; or back; , world,x,y,z is also optional)Example: world,0,1,0,<gold>Hello__there
|
false (not needed) |
false (not needed) |
silent |
Since 4.0 Beta 14. Checks if the target is silent (as in, cannot make noises due to the silent tag being applied). | true |
true |
|
sleeping |
Since 4.0 Beta 14. Passes if the checked entity is sleeping. | true |
false |
|
slotselected |
[operator][number] |
true |
false |
|
sneaking |
Passes if the player is sneaking. | true |
false |
|
solid |
Since 4.0 Beta 14. Check if this block is solid. Determined by Minecraft, typically a block a player can stand on and can't be passed through. | false |
true |
|
spellcaststate |
Passes if this spell's cast state matches the one specified. |
normal , on_cooldown , missing_reagents , cant_cast , no_magic_zone , or wrong_world
|
false |
false |
spellselected |
Passes if the currently selected spell of the player's cast/bound item passes the filter. | Spell Filter | true |
true (checks caster's modifiers ) |
spelltag |
Passes if this spell's tag matches ConditionVar. | Tag name | false |
false |
sprinting |
Passes if the player is sprinting. | true |
false |
|
storm |
Passes if there's a storm at the entity's location or the targeted location. | true |
true |
|
swimming |
Passes if the player is swimming. | true |
false |
|
targeting |
Passes if the spell is targeting an entity type that matches at least one element of ConditionVar. |
caster or an entity type. One type or multiple separated by a comma, with no space after. If nothing is specified it will assume that all types are allowed. |
true |
false |
targetmaxhealth |
Checks the targeted entity's max health. | [operator][number] |
true |
false |
testforblock |
Passes if the location specified has the specified block. |
world,x,y,z=block block supports block data
|
false (not needed) |
false (not needed) |
thundering |
Passes if the weather is currently "thunder" at the entity's location or the targeted location. | true |
true |
|
time |
Passes if time at the entity's location or the targeted location is within the range specified. | startTime-endTime |
true |
true |
totemactive |
Since 4.0 Beta 14. Checks how many totems the target has. Operator and value are optional. | totemName[operator][amount] |
true |
false |
underblock |
Passes if the entity or location is under a block. |
block;height block refers to block data, and it can be multiple blocks separated by a comma, with no space after. |
true |
true |
underwater |
Since 4.0 Beta 14. Passes if the checked entity is underwater. | true |
false |
|
uptime |
Passes if the time in seconds since the server started is greater than the amount specified in ConditionVar. | In Description |
false (not needed) |
false (not needed) |
variable |
Checks the player's variable. | [varName][operator][number/variableName] |
true |
true (checks caster's modifiers ) |
variablematches |
Passes if the player's value of the variable matches the value of the target's variable. | Variable name | true |
true (checks caster's modifiers ) |
variablestringequals |
Passes if the player's string variable value matches the one specified. |
varName:value The value must be a string, with no space character. Value can be "null" to check for empty values. Since 4.0 Beta 13 it may also be a variable: varName1:varName2 .Since 4.0 Beta 14 you may separate variables with = instead. |
true |
true (checks caster's modifiers ) |
velocityactive |
Since 4.0 Beta 13. Passes if the entity is in the air because its velocity was changed by the Velocity spell specified. | Velocity spell internal name | true |
false |
wearing |
Passes if the player has any of the items specified in any wearable slots. |
itemFormat,itemFormat,... itemFormat follows format: material:durability|customName material refers to Materialdurability can be omitted or you can put * If customName has spaces, replace them with __ . |
true |
false |
wearinginslot |
Passes if the player has the item specified in the specific wearable slot. |
Before 4.0 Beta 16: Format: slot=itemType Valid slot types: helm (hat , head ), chest (tunic ), leg (pant ), boot (shoe , feet ).itemType refers to material.Since 4.0 Beta 16: Format: slotGroups=items slotGroups can be a list of slot groups (old ones still work) separated by , and optionally negated by the ! prefixitems may be a list of Magic Items separated by | . |
true |
false |
wearingprecise |
Passes if the player is wearing the item specified in any of their wearable slots. | Magic Item | true |
false |
world |
Passes if the entity or targeted location is in the world specified. | World name | true |
true |
worldguardbooleanflag |
Passes if the top-level region the player is standing in has the boolean flag specified set to TRUE. | Flag name | true |
true |
worldguardmembership |
Passes if the player has membership status in the top-level region the player is standing in. | Type of membership: owner , member , or member_only
|
true |
true |
worldguardstateflag |
Passes, if the top-level region the player is standing in, has the state flag specified set to ALLOW. | Flag name | true |
true |
yaw |
Checks the entity's yaw value. | [operator][number] |
true |
true |
When [operator]
is mentioned in the ConditionVar, the following operators have to be specified:
- Equals:
=
or:
- Less than:
<
- Greater than:
>
Since 4.0 Beta 13 some of these actions support dynamic values through numeric or string expressions.
Action | Description | Value | Value supports expressions |
---|---|---|---|
required or require
|
If the condition fails to pass, the spell will fail. | ||
denied or deny
|
If the condition passes, the spell will fail. | ||
power or empower or multiply
|
If the condition passes, the Spell Power will be multiplied by the amount specified in Value. | Spell Power (Float) | true |
addpower or add
|
If the condition passes, the amount specified in Value will be added to the current Spell Power. | Spell Power (Float) | true |
cooldown |
If the condition passes, the spell's cooldown will be set to the amount specified in Value. | Cooldown Seconds (Float) | true |
reagents |
If the condition passes, the spell's reagent cost quantity will be multiplied by the amount specified in Value. | Multiplier (Float) | true |
casttime |
If the condition passes, the spell's cast-time will be set to the amount specified in Value. |
Cast Time seconds (Float) | true |
stop |
If the condition passes, no other modifiers for the spell will be processed. | ||
continue |
If the condition fails to pass, no other modifiers for the spell will be processed. | ||
cast |
If the condition passes, the spell specified in Value will be cast. | Internal Spell Name | false |
castinstead |
If the condition passes, the spell specified in Value will be cast instead of this spell. | Internal Spell Name | false |
variable |
If the condition passes, the variable modification specified in Value will be done. | VarMod | true |
string |
If the condition passes, the string variable specified in Value will be set to the new value. | Format: stringVar newValue . |
Since 4.0 Beta 14 |
message |
Since 4.0 Beta 16. If the condition passes, this sends a message to the caster. | Rich Text | true |