World Commands
Commands for modifying the world, placing blocks, summoning entities, and managing chunks.
/cloneCopies blocks from one region to another. Supports cross-dimension cloning in 1.19.4+ and various filtering modes.
/fillFills a region between two coordinates with a specified block. Supports various fill modes and optional filtering.
/forceloadForces specific chunks to remain loaded even when no players are nearby. Useful for always-on redstone or command block contraptions.
/locateFinds the nearest specified structure, biome, or point of interest and displays its coordinates.
/seedDisplays the world seed of the current world. The seed determines terrain generation.
/setblockPlaces a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it.
/setworldspawnSets the global world spawn point. New players and players without a personal spawn point will respawn here.
/spreadplayersDistributes entities randomly across an area. Useful for minigames, random spawn placement, and similar applications.
/summonSpawns an entity at a specified location, optionally with NBT data to customize the entity.
/worldborderManages the world border, its size, center, damage, warning distance, and warning time.
Placing blocks with /setblock, /fill and /clone
/setblock changes one block, /fill fills the box between two corners and /clone copies a box somewhere else. The word at the end of /setblock and /fill decides what happens to the blocks that are already there:
replace- The default. The old blocks disappear without dropping anything and without a sound.
destroy- The old blocks break as if a player mined them, so they drop themselves and anything stored inside.
keep- Only air is changed, so nothing that was already built gets touched.
hollowandoutline- Only for /fill. Both build the outer shell of the box. hollow turns the inside into air, outline leaves it as it was.
strict- Places the blocks exactly as written, without block updates or shape updates, so a fence keeps the connections you typed instead of joining its neighbors.
/clone has modes of its own. masked copies everything except air, and filtered copies a single kind of block. After that comes normal, force or move: normal refuses a copy that overlaps its source, force allows it, and move fills the source with air once the copy is made. The destination you type is the lower north-west corner of the copy, and since Java 1.19.4 source and copy can be in different dimensions.
By default one command can change at most 32768 blocks, a cube of 32 by 32 by 32. The game rule max_block_modifications sets that limit for /fill, /clone and /fillbiome. Before Java 1.21.11 it was called commandModificationBlockLimit, and before 1.19.4 the limit couldn't be changed at all.
Entities and the world spawn
/summon creates an entity where the command runs unless you give a position, and the NBT at the end can preset almost anything about it. Two entity types are refused: minecraft:player and minecraft:fishing_bobber.
/setworldspawn moves the world spawn, where new players arrive and where anyone without a personal spawn point comes back. They land within respawn_radius blocks of it, 10 by default, and that game rule was called spawnRadius before Java 1.21.11. Moving the spawn used to move the spawn chunks as well, the area that stayed loaded all the time. Java 1.21.9 removed spawn chunks, and since that version the world spawn can also be in another dimension.
/seed shows the world seed, and clicking the number copies it. In single player anyone can run it, cheats or not. On a server it needs level 2.
The world border
/worldborder counts in diameter, not radius. /worldborder set 2000 makes a square 2000 blocks across, centered on 0, 0 until you move it with /worldborder center. A time after the size makes the border move gradually, and since Java 1.21.11 that time is in ticks: /worldborder set 500 1200 takes one minute. Older guides give the time in seconds, which is 20 times too short now. Since 1.21.9 the command only changes the border of the dimension it runs in.
Outside the border players take 0.2 damage per second for every block past a buffer of 5 blocks, and the screen turns red within 5 blocks of the edge. The size can be anything from 1 to 59,999,968 blocks.
Keeping chunks loaded
/forceload takes block coordinates and loads the chunks they fall in, so /forceload add 0 0 31 47 keeps 2 by 3 chunks loaded. One command can add up to 256 chunks. The list is saved with the world, /forceload query shows it and /forceload remove all empties it.
Nobody has to be nearby for a forceloaded chunk to keep working. Blocks get random ticks, and since Java 1.21.5 crops grow there too. Mobs don't spawn in those chunks and lightning doesn't strike them.
Finding things with /locate
Since Java 1.19 /locate needs the kind of thing first: /locate structure, /locate biome or /locate poi. It answers with coordinates that have ~ as the height, and clicking them puts a teleport command in your chat box.
structure- Searches 201 by 201 times the spacing of that structure. Mansions are 80 chunks apart, so the search reaches 128,000 blocks in every direction. Strongholds have no limit, and structure tags work as well.
biome- Checks every 32 blocks sideways and every 64 up and down, inside a square 12,801 blocks wide. A very narrow biome can slip through.
poi- Points of interest, such as beds and job site blocks, within 256 blocks.
Spreading players out
/spreadplayers takes a center, the smallest distance allowed between targets and the largest distance from the center, then puts everyone on the highest block that isn't air. Lava, water, bubble columns and fire never count as a landing spot. under with a height, added in Java 1.16, keeps people below a roof, and respectTeams set to true sends each team to one shared spot. When there is no room for everyone at the minimum distance, nobody is moved.
All ten world commands need permission level 2, apart from /seed in single player.