Difference between revisions of "Commands"
m (Fixes change to gamemodes) |
|||
(23 intermediate revisions by 9 users not shown) | |||
Line 3: | Line 3: | ||
Commands (also known as Cheats) are scripted codes that the player can write in the game console that change the game directly. | Commands (also known as Cheats) are scripted codes that the player can write in the game console that change the game directly. | ||
− | ==Using Commands== | + | == Using Commands == |
− | + | To use commands, the world must have cheats enabled. Cheats can only be enabled on the world creation screen, and cannot be enabled after a world has already been created. | |
The default key binding for opening the command console is "T". This can be changed in the game settings. When the console is open, the player can write a command, and execute it by pressing Enter. | The default key binding for opening the command console is "T". This can be changed in the game settings. When the console is open, the player can write a command, and execute it by pressing Enter. | ||
− | + | When commands are entered, the capitalization of letters does not matter. | |
− | |||
− | |||
− | + | === Reading Command Definitions === | |
+ | Below is a list of command definitions (instructions on how each command works). The definitions include two different types of brackets: | ||
+ | # Parameters between <code><</code> and <code>></code> angle brackets is a list of potential options. Each option is separated by a <code>|</code> "pipe" character. If an option contains multiple parameters, as seen in the <code>fill</code> command, it will be surrounded by parentheses. As an example, in <code>/gamemode <survival|creative|adventure|spectator></code>, you can write <code>/gamemode survival</code>, <code>/gamemode creative</code>, <code>/gamemode adventure</code>, or <code>/gamemode spectator</code>. | ||
+ | # Parameters between the <code>[</code> and <code>]</code> square brackets are ''optional'' parameters. When writing a command, you can skip optional parameters. For example, in <code>/lightning [[~]x [~]y]</code>, you can omit both the <code>[~]x</code> and <code>[~]y</code> parameters, like so: <code>/lightning</code>. Also, the <code>[~]</code> means you can use relative coordinates. | ||
− | + | The <code>~</code> character can be added before certain coordinate numbers to make the coordinate relative to your position in the world, instead of relative to block (0, 0). For example, running <code>/explode 5 ~3 ~0</code> will perform a size 5 explosion, 3 blocks to the left of the player. | |
− | {| | + | == List of Commands == |
− | | | + | {| class="wikitable" style="width: 100%;" |
+ | |- | ||
!width="100"|Command | !width="100"|Command | ||
!width="250"|Description | !width="250"|Description | ||
!width="400"|Definition | !width="400"|Definition | ||
!Examples | !Examples | ||
− | | | + | |- |
− | + | ! | |
− | ===help=== | + | === help === |
− | | | + | | This command is always available, even if cheats are disabled. |
Lists all of the possible commands. | Lists all of the possible commands. | ||
− | | | + | | <code>/help</code> |
− | <code>/help</code> | + | | <code>/help</code> |
− | | | + | |- |
− | + | ! | |
− | | | + | === seed === |
− | + | | This command is always available, even if cheats are disabled. | |
− | ===seed=== | ||
− | | | ||
Shows the seed number of the current world. | Shows the seed number of the current world. | ||
− | | | + | | <code>/seed</code> |
− | <code>/seed</code> | + | | <code>/seed</code> |
− | | | ||
− | |||
|- | |- | ||
− | + | ! | |
− | + | === cheats === | |
− | + | | This command will only exist if the world was created prior to 1.26.5 (when cheats were added to the game). | |
− | |||
− | ===cheats=== | ||
− | | | ||
It allows players to permanently enable or disable cheats in their world. | It allows players to permanently enable or disable cheats in their world. | ||
| | | | ||
<code>/cheats <enable|disable></code> | <code>/cheats <enable|disable></code> | ||
− | | | + | | <code>/cheats enable</code><br> |
− | + | <code>/cheats disable</code> | |
|- | |- | ||
− | + | ! | |
− | + | === clear === | |
− | |||
− | |||
− | ===clear=== | ||
| Removes items from the inventory, but also returns a message if the specified item is present. | | Removes items from the inventory, but also returns a message if the specified item is present. | ||
| | | | ||
− | <code>/clear itemname [quantity|-1] [damage] [data_tags]</code> | + | <code>/clear itemname [<quantity|-1>] [damage] [data_tags]</code> |
* <code>itemname</code>: The [[identifiers|identifier]] for the item to remove. | * <code>itemname</code>: The [[identifiers|identifier]] for the item to remove. | ||
* <code>itemname</code>: The quantity of items to be removed. -1 means all present in the inventory | * <code>itemname</code>: The quantity of items to be removed. -1 means all present in the inventory | ||
Line 70: | Line 62: | ||
| | | | ||
*<code>/clear</code> | *<code>/clear</code> | ||
− | + | **Removes all items from the inventory. | |
*<code>/clear wool 0</code> | *<code>/clear wool 0</code> | ||
− | + | **Does not remove any items, but returns a message saying "Found a match" if the player has wool in their inventory. | |
*<code>/clear wool -1 0 {type:"rainbow"}</code> | *<code>/clear wool -1 0 {type:"rainbow"}</code> | ||
− | + | ** Removes all rainbow wool from the inventory | |
*<code>/clear wool 1 0 {type:"red"}</code> | *<code>/clear wool 1 0 {type:"red"}</code> | ||
− | + | ** Removes 1 red wool from the inventory | |
− | + | |- | |
− | | | + | ! |
− | + | === clone === | |
− | ===clone=== | ||
| Clones part of the world and pastes it somewhere else, with data tags for blocks. | | Clones part of the world and pastes it somewhere else, with data tags for blocks. | ||
| | | | ||
− | <code>/clone [~]x1 [~]y1 width height [~]xDest [~]yDest [filtered|masked|replace] [force|move|normal] block_mask</code> | + | <code>/clone [~]x1 [~]y1 width height [~]xDest [~]yDest [<filtered|masked|replace>] [<force|move|normal>] block_mask</code> |
* <code>[~]x1 [~]y1</code>: The x and y coordinate to start cloning from. | * <code>[~]x1 [~]y1</code>: The x and y coordinate to start cloning from. | ||
* <code>width height</code>: How many blocks rightward (width) and upward (height) to clone. | * <code>width height</code>: How many blocks rightward (width) and upward (height) to clone. | ||
Line 91: | Line 82: | ||
* <code>block_mask</code>: The blocks to clone. | * <code>block_mask</code>: The blocks to clone. | ||
| | | | ||
− | + | |- | |
− | | | + | ! |
− | + | === cls === | |
− | ===cls=== | ||
| "cls" stands for "clear screen". This command clears console messages from the screen. | | "cls" stands for "clear screen". This command clears console messages from the screen. | ||
− | | | + | | <code>/cls</code> |
− | <code>/cls</code> | + | | <code>/cls</code> |
− | | | + | |- |
− | + | ! | |
− | |- | + | === difficulty === |
− | |||
− | |||
− | ===difficulty=== | ||
| Sets the difficulty mode of the world. | | Sets the difficulty mode of the world. | ||
| | | | ||
Line 110: | Line 97: | ||
*<code>/difficulty normal</code> | *<code>/difficulty normal</code> | ||
*: Sets the game to normal difficulty | *: Sets the game to normal difficulty | ||
− | + | |- | |
− | | | + | ! |
+ | === enchant === | ||
+ | | Applies an enchantment to the player's held item. A message will appear saying that the enchantment has been "added to selected item". If the player is holding nothing, the message that the held item has been enchanted will still appear. | ||
| | | | ||
− | + | <code>/enchant enchantment_id</code> | |
− | + | * <code>enchantment_id</code>: See list of enchantment ID's here: [[Enchanting#Commands|Enchantments]] | |
− | |||
− | <code>enchant enchantment_id</code> | ||
− | * <code>enchantment_id</code>: See list of enchantment ID's here: [[ | ||
| | | | ||
* <code>/enchant Unbreaking4</code> | * <code>/enchant Unbreaking4</code> | ||
Line 123: | Line 109: | ||
* <code>/enchant LuckOfTheSeaII</code> | * <code>/enchant LuckOfTheSeaII</code> | ||
*: Enchants the held item with the Luck of the Sea 2 enchantment. | *: Enchants the held item with the Luck of the Sea 2 enchantment. | ||
− | + | |- | |
− | | | + | ! |
− | + | === explode === | |
− | ===explode=== | ||
| Creates an explosion. | | Creates an explosion. | ||
| | | | ||
Line 135: | Line 120: | ||
* <code>/explode 5 ~ ~-3</code> | * <code>/explode 5 ~ ~-3</code> | ||
*: Performs a size 5 explosion, 3 blocks below the player. | *: Performs a size 5 explosion, 3 blocks below the player. | ||
− | + | |- | |
− | | | + | ! |
− | + | === fill === | |
− | ===fill=== | + | | Fills a region of blocks with the specified block type. |
− | | Fills a region of blocks with the specified block type | ||
| | | | ||
− | <code>fill block_type [~]x [~]y width height [(replace [replace_block_type])|keep|outline|hollow|destroy] [data_tags]</code> | + | <code>/fill block_type [~]x [~]y width height [<(replace [replace_block_type])|keep|outline|hollow|destroy>] [data_tags]</code> |
* <code>block_type</code>: The [[identifiers|identifier]] for the block to fill. | * <code>block_type</code>: The [[identifiers|identifier]] for the block to fill. | ||
* <code>[~]x [~]y</code>: The x and y coordinate to start filling from. | * <code>[~]x [~]y</code>: The x and y coordinate to start filling from. | ||
Line 157: | Line 141: | ||
* <code>/fill air ~-10 ~-10 21 21 replace stone</code> | * <code>/fill air ~-10 ~-10 21 21 replace stone</code> | ||
*: Replaces stone around the player with air. | *: Replaces stone around the player with air. | ||
− | + | |- | |
− | |- | + | ! |
− | + | === gamemode === | |
− | |||
− | ===gamemode=== | ||
| Switches between the game modes. | | Switches between the game modes. | ||
| | | | ||
Line 178: | Line 160: | ||
*: Switches to spectator mode. | *: Switches to spectator mode. | ||
*: <code>/gamemode 3</code> and <code>/gamemode p</code> will also work. | *: <code>/gamemode 3</code> and <code>/gamemode p</code> will also work. | ||
− | + | |- | |
− | |- | + | ! |
− | + | === gamerule === | |
− | |||
− | ===gamerule=== | ||
| Sets global variables in the game world, such as the ability for players to keep their inventory when they die. | | Sets global variables in the game world, such as the ability for players to keep their inventory when they die. | ||
| | | | ||
− | <code>/gamerule < | + | <code>/gamerule rule <value></code> |
| | | | ||
* <code>/gamerule keepinventory true</code> | * <code>/gamerule keepinventory true</code> | ||
Line 199: | Line 179: | ||
* <code>/gamerule sendcommandfeedback false</code> | * <code>/gamerule sendcommandfeedback false</code> | ||
*: Stops commands from returning feedback into chat if they are run successfully. | *: Stops commands from returning feedback into chat if they are run successfully. | ||
− | + | |- | |
− | | | + | ! |
− | + | === give === | |
− | ===give=== | ||
| Gives the player any block or item. | | Gives the player any block or item. | ||
| | | | ||
− | <code>give item [amount] [damage] [data_tags]</code> | + | <code>/give item [amount] [damage] [data_tags]</code> |
* <code>item</code>: The [[identifiers|identifier]] for the item to give. | * <code>item</code>: The [[identifiers|identifier]] for the item to give. | ||
* <code>amount</code>: Specifies how many of the item to give. | * <code>amount</code>: Specifies how many of the item to give. | ||
Line 219: | Line 198: | ||
* <code>/give wooden_shovel 1 0 {enchantments:["unbreaking3"]}</code> | * <code>/give wooden_shovel 1 0 {enchantments:["unbreaking3"]}</code> | ||
*: Gives a wooden shovel with an unbreaking enchantment. | *: Gives a wooden shovel with an unbreaking enchantment. | ||
− | + | |- | |
− | | | + | ! |
− | + | === heal === | |
− | ===heal=== | ||
| Instantly heals the player. | | Instantly heals the player. | ||
− | | | + | | <code>/heal</code> |
− | <code>/heal</code> | + | | <code>/heal</code> |
− | + | |- | |
− | | | + | ! |
− | + | === home === | |
− | ===home=== | ||
| Teleports to the player's spawn point. | | Teleports to the player's spawn point. | ||
| | | | ||
Line 240: | Line 217: | ||
* <code>/home set 5 3</code> | * <code>/home set 5 3</code> | ||
*: Sets the player's spawn point to the block at x=5 and y=3. | *: Sets the player's spawn point to the block at x=5 and y=3. | ||
− | + | |- | |
− | | | + | ! |
− | + | === kill === | |
− | ===kill=== | ||
| Instantly kills the player. | | Instantly kills the player. | ||
− | | | + | | <code>/kill</code> |
− | <code>/kill</code> | + | | <code>/kill</code> |
− | | | + | |- |
− | + | ! | |
− | | | + | === lightning === |
− | + | | Generates lightning. | |
− | ===lightning=== | ||
− | | Generates lightning | ||
| | | | ||
<code>/lightning [[~]x [~]y]</code> | <code>/lightning [[~]x [~]y]</code> | ||
Line 260: | Line 234: | ||
* <code>/lightning ~-5 ~</code> | * <code>/lightning ~-5 ~</code> | ||
*: Generates lightning 5 blocks to the left of the player. | *: Generates lightning 5 blocks to the left of the player. | ||
− | + | |- | |
− | | | + | ! |
− | + | === say === | |
− | ===say=== | + | | Returns the specified message in chat. |
− | | Returns the specified message in chat | + | | <code>/say message</code> |
− | | | ||
− | <code>/say message</code> | ||
| | | | ||
*<code>/say hello world</code> | *<code>/say hello world</code> | ||
− | + | **Returns the message "hello world" in chat. | |
− | + | * <code>/say hello \n world</code> | |
− | | | + | *: Returns the message with a line break after \n. |
− | + | |- | |
− | ===setblock=== | + | ! |
+ | === setblock === | ||
| Replaces the existing block with the specified block. | | Replaces the existing block with the specified block. | ||
| | | | ||
− | <code>/setblock block_type [~]x [~]y [replace|keep|destroy] [data_tags]</code> | + | <code>/setblock block_type [~]x [~]y [<replace|keep|destroy>] [data_tags]</code> |
* <code>block_type</code>: The [[identifiers|identifier]] for the block. | * <code>block_type</code>: The [[identifiers|identifier]] for the block. | ||
* <code>[~]x [~]y</code>: The x and y coordinate where the block is put. | * <code>[~]x [~]y</code>: The x and y coordinate where the block is put. | ||
Line 286: | Line 259: | ||
| | | | ||
* <code>/setblock diamond_block ~ ~</code> | * <code>/setblock diamond_block ~ ~</code> | ||
− | + | ** Replaces the block under the player with a diamond block. | |
* <code>/setblock dirt ~2 ~2 keep</code> | * <code>/setblock dirt ~2 ~2 keep</code> | ||
− | + | ** Replaces the block two blocks to the right and two blocks above the player to dirt, so long as it is an air block. | |
* <code>/setblock anvil 10 10 destroy {damage:2}</code> | * <code>/setblock anvil 10 10 destroy {damage:2}</code> | ||
− | + | ** Creates an anvil that has been damaged at position x=10 and y=10 in the world, first destroying any block that might have been there. | |
− | | | + | |- |
− | + | ! | |
− | ===spawnskin=== | + | === spawnskin === |
| Spawns in an NPC (non-player character) into the game. You need to have a skin ID for the NPC, which can be found on skin information in the skin database. | | Spawns in an NPC (non-player character) into the game. You need to have a skin ID for the NPC, which can be found on skin information in the skin database. | ||
| | | | ||
Line 304: | Line 277: | ||
* <code>/spawnskin 58300 1 ~-5 ~3</code> | * <code>/spawnskin 58300 1 ~-5 ~3</code> | ||
*: Spawns 1 of them, 5 blocks to the left, and three blocks above the player. | *: Spawns 1 of them, 5 blocks to the left, and three blocks above the player. | ||
− | + | |- | |
− | + | ! | |
− | |- | + | === summon === |
− | |||
− | |||
− | ===summon=== | ||
| Spawns in a mob. | | Spawns in a mob. | ||
| | | | ||
Line 315: | Line 285: | ||
| | | | ||
* <code>summon pig</code> | * <code>summon pig</code> | ||
− | + | ** Summons 1 pig, at the players position | |
* <code>summon cow 5 ~1 ~-2</code> | * <code>summon cow 5 ~1 ~-2</code> | ||
− | + | ** Summons 5 cows one block to the right, and two blocks below the player | |
* <code>summon spawnskin 1 ~ ~ {skin:1327,name:"Notch",health:1,drops:[{item:{id:"mob_head",type:1327}}]}</code> | * <code>summon spawnskin 1 ~ ~ {skin:1327,name:"Notch",health:1,drops:[{item:{id:"mob_head",type:1327}}]}</code> | ||
− | + | ** Summons one notch spawnskin at the players position with the name "Notch", which has half a heart of health and drops its head upon death. | |
− | + | * | |
− | | | + | * <code>summon spawnskin 1 ~ ~ {skin:6273, aggro:"hostile"}</code> |
− | + | ** Summons a spawnskin that will instantly start attacking the player; other possible data tags are neutral and passive. | |
− | ===time=== | + | |- |
+ | ! | ||
+ | === time === | ||
| Sets/shows the current time of the day, which is a value between 1 and 100. | | Sets/shows the current time of the day, which is a value between 1 and 100. | ||
| | | | ||
− | <code>/time <get|set | + | <code>/time <get|set <t|day|night>></code> |
| | | | ||
* <code>/time get</code> | * <code>/time get</code> | ||
Line 334: | Line 306: | ||
* <code>/time set day</code> | * <code>/time set day</code> | ||
*: Sets time to 0. | *: Sets time to 0. | ||
− | + | |- | |
− | + | ! | |
− | | | + | === tp === |
− | |||
− | ===tp=== | ||
| Teleports (TPs) the player to a specific location. | | Teleports (TPs) the player to a specific location. | ||
| | | | ||
Line 347: | Line 317: | ||
* <code>/tp 5 3</code> | * <code>/tp 5 3</code> | ||
*: Teleports the player to the block at x=5 and y=3. | *: Teleports the player to the block at x=5 and y=3. | ||
− | + | |- | |
− | |- | + | ! |
− | + | === weather === | |
− | |||
− | ===weather=== | ||
| Sets/shows whether it is raining in the world, or not. | | Sets/shows whether it is raining in the world, or not. | ||
| | | | ||
Line 360: | Line 328: | ||
* <code>/weather set rain</code> | * <code>/weather set rain</code> | ||
*: Makes it start raining. | *: Makes it start raining. | ||
− | + | |- | |
− | | | + | ! |
− | + | === xp === | |
− | ===xp=== | ||
| Sets the experience points of the player. | | Sets the experience points of the player. | ||
| | | | ||
Line 374: | Line 341: | ||
* <code>/xp add 10L</code> | * <code>/xp add 10L</code> | ||
*: Adds 10 levels to the player's experience. | *: Adds 10 levels to the player's experience. | ||
− | |||
|} | |} | ||
− | ==History== | + | == History == |
− | {|class="wikitable" | + | {| class="wikitable" |
− | !Version | + | ! width=60px | Version |
− | !Date | + | ! width=100px | Date |
− | !Changes | + | ! Changes |
|- | |- | ||
− | ![[Version History#1.26.5|1.26.5]] | + | ! [[Version History#1.26.5|1.26.5]] |
− | + | | Jul 03, 2014 | |
| | | | ||
* Commands were first introduced | * Commands were first introduced | ||
− | + | ** Added commands: '''cheats, explode, fill, gamemode, gamerule, give, help, home, kill, seed, time, weather, xp''' | |
|- | |- | ||
− | ![[Version History#1.27|1.27]] | + | ! [[Version History#1.27|1.27]] |
− | + | | Nov 13, 2015 | |
| | | | ||
* Default keybinding to open commands changed from "/" to "T" | * Default keybinding to open commands changed from "/" to "T" | ||
Line 398: | Line 364: | ||
* Added oldBlockHandling to fill | * Added oldBlockHandling to fill | ||
|- | |- | ||
− | ![[Version History#1.28|1.28]] | + | ! [[Version History#1.28|1.28]] |
− | + | | Oct 08, 2016 | |
| | | | ||
* Added commands: '''difficulty, enchant, lightning''' | * Added commands: '''difficulty, enchant, lightning''' | ||
Line 405: | Line 371: | ||
* Added durability and data_tags to give | * Added durability and data_tags to give | ||
|- | |- | ||
− | ![[Version History#1.29|1.29]] | + | ! [[Version History#1.29|1.29]] |
− | + | | Sep 27, 2019 | |
| | | | ||
* Removed quick command buttons from creative inventory | * Removed quick command buttons from creative inventory | ||
Line 415: | Line 381: | ||
* Giving a potion with commands with a space in the name works properly | * Giving a potion with commands with a space in the name works properly | ||
* Fixed various small command parsing issues | * Fixed various small command parsing issues | ||
− | |||
* Converted fill command to use width and height instead of X2 and Y2 coordinates | * Converted fill command to use width and height instead of X2 and Y2 coordinates | ||
* Wool, wool backdrops, dye, carpet and potions now have default types when given with commands | * Wool, wool backdrops, dye, carpet and potions now have default types when given with commands | ||
* Moved command output higher to no longer overlap command window and item text | * Moved command output higher to no longer overlap command window and item text | ||
* mobGriefing for creepers properly matches gamerule by default | * mobGriefing for creepers properly matches gamerule by default | ||
− | * New game rules | + | * New game rules doMobLoot and sendCommandFeedback |
* Adventure game mode | * Adventure game mode | ||
* Fill command now takes data tags | * Fill command now takes data tags | ||
+ | |- | ||
+ | ! [[Version History#1.29.1|1.29.1]] | ||
+ | | Oct 5, 2019 | ||
+ | | | ||
+ | * Fill command fill info displays width and height instead of secondary coordinates | ||
+ | * Replaced "spawn" with "summon" in the help command list | ||
+ | * Added "say" to the help command list | ||
+ | * Increased maximum command length from 256 to 1024 characters | ||
+ | * Summon command quantity is now limited to 20 mobs | ||
+ | |- | ||
+ | ! [[Version History#1.29.2|1.29.2]] | ||
+ | | Oct 20, 2019 | ||
+ | | | ||
+ | * Entering a lightning command without parameters no longer randomizes the position | ||
+ | |- | ||
+ | ! [[Version History#1.30|1.30]] | ||
+ | | Nov 13, 2020 | ||
+ | | | ||
+ | * Spectator game mode | ||
+ | * Fill command can fill a maximum of 10000 blocks instead of 9999 | ||
+ | |- | ||
+ | ! [[Version History#1.30.3b|1.30.3b]] | ||
+ | | Nov 21, 2021 | ||
+ | | | ||
+ | * Command history now goes back 100 commands instead of only 10 | ||
+ | * Home and tp commands now reset player velocity | ||
+ | |- | ||
+ | ! [[Version History#1.30.3b_1|1.30.3b_1]] | ||
+ | | Dec 5, 2021 | ||
+ | | | ||
+ | * Give command quantity is now limited to 10000 | ||
+ | * Maximum horizontal tp coordinate is now 10000 instead of 1100 | ||
+ | * (Desktop) Gamerule command now accepts the value "true" | ||
+ | |- | ||
+ | ! [[Version History#1.31.2|1.31.2]] | ||
+ | | Nov 9, 2024 | ||
+ | | | ||
+ | * Added the whisper command to the Scavenger Hunt Minigame | ||
|} | |} | ||
== See Also == | == See Also == | ||
− | *[[Identifiers]] | + | * [[Identifiers]] |
− | *[[Data tags]] | + | * [[Data tags]] |
− | *[[Enchantment_table#Commands|Enchantment IDs]] | + | * [[Enchantment_table#Commands|Enchantment IDs]] |
− | *[[Command book]] | + | * [[Command book]] |
[[Category:Gameplay]] | [[Category:Gameplay]] |
Latest revision as of 17:09, 16 November 2024
Commands (also known as Cheats) are scripted codes that the player can write in the game console that change the game directly.
Using Commands
To use commands, the world must have cheats enabled. Cheats can only be enabled on the world creation screen, and cannot be enabled after a world has already been created.
The default key binding for opening the command console is "T". This can be changed in the game settings. When the console is open, the player can write a command, and execute it by pressing Enter.
When commands are entered, the capitalization of letters does not matter.
Reading Command Definitions
Below is a list of command definitions (instructions on how each command works). The definitions include two different types of brackets:
- Parameters between
<
and>
angle brackets is a list of potential options. Each option is separated by a|
"pipe" character. If an option contains multiple parameters, as seen in thefill
command, it will be surrounded by parentheses. As an example, in/gamemode <survival|creative|adventure|spectator>
, you can write/gamemode survival
,/gamemode creative
,/gamemode adventure
, or/gamemode spectator
. - Parameters between the
[
and]
square brackets are optional parameters. When writing a command, you can skip optional parameters. For example, in/lightning [[~]x [~]y]
, you can omit both the[~]x
and[~]y
parameters, like so:/lightning
. Also, the[~]
means you can use relative coordinates.
The ~
character can be added before certain coordinate numbers to make the coordinate relative to your position in the world, instead of relative to block (0, 0). For example, running /explode 5 ~3 ~0
will perform a size 5 explosion, 3 blocks to the left of the player.
List of Commands
Command | Description | Definition | Examples |
---|---|---|---|
help |
This command is always available, even if cheats are disabled.
Lists all of the possible commands. |
/help
|
/help
|
seed |
This command is always available, even if cheats are disabled.
Shows the seed number of the current world. |
/seed
|
/seed
|
cheats |
This command will only exist if the world was created prior to 1.26.5 (when cheats were added to the game).
It allows players to permanently enable or disable cheats in their world. |
|
/cheats enable
|
clear |
Removes items from the inventory, but also returns a message if the specified item is present. |
|
|
clone |
Clones part of the world and pastes it somewhere else, with data tags for blocks. |
|
|
cls |
"cls" stands for "clear screen". This command clears console messages from the screen. | /cls
|
/cls
|
difficulty |
Sets the difficulty mode of the world. |
|
|
enchant |
Applies an enchantment to the player's held item. A message will appear saying that the enchantment has been "added to selected item". If the player is holding nothing, the message that the held item has been enchanted will still appear. |
|
|
explode |
Creates an explosion. |
|
|
fill |
Fills a region of blocks with the specified block type. |
|
|
gamemode |
Switches between the game modes. |
|
|
gamerule |
Sets global variables in the game world, such as the ability for players to keep their inventory when they die. |
|
|
give |
Gives the player any block or item. |
|
|
heal |
Instantly heals the player. | /heal
|
/heal
|
home |
Teleports to the player's spawn point. |
|
|
kill |
Instantly kills the player. | /kill
|
/kill
|
lightning |
Generates lightning. |
|
|
say |
Returns the specified message in chat. | /say message
|
|
setblock |
Replaces the existing block with the specified block. |
|
|
spawnskin |
Spawns in an NPC (non-player character) into the game. You need to have a skin ID for the NPC, which can be found on skin information in the skin database. |
|
|
summon |
Spawns in a mob. |
|
|
time |
Sets/shows the current time of the day, which is a value between 1 and 100. |
|
|
tp |
Teleports (TPs) the player to a specific location. |
|
|
weather |
Sets/shows whether it is raining in the world, or not. |
|
|
xp |
Sets the experience points of the player. |
|
|
History
Version | Date | Changes |
---|---|---|
1.26.5 | Jul 03, 2014 |
|
1.27 | Nov 13, 2015 |
|
1.28 | Oct 08, 2016 |
|
1.29 | Sep 27, 2019 |
|
1.29.1 | Oct 5, 2019 |
|
1.29.2 | Oct 20, 2019 |
|
1.30 | Nov 13, 2020 |
|
1.30.3b | Nov 21, 2021 |
|
1.30.3b_1 | Dec 5, 2021 |
|
1.31.2 | Nov 9, 2024 |
|