Table of commands (1.20 and 1.21)
In this section all possible conditions are explained. Some conditions are not usable in all rules. This will be mentioned here. Whenever a position is tested in a rule the given position depends on the rule. For mob spawns this will be the position where the mob will spawn. For block break events this will be the position of the broken block. For player effects this is the position of the block on which the player is standing.
Possible types:
S: a stringB: a boolean (true/false)I: an integerF: floating point numberE: is a string describing a numeric expression (see above for information on those)[<type>]: a list of type (for example,[S]is a list of strings)JSON: a JSON in a specific format explained elsewhere
info
The table below is very wide. Please scroll horizontally to see all fields.
| Name | Type | spawner | spawn | summon | loot | exp | harvest | leftclick | rightclick | place | effect | Description |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| phase | S/[S] | V | V | V | V | V | V | V | V | V | V | all phases that must be active for this rule to work. Phases are defined in phases.json. Putting conditions in a phase is more efficient and cleaner |
| number | JSON | V | V | V | V | V | V | V | V | V | V | A json describing a numeric condition that must be valid before this rule can work. See the section on the numeric system for more information |
| when | S | V | can be equal to 'position', 'finalize', 'onjoin', or 'despawn'. Default is 'position' | |||||||||
| mindaycount / maxdaycount | I | V | V | V | indicate the minimum (inclusive) or maximum day count. The day counter starts at 0 (see the days command) | |||||||
| daycount | I/E | V | V | V | this is true if the day counter is a multiple of the given parameter. It also supports an expression in which case the expression is evaluated (see more on numeric expressions above in this wiki) | |||||||
| baby | B | V | V | V | true if this is a baby | |||||||
| spawner | B | V | true if spawned by a spawner | |||||||||
| spawntype | S/[S] | V | check the reason for the spawn. This can be a value like natural, chunk_generation, spawner, structure, breeding, mob_summoned, jockey, event, conversion, reinforcement, triggered, bucket, spawn_egg, command, dispenser, patrol | |||||||||
| incontrol | B | V | true if spawned by the In Control spawner system (spawner.json) | |||||||||
| eventspawn | B | V | true if spawned by the In Control event system (events.json) | |||||||||
| area | 'S' | V | V | V | V | V | V | V | V | V | test if the position is in a certain area (see areas.json) | |
| minheight / maxheight | I | V | V | V | V | V | V | V | V | V | V | indicates the minimum (inclusive) or maximum height at which this rule will fire |
| height | E | V | V | V | V | V | V | V | V | V | V | uses a numeric expression to test the height at which the mob will spawn |
| minlight / maxlight | I | V | V | V | V | V | V | V | V | V | value between 0 and 15 indicating the minimum and maximum block light level on the given block | |
| minlight_sky / maxlight_sky | I | V | V | V | V | V | V | V | V | V | value between 0 and 15 indicating the minimum and maximum sky light level on the given block | |
| minlight_full / maxlight_full | I | V | V | V | V | V | V | V | V | V | value between 0 and 15 indicating the minimum and maximum full (combined block and sky) light level on the given block | |
| light | E | V | V | V | V | V | V | V | V | V | uses a numeric expression to test the light level on the given block | |
| mincount / maxcount | S/I/JSON | V | V | string value that is either a number in which case it will count how many mobs of the given class are already in the world or else of the form <amount>,<mob> to count the number of mobs of that type. That way you can have a rule file based on the number of mobs already present. Note that instead of this syntax you can also use the JSON mob counter syntax as explained above | ||||||||
| maxthis / maxtotal / maxpeaceful / maxhostile / maxneutral / maxlocal | I | V | the maximum amount of mobs of this type, in total, passive, hostile, neutral or local (spawn box around the player, as this is more expensive use this with care) | |||||||||
| minspawndist / maxspawndist | F | V | V | V | V | V | V | V | V | V | the minimum or maximum distance (in minecraft units) to the spawn point in the world | |
| mintime / maxtime | I | V | V | V | V | V | V | V | V | V | the time of the day (a number between 0 and 23999) | |
| time | E | V | V | V | V | V | V | V | V | V | uses a numeric expression to test the time of the day (see the numeric expression section higher up in this wiki) | |
| mindifficulty / maxdifficulty | F | V | V | V | V | V | V | V | V | V | the local difficulty of the place where the mob will spawn. This is a number between 0 and 4 | |
| mindist / maxdist | I | V | V | V? | the minimum/maximum distance to the player for controlling the spawn. By default this is equal to 24/120 | |||||||
| minverticaldist / maxverticaldist | I | V | if specified you can use this to test for the vertical distance between the player and the position where the mob will spawn | |||||||||
| canspawnhere | B | V | a check that is specific to the entity implementation. This is called by Minecraft automatically if you return default as the result of this rule. For many mobs this check will do the standard light level check | |||||||||
| norestrictions | B | V | remove the mob specific (usually light related) restrictions on spawning | |||||||||
| inliquid / inwater / inlava / inair | B | V | allow spawning in any liquid, water, lava, or in air. This will ignore the mob specific restrictions it might have on spawning | |||||||||
| notcolliding | B | V | a check that is specific to the entity implementation. This is called by Minecraft automatically if you return default as the result of this rule. For many mobs this check will do a test if the mob would collide with blocks after spawning | |||||||||
| difficulty | S | V | V | V | V | V | V | V | V | V | one of the following values: easy, normal, hard, peaceful | |
| weather | S | V | V | V | V | V | V | V | V | V | rain or thunder | |
| category | S/[S] | V | V | V | V | V | V | V | V | V | NOT for 1.19! One of the following values: none, taiga, extreme_hills, jungle, mesa, plains, savanna, icy, the_end, beach, forest, ocean, desert, river, swamp, mushroom, nether. This represents the category of the current biome | |
| biometags | S/[S] | V | V | V | V | V | V | V | V | V | ONLY for 1.19! This is a biome tag (or list of tags) which will be used to match with the biome. Example tags are: minecraft:is_ocean, minecraft:is_hill, minecraft:has_structure/igloo, minecraft:allows_surface_slime_spawns, forge:is_hot, forge:is_cold, forge:is_wet, ... and a LOT more | |
| hostile / passive | B | V | V | V | V | matching only hostile or passive mobs | ||||||
| seesky | B | V | V | V | V | V | V | V | V | V | true if the block can see the sky (not in a cave) | |
| cave | B | V | V | V | V | V | V | V | V | V | true if we are in a cave. This is a more expensive test that tries to test if we are in a cave by checking if the block in all six directions is one that can occur in a cave | |
| slime | B | V | V | true if this is a slime chunk (only for 1.18 or higher) | ||||||||
| structure | S/[S] | V | V | V | V | V | V | V | V | V | the name of the structure to test for. This way you can make sure a rule only fires in a village for example. Some examples are minecraft:mineshaft, minecraft:village, and so on. Modded structures should also work | |
| structuretags | S/[S] | V | V | V | V | V | V | V | V | V | the name of the structure tag to test for. This way you can make sure a rule only fires in a village for example. Some examples are minecraft:mineshaft, minecraft:village, and so on. Modded structures should also work | |
| hasstructure | B | V | V | V | V | V | V | V | V | V | test if we are in any structure | |
| mob | S/[S] | V | V | V | V | an ID for a mob like minecraft:creeper and so on. Modded mobs should also work | ||||||
| mod | S/[S] | V | V | V | V | V | V | a mod id. By using this you can block spawns of mobs that belong to some mod. Use minecraft for vanilla mobs | ||||
| block | S/[S]/JSON | V | V | V | V | V | V | V | V | V | a block filter as explained above | |
| blockoffset | JSON | V | V | V | V | V | V | V | V | V | modify the position of the block that is being used by the block test (or the setblock action). This JSON can contain tags like x, y, or z which will be added (as offset) to the original block position or else the boolean tag look in which case the position will be the position the player is looking at (only in case there is a player involved which isn't the case for spawn.json) | |
| blocktest | S/[S]/JSON | V | V | V | V | V | V | V | V | V | a block filter as explained above bt with additinoal settings | |
| biome | S/[S] | V | V | V | V | V | V | V | V | V | the biome of the current block (like minecraft:plains for example) | |
| biometype | S/[S] | V | V | V | V | V | V | V | V | V | the biome type (from the biome dictionary). Examples are WARN, COLD, ICY, DESERT, and DESERT_LEGACY | |
| dimension | S/[S] | V | V | V | V | V | V | V | V | V | V | the dimension of the current block or player (for example minecraft:overworld) |
| dimensionmod | S/[S] | V | V | V | V | V | V | V | V | V | the mod of the dimension. You can use this to have a rule work in all dimensions from a given mod | |
| random | F | V | V | V | V | V | V | V | V | V | this will succeed rule if a random number is less then this number. So if you want to have a rule that fires with 10%chance then use 0.1 here | |
| npc | JSON | V | this is a json with the keys 'cloneTab' and 'cloneName'. It will evaluate to true if the mob that is spawning is an NPC from CustomNPCS matching those attributes | |||||||||
| player / fakeplayer / realplayer | B | V | V | indicating if the mob was killed by a player (fake or real), a fake player (automation that behaves like a player) and a real player | ||||||||
| projectile / explosion / magic / fire | B | V | V | indicating if the mob was killed by a projectile, explosion, magic or fire | ||||||||
| source | S/[S] | V | V | the damage source. Some sources are minecraft:lightning_bolt, minecraft:lava, minecraft:cactus, minecraft:wither, minecraft:hot_floor, ... | ||||||||
| playerhelditem / offhanditem / bothhandsitem | S/[S]/JSON | V | V | V | V | V | V | V | V | V | a representation of the item(s) that the player is holding in their main hand (or offhand). Use a correct item filter (or list of item filters) | |
| lackhelditem / lackoffhanditem | S/[S]/JSON | V | V | V | V | V | a representation of the item(s) that the player is not holding in their main hand (or offhand). Use a correct item filter (or list of item filters) | |||||
| helmet / chestplate / leggings / boots | S/[S]/JSON | V | V | V | V | V | V | V | V | V | a representation of the item(s) that the player is having as armor. Use a correct item filter (or list of item filters) | |
| lackhelmet / lackchestplate / lackleggings / lackboots | S/[S]/JSON | V | V | V | V | V | a representation of the item(s) that the player is not having as armor. Use a correct item filter (or list of item filters) | |||||
| addscoreboardtags | S/[S] | V | V | add scoreboard tags to the spawned entity | ||||||||
| scoreboardtags_all / scoreboardtags_any | S/[S] | V | V | V | V | test for scoreboard tags on the entity (all must be there or any must be there) | ||||||
| nodespawn | B | V | V | if this is given the mob will not despawn. Be careful with this! | ||||||||
| incity / instreet / insphere (Lost Cities) | B | V | V | V | V | V | V | V | V | V | check if the current position is in a city, street, or city sphere | |
| inbuilding / inmultibuilding (Lost Cities) | B | V | V | V | V | V | V | V | V | V | check if the current position is in a building or multibuilding | |
| building / multibuilding (Lost Cities) | S/[S] | V | V | V | V | V | V | V | V | V | check if the current position is in a specific building or multibuilding | |
| gamestage (Gamestages) | S | V | V | V | V | V | V | V | V | the current game stage. When a player is not really present (like with spawn.json) the closest player is used | ||
| winter / summer / spring / autumn (Serene Seasons) | B | V | V | V | V | V | V | V | V | V | check the current season (NOT IMPLEMENTED IN 1.16) | |
| amulet / ring / belt / trinket / charm / body / head (Baubles) | S/[S]/JSON | V | V | V | V | V | V | V | V | V | check if an item is in a bauble slot (NOT IMPLEMENTED YET IN 1.16) | |
| state / pstate (EnigmaScript) | S | V | V | this can be used to test the value of a (player) state with a string like this state=value (NOT IMPLEMENTED YET IN 1.16) |