Skip to main content

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 string
  • B: a boolean (true/false)
  • I: an integer
  • F: floating point number
  • E: 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.

NameTypespawnerspawnsummonlootexpharvestleftclickrightclickplaceeffectDescription
phaseS/[S]VVVVVVVVVVall 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
numberJSONVVVVVVVVVVA json describing a numeric condition that must be valid before this rule can work. See the section on the numeric system for more information
whenSVcan be equal to 'position', 'finalize', 'onjoin', or 'despawn'. Default is 'position'
mindaycount / maxdaycountIVVVindicate the minimum (inclusive) or maximum day count. The day counter starts at 0 (see the days command)
daycountI/EVVVthis 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)
babyBVVVtrue if this is a baby
spawnerBVtrue if spawned by a spawner
spawntypeS/[S]Vcheck 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
incontrolBVtrue if spawned by the In Control spawner system (spawner.json)
eventspawnBVtrue if spawned by the In Control event system (events.json)
area'S'VVVVVVVVVtest if the position is in a certain area (see areas.json)
minheight / maxheightIVVVVVVVVVVindicates the minimum (inclusive) or maximum height at which this rule will fire
heightEVVVVVVVVVVuses a numeric expression to test the height at which the mob will spawn
minlight / maxlightIVVVVVVVVVvalue between 0 and 15 indicating the minimum and maximum block light level on the given block
minlight_sky / maxlight_skyIVVVVVVVVVvalue between 0 and 15 indicating the minimum and maximum sky light level on the given block
minlight_full / maxlight_fullIVVVVVVVVVvalue between 0 and 15 indicating the minimum and maximum full (combined block and sky) light level on the given block
lightEVVVVVVVVVuses a numeric expression to test the light level on the given block
mincount / maxcountS/I/JSONVVstring 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 / maxlocalIVthe 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 / maxspawndistFVVVVVVVVVthe minimum or maximum distance (in minecraft units) to the spawn point in the world
mintime / maxtimeIVVVVVVVVVthe time of the day (a number between 0 and 23999)
timeEVVVVVVVVVuses a numeric expression to test the time of the day (see the numeric expression section higher up in this wiki)
mindifficulty / maxdifficultyFVVVVVVVVVthe local difficulty of the place where the mob will spawn. This is a number between 0 and 4
mindist / maxdistIVVV?the minimum/maximum distance to the player for controlling the spawn. By default this is equal to 24/120
minverticaldist / maxverticaldistIVif specified you can use this to test for the vertical distance between the player and the position where the mob will spawn
canspawnhereBVa 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
norestrictionsBVremove the mob specific (usually light related) restrictions on spawning
inliquid / inwater / inlava / inairBVallow spawning in any liquid, water, lava, or in air. This will ignore the mob specific restrictions it might have on spawning
notcollidingBVa 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
difficultySVVVVVVVVVone of the following values: easy, normal, hard, peaceful
weatherSVVVVVVVVVrain or thunder
categoryS/[S]VVVVVVVVVNOT 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
biometagsS/[S]VVVVVVVVVONLY 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 / passiveBVVVVmatching only hostile or passive mobs
seeskyBVVVVVVVVVtrue if the block can see the sky (not in a cave)
caveBVVVVVVVVVtrue 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
slimeBVVtrue if this is a slime chunk (only for 1.18 or higher)
structureS/[S]VVVVVVVVVthe 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
structuretagsS/[S]VVVVVVVVVthe 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
hasstructureBVVVVVVVVVtest if we are in any structure
mobS/[S]VVVVan ID for a mob like minecraft:creeper and so on. Modded mobs should also work
modS/[S]VVVVVVa mod id. By using this you can block spawns of mobs that belong to some mod. Use minecraft for vanilla mobs
blockS/[S]/JSONVVVVVVVVVa block filter as explained above
blockoffsetJSONVVVVVVVVVmodify 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)
blocktestS/[S]/JSONVVVVVVVVVa block filter as explained above bt with additinoal settings
biomeS/[S]VVVVVVVVVthe biome of the current block (like minecraft:plains for example)
biometypeS/[S]VVVVVVVVVthe biome type (from the biome dictionary). Examples are WARN, COLD, ICY, DESERT, and DESERT_LEGACY
dimensionS/[S]VVVVVVVVVVthe dimension of the current block or player (for example minecraft:overworld)
dimensionmodS/[S]VVVVVVVVVthe mod of the dimension. You can use this to have a rule work in all dimensions from a given mod
randomFVVVVVVVVVthis 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
npcJSONVthis 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 / realplayerBVVindicating 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 / fireBVVindicating if the mob was killed by a projectile, explosion, magic or fire
sourceS/[S]VVthe damage source. Some sources are minecraft:lightning_bolt, minecraft:lava, minecraft:cactus, minecraft:wither, minecraft:hot_floor, ...
playerhelditem / offhanditem / bothhandsitemS/[S]/JSONVVVVVVVVVa 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 / lackoffhanditemS/[S]/JSONVVVVVa 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 / bootsS/[S]/JSONVVVVVVVVVa 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 / lackbootsS/[S]/JSONVVVVVa representation of the item(s) that the player is not having as armor. Use a correct item filter (or list of item filters)
addscoreboardtagsS/[S]VVadd scoreboard tags to the spawned entity
scoreboardtags_all / scoreboardtags_anyS/[S]VVVVtest for scoreboard tags on the entity (all must be there or any must be there)
nodespawnBVVif this is given the mob will not despawn. Be careful with this!
incity / instreet / insphere (Lost Cities)BVVVVVVVVVcheck if the current position is in a city, street, or city sphere
inbuilding / inmultibuilding (Lost Cities)BVVVVVVVVVcheck if the current position is in a building or multibuilding
building / multibuilding (Lost Cities)S/[S]VVVVVVVVVcheck if the current position is in a specific building or multibuilding
gamestage (Gamestages)SVVVVVVVVthe 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)BVVVVVVVVVcheck the current season (NOT IMPLEMENTED IN 1.16)
amulet / ring / belt / trinket / charm / body / head (Baubles)S/[S]/JSONVVVVVVVVVcheck if an item is in a bauble slot (NOT IMPLEMENTED YET IN 1.16)
state / pstate (EnigmaScript)SVVthis can be used to test the value of a (player) state with a string like this state=value (NOT IMPLEMENTED YET IN 1.16)