Difference between revisions of "Commands"
(The page's code is way cleaner this way, and will support dark theme properly when it's added to the wiki.) |
(Reverted removal of header links, again) |
||
Line 1: | Line 1: | ||
− | + | __NOTOC__ | |
+ | |||
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. | ||
Line 21: | Line 22: | ||
!Examples | !Examples | ||
|- | |- | ||
− | ! help | + | ! |
+ | === help === | ||
| This command is always available, even if cheats are disabled. | | This command is always available, even if cheats are disabled. | ||
Line 28: | Line 30: | ||
| <code>/help</code> | | <code>/help</code> | ||
|- | |- | ||
− | ! seed | + | ! |
+ | === seed === | ||
| This command is always available, even if cheats are disabled. | | This command is always available, even if cheats are disabled. | ||
Line 35: | Line 38: | ||
| <code>/seed</code> | | <code>/seed</code> | ||
|- | |- | ||
− | ! cheats | + | ! |
+ | === cheats === | ||
| This command will only exist if the world was created prior to 1.26.5 (when cheats were added to the game). | | This command will only exist if the world was created prior to 1.26.5 (when cheats were added to the game). | ||
Line 44: | Line 48: | ||
<code>/cheats disable</code> | <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. | ||
| | | | ||
Line 62: | Line 67: | ||
** Removes 1 red wool from the inventory | ** 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. | ||
| | | | ||
Line 74: | Line 80: | ||
| | | | ||
|- | |- | ||
− | ! 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> | | <code>/cls</code> | ||
|- | |- | ||
− | ! difficulty | + | ! |
+ | === difficulty === | ||
| Sets the difficulty mode of the world. | | Sets the difficulty mode of the world. | ||
| | | | ||
Line 87: | Line 95: | ||
*: Sets the game to normal difficulty | *: Sets the game to normal difficulty | ||
|- | |- | ||
− | ! enchant | + | ! |
+ | === enchant === | ||
| Applies an enchantment to the player's equipped item. | | Applies an enchantment to the player's equipped item. | ||
| | | | ||
Line 98: | Line 107: | ||
*: 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 108: | Line 118: | ||
*: 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 | ||
| | | | ||
Line 128: | Line 139: | ||
*: 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 146: | Line 158: | ||
*: <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. | ||
| | | | ||
Line 164: | Line 177: | ||
*: 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. | ||
| | | | ||
Line 182: | Line 196: | ||
*: 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> | | <code>/heal</code> | ||
|- | |- | ||
− | ! home | + | ! |
+ | === home === | ||
| Teleports to the player's spawn point. | | Teleports to the player's spawn point. | ||
| | | | ||
Line 199: | Line 215: | ||
*: 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> | | <code>/kill</code> | ||
|- | |- | ||
− | ! lightning | + | ! |
+ | === lightning === | ||
| Generates lightning | | Generates lightning | ||
| | | | ||
Line 214: | Line 232: | ||
*: 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> | ||
Line 221: | Line 240: | ||
**Returns the message "hello world" in chat. | **Returns the message "hello world" in chat. | ||
|- | |- | ||
− | ! setblock | + | ! |
+ | === setblock === | ||
| Replaces the existing block with the specified block. | | Replaces the existing block with the specified block. | ||
| | | | ||
Line 240: | Line 260: | ||
** 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. | ** 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 252: | Line 273: | ||
*: 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 267: | Line 289: | ||
** Summons a spawnskin that will instantly start attacking the player; other possible data tags are neutral and passive. | ** 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. | ||
| | | | ||
Line 279: | Line 302: | ||
*: 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 289: | Line 313: | ||
*: 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 299: | Line 324: | ||
*: 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 313: | Line 339: | ||
== History == | == History == | ||
− | {| class="wikitable | + | {| class="wikitable" |
− | ! width= | + | ! width=60px | Version |
− | ! width= | + | ! width=100px | Date |
! Changes | ! Changes | ||
|- | |- | ||
Line 322: | Line 348: | ||
| | | | ||
* Commands were first introduced | * Commands were first introduced | ||
− | ** Added commands: cheats, explode, fill, gamemode, gamerule, give, help, home, kill, seed, time, weather, xp | + | ** 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]] | ||
Line 328: | Line 354: | ||
| | | | ||
* Default keybinding to open commands changed from "/" to "T" | * Default keybinding to open commands changed from "/" to "T" | ||
− | * Added commands: heal, spawnskin, tp | + | * Added commands: '''heal, spawnskin, tp''' |
* Added a doFireTick game rule | * Added a doFireTick game rule | ||
* Added "L" modifier to xp | * Added "L" modifier to xp | ||
Line 336: | Line 362: | ||
| Oct 08, 2016 | | Oct 08, 2016 | ||
| | | | ||
− | * Added commands: difficulty, enchant, lightning | + | * Added commands: '''difficulty, enchant, lightning''' |
* Added a passiveMobs game rule | * Added a passiveMobs game rule | ||
* Added durability and data_tags to give | * Added durability and data_tags to give | ||
Line 344: | Line 370: | ||
| | | | ||
* Removed quick command buttons from creative inventory | * Removed quick command buttons from creative inventory | ||
− | * Added commands: clone, summon, setBlock, say, cls, clear | + | * Added commands: '''clone, summon, setBlock, say, cls, clear''' |
* Command history is retained when switching worlds | * Command history is retained when switching worlds | ||
* "Hallow" and "replace" methods of the fill command behave properly | * "Hallow" and "replace" methods of the fill command behave properly | ||
Line 350: | Line 376: | ||
* 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 |
Revision as of 01:19, 7 December 2021
Commands (also known as Cheats) are scripted codes that the player can write in the game console that change the game directly.
Using Commands
In order to use commands, the world must have cheats enabled. This option 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 command definition includes two different types of brackets. It's important to know the difference between them.
- Parameters between the
<
and>
brackets is a list of options, separated by|
characters. For example, in/gamemode <survival|creative|adventure>
, you can write/gamemode survival
,/gamemode creative
, or/gamemode adventure
. - Parameters between the
[
and]
brackets is an optional parameter. When writing a command, you can omit the parameters. For example, in/lightning [[~]x [~]y]
, you can simply omit the X and Y parameters like so:/lightning
.
Note that [~]
is an optional modifier that can be added to coordinates, which makes it relative the player's location.
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 equipped item. |
|
|
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 |
|