Difference between revisions of "Commands"
m (Date correction) |
(Added some new commands, wasn't too sure about clone though) |
||
Line 57: | Line 57: | ||
|- | |- | ||
| colspan="4" style="text-align: center;"| | | colspan="4" style="text-align: center;"| | ||
+ | |||
+ | |----------------------------------------------------------------------------------------------------------- | ||
+ | | | ||
+ | ===clear=== | ||
+ | | 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>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>damage</code>: The amount of damage the item to be removed has undergone. | ||
+ | * <code>data_tags</code>: The tags the item to be removed has. | ||
+ | | | ||
+ | *<code>/clear</code> | ||
+ | :*Removes all items from the inventory. | ||
+ | *<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> | ||
+ | :* Removes all rainbow wool from the inventory | ||
+ | *<code>/clear wool 1 0 {type:"red"}</code> | ||
+ | :* Removes 1 red wool from the inventory | ||
+ | |||
+ | |----------------------------------------------------------------------------------------------------------- | ||
+ | | | ||
+ | ===clone=== | ||
+ | | 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>[~]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>[~]xDest [~]yDest</code>: The x and y coordinate to clone to. | ||
+ | * <code>[filtered|masked|replace]</code>: The filtering setting. | ||
+ | * <code>[force|move|normal]</code>: Whether the original blocks are kept. | ||
+ | * <code>block_mask</code>: The blocks to clone. | ||
+ | | | ||
+ | |||
+ | |----------------------------------------------------------------------------------------------------------- | ||
+ | | | ||
+ | ===cls=== | ||
+ | | Stands for "clear screen"- clears chat messages on screen. | ||
+ | | | ||
+ | <code>/cls</code> | ||
+ | | | ||
|----------------------------------------------------------------------------------------------------------- | |----------------------------------------------------------------------------------------------------------- | ||
Line 98: | Line 140: | ||
| 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]</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 108: | Line 150: | ||
** <code>hollow</code> will fill the inner edge and clear all blocks inside. | ** <code>hollow</code> will fill the inner edge and clear all blocks inside. | ||
** <code>destroy</code> replaces all blocks by mining them first. | ** <code>destroy</code> replaces all blocks by mining them first. | ||
+ | * <code>data_tags</code>: Specifies additional data to apply to the block. See [[data tags]] for more information. | ||
| | | | ||
* <code>/fill diamond_block ~-5 ~ 11 1 replace</code> | * <code>/fill diamond_block ~-5 ~ 11 1 replace</code> | ||
Line 119: | Line 162: | ||
| Switches between the game modes. | | Switches between the game modes. | ||
| | | | ||
− | <code>/gamemode <survival|creative></code> | + | <code>/gamemode <survival|creative|adventure></code> |
| | | | ||
*<code>/gamemode creative</code> | *<code>/gamemode creative</code> | ||
Line 127: | Line 170: | ||
*: Switches to survival mode. | *: Switches to survival mode. | ||
*: <code>/gamemode 0</code> and <code>/gamemode s</code> will also work. | *: <code>/gamemode 0</code> and <code>/gamemode s</code> will also work. | ||
+ | *<code>/gamemode adventure</code> | ||
+ | *: Switches to adventure mode. | ||
+ | *: <code>/gamemode 2</code> and <code>/gamemode a</code> will also work. | ||
|----------------------------------------------------------------------------------------------------------- | |----------------------------------------------------------------------------------------------------------- | ||
Line 143: | Line 189: | ||
* <code>/gamerule mobgriefing false</code> | * <code>/gamerule mobgriefing false</code> | ||
*: Disallows mobs from changing blocks in the world. | *: Disallows mobs from changing blocks in the world. | ||
+ | * <code>/gamerule domobloot false</code> | ||
+ | *: Stops mobs from dropping items upon death. | ||
+ | * <code>/gamerule sendcommandfeedback false</code> | ||
+ | *: Stops commands from returning feedback into chat if they are run successfully. | ||
|----------------------------------------------------------------------------------------------------------- | |----------------------------------------------------------------------------------------------------------- | ||
Line 205: | Line 255: | ||
*: Generates lightning 5 blocks to the left of the player. | *: Generates lightning 5 blocks to the left of the player. | ||
+ | |----------------------------------------------------------------------------------------------------------- | ||
+ | | | ||
+ | ===say=== | ||
+ | | Returns the specified message in chat | ||
+ | | | ||
+ | <code>/say message</code> | ||
+ | | | ||
+ | *<code>/say hello world</code> | ||
+ | :*Returns the message "hello world" in chat. | ||
+ | |||
+ | |----------------------------------------------------------------------------------------------------------- | ||
+ | | | ||
+ | ===setblock=== | ||
+ | | Replaces the existing block with the specified block. | ||
+ | | | ||
+ | <code>/setblock block_type [~]x [~]y [replace|keep|destroy] [data_tags]</code> | ||
+ | * <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>oldBlockHandling</code>: Different replacement algorithms: | ||
+ | ** <code>replace</code> replaces any existing block. | ||
+ | ** <code>keep</code> only replaces an air block. | ||
+ | ** <code>destroy</code> replaces block by mining it first. | ||
+ | * <code>data_tags</code>: Specifies additional data to apply to the block. See [[data tags]] for more information. | ||
+ | | | ||
+ | * <code>/setblock diamond_block ~ ~</code> | ||
+ | :* Replaces the block under the player with a diamond block. | ||
+ | * <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> | ||
+ | :* 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. | ||
|----------------------------------------------------------------------------------------------------------- | |----------------------------------------------------------------------------------------------------------- | ||
| | | | ||
Line 218: | Line 298: | ||
* <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=== | ||
+ | | Spawns in a mob. | ||
+ | | | ||
+ | <code>/summon mob_type [quantity] [[~]x [~]y] [data_tags]</code> | ||
+ | | | ||
+ | * <code>summon pig</code> | ||
+ | :* Summons 1 pig, at the players position | ||
+ | * <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> | ||
+ | :* 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. | ||
|----------------------------------------------------------------------------------------------------------- | |----------------------------------------------------------------------------------------------------------- | ||
Line 318: | Line 413: | ||
* 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 | + | * New game rules '''doMobLoot''' and '''sendCommandFeedback''' |
* Adventure game mode | * Adventure game mode | ||
+ | * Fill command now takes data tags | ||
|} | |} | ||
Revision as of 11:32, 5 October 2019
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>
, you can either write/gamemode survival
, or/gamemode creative
. - 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. |
|
|
seed |
This command is always available, even if cheats are disabled.
Shows the seed number of the current world. |
|
|
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. |
|
|
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 |
Stands for "clear screen"- clears chat messages on screen. |
|
|
difficulty |
Sets the difficulty mode of the world. |
|
|
enchant |
Applies and 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. |
| |
home |
Teleports to the player's spawn point. |
|
|
kill |
Instantly kills the player. |
|
|
lightning |
Generates lightning |
|
|
say |
Returns the specified message in chat |
|
|
setblock |
Replaces the existing block with the specified block. |
|
|
spawnskin |
Spawns in a NPC (Non-player control)into the game. You need to have a skin ID for the NPC, which can be found on skin stats in the gallery. |
|
|
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 |
|