Commands - Mine Blocks Wiki (2022)

Commands (also known as Cheats) are scripted codes that the player can write in the game console that change the game directly.

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.

Note that [~] is an optional modifier that can be added to coordinates, which makes it relative the player's location.



This command is always available, even if cheats are disabled.

Lists all of the possible commands.



This command is always available, even if cheats are disabled.

Shows the seed number of the current world.



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|disable>

/cheats enable

/cheats disable


Removes items from the inventory, but also returns a message if the specified item is present.

/clear itemname [quantity|-1] [damage] [data_tags]

  • itemname: The identifier for the item to remove.
  • itemname: The quantity of items to be removed. -1 means all present in the inventory
  • damage: The amount of damage the item to be removed has undergone.
  • data_tags: The tags the item to be removed has.
  • /clear
    • Removes all items from the inventory.
  • /clear wool 0
    • Does not remove any items, but returns a message saying "Found a match" if the player has wool in their inventory.
  • /clear wool -1 0 {type:"rainbow"}
    • Removes all rainbow wool from the inventory
  • /clear wool 1 0 {type:"red"}
    • Removes 1 red wool from the inventory


Clones part of the world and pastes it somewhere else, with data tags for blocks.

/clone [~]x1 [~]y1 width height [~]xDest [~]yDest [filtered|masked|replace] [force|move|normal] block_mask

  • [~]x1 [~]y1: The x and y coordinate to start cloning from.
  • width height: How many blocks rightward (width) and upward (height) to clone.
  • [~]xDest [~]yDest: The x and y coordinate to clone to.
  • [filtered|masked|replace]: The filtering setting.
  • [force|move|normal]: Whether the original blocks are kept.
  • block_mask: The blocks to clone.


"cls" stands for "clear screen". This command clears console messages from the screen./cls/cls


Sets the difficulty mode of the world.

/difficulty <peaceful|easy|normal|hard>

  • /difficulty normal
    Sets the game to normal difficulty


Applies an enchantment to the player's equipped item.

enchant enchantment_id

  • enchantment_id: See list of enchantment ID's here: Enchantments
  • /enchant Unbreaking4
    Enchants the held item with the Unbreaking 4 enchantment.
  • /enchant LuckOfTheSeaII
    Enchants the held item with the Luck of the Sea 2 enchantment.


Creates an explosion.

/explode size [[~]x [~]y]

  • /explode 10
    Performs a size 10 explosion at the player's location.
  • /explode 5 ~ ~-3
    Performs a size 5 explosion, 3 blocks below the player.


Fills a region of blocks with the specified block type

fill block_type [~]x [~]y width height [(replace [replace_block_type])|keep|outline|hollow|destroy] [data_tags]

  • block_type: The identifier for the block to fill.
  • [~]x [~]y: The x and y coordinate to start filling from.
  • width height: How many blocks rightward (width) and upward (height) to fill.
  • oldBlockHandling: Different replacement algorithms:
    • replace replace_block_type will only fill blocks that match the replace_block_type.
    • keep will only replace air blocks.
    • outline will fill blocks on only the inner edge of the rectangle.
    • hollow will fill the inner edge and clear all blocks inside.
    • destroy replaces all blocks by mining them first.
  • data_tags: Specifies additional data to apply to the block. See data tags for more information.
  • /fill diamond_block ~-5 ~ 11 1 replace
    Replaces the area under the player with diamond blocks.
  • /fill air ~-10 ~-10 21 21 replace stone
    Replaces stone around the player with air.


Switches between the game modes.

/gamemode <survival|creative|adventure|spectator>

  • /gamemode creative
    Switches to creative mode
    /gamemode 1 and /gamemode c will also work.
  • /gamemode survival
    Switches to survival mode.
    /gamemode 0 and /gamemode s will also work.
  • /gamemode adventure
    Switches to adventure mode.
    /gamemode 2 and /gamemode a will also work.
  • /gamemode spectator
    Switches to spectator mode.
    /gamemode 3 and /gamemode p will also work.


Sets global variables in the game world, such as the ability for players to keep their inventory when they die.

/gamerule <rule> value

  • /gamerule keepinventory true
    Allows the player to keep their inventory upon death.
  • /gamerule dodaylightcycle false
    Stops the day/night cycle from continuing.
  • /gamerule dofiretick false
    Stops fire from spreading between blocks.
  • /gamerule mobgriefing false
    Disallows mobs from changing blocks in the world.
  • /gamerule domobloot false
    Stops mobs from dropping items upon death.
  • /gamerule sendcommandfeedback false
    Stops commands from returning feedback into chat if they are run successfully.


Gives the player any block or item.

give item [amount] [damage] [data_tags]

  • item: The identifier for the item to give.
  • amount: Specifies how many of the item to give.
  • damage: How much damage the tool will have (default is 0). Positive numbers are damage, and negative numbers are durability.
  • data_tags: Specifies additional data to apply to the item. See data tags for more information.
  • /give diamond 12
    Gives the player twelve diamonds.
  • /give diamond_sword 1 50 {name:"Jimbo"}
    Gives a diamond sword named "Jimbo" that has been damaged 50 times.
  • /give command_book 1 0 {command:"give carrot 1 0 {name:'Perry'}"}
    Gives a command book that gives the player a carrot named "Perry".
  • /give wooden_shovel 1 0 {enchantments:["unbreaking3"]}
    Gives a wooden shovel with an unbreaking enchantment.


Instantly heals the player./heal/heal


Teleports to the player's spawn point.

/home [set [~]x [~]y]

  • /home
    Goes to the player's home location.
  • /home set ~5 ~3
    Sets the player's spawn point 5 blocks to the right, and 3 blocks up.
  • /home set 5 3
    Sets the player's spawn point to the block at x=5 and y=3.


Instantly kills the player./kill/kill


Generates lightning

/lightning [[~]x [~]y]

  • /lightning
    Generates lightning at the player's location.
  • /lightning ~-5 ~
    Generates lightning 5 blocks to the left of the player.


Returns the specified message in chat/say message
  • /say hello world
    • Returns the message "hello world" in chat.


Replaces the existing block with the specified block.

/setblock block_type [~]x [~]y [replace|keep|destroy] [data_tags]

  • block_type: The identifier for the block.
  • [~]x [~]y: The x and y coordinate where the block is put.
  • oldBlockHandling: Different replacement algorithms:
    • replace replaces any existing block.
    • keep only replaces an air block.
    • destroy replaces block by mining it first.
  • data_tags: Specifies additional data to apply to the block. See data tags for more information.
  • /setblock diamond_block ~ ~
    • Replaces the block under the player with a diamond block.
  • /setblock dirt ~2 ~2 keep
    • Replaces the block two blocks to the right and two blocks above the player to dirt, so long as it is an air block.
  • /setblock anvil 10 10 destroy {damage:2}
    • 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.


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.

/spawnskin skin_id_number [amount] [[~]x [~]y]

  • /spawnskin 58300
    Spawns 1 of Zanzlanz's Squid skin.
  • /spawnskin 58300 5
    Spawns 5 of them.
  • /spawnskin 58300 1 ~-5 ~3
    Spawns 1 of them, 5 blocks to the left, and three blocks above the player.


Spawns in a mob.

/summon mob_type [quantity] [[~]x [~]y] [data_tags]

  • summon pig
    • Summons 1 pig, at the players position
  • summon cow 5 ~1 ~-2
    • Summons 5 cows one block to the right, and two blocks below the player
  • summon spawnskin 1 ~ ~ {skin:1327,name:"Notch",health:1,drops:[{item:{id:"mob_head",type:1327}}]}
    • 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.
  • summon spawnskin 1 ~ ~ {skin:6273, aggro:"hostile"}
    • Summons a spawnskin that will instantly start attacking the player; other possible data tags are neutral and passive.


Sets/shows the current time of the day, which is a value between 1 and 100.

/time <get|set [t|day|night]>

  • /time get
    Displays the time of the day in the console.
  • /time set 10
    Sets time to 10, which is morning time.
  • /time set day
    Sets time to 0.


Teleports (TPs) the player to a specific location.

/tp [~]x [~]y

  • /tp ~5 ~3
    Teleports the player 5 blocks to the right, and 3 blocks up.
  • /tp 5 3
    Teleports the player to the block at x=5 and y=3.


Sets/shows whether it is raining in the world, or not.

/weather <get|set <clear|rain|thunder>>

  • /weather get
    Displays the current weather in the console.
  • /weather set rain
    Makes it start raining.


Sets the experience points of the player.

/xp [add] value[L]

  • /xp 100
    Sets the player's experience to 100 points (1 level).
  • /xp 1L
    Sets the player's experience to 1 level (100 points).
  • /xp add 10L
    Adds 10 levels to the player's experience.
VersionDateChanges1.26.5Jul 03, 2014
  • Commands were first introduced
    • Added commands: cheats, explode, fill, gamemode, gamerule, give, help, home, kill, seed, time, weather, xp
1.27Nov 13, 2015
  • Default keybinding to open commands changed from "/" to "T"
  • Added commands: heal, spawnskin, tp
  • Added a doFireTick game rule
  • Added "L" modifier to xp
  • Added oldBlockHandling to fill
1.28Oct 08, 2016
  • Added commands: difficulty, enchant, lightning
  • Added a passiveMobs game rule
  • Added durability and data_tags to give
1.29Sep 27, 2019
  • Removed quick command buttons from creative inventory
  • Added commands: clone, summon, setBlock, say, cls, clear
  • Command history is retained when switching worlds
  • "Hallow" and "replace" methods of the fill command behave properly
  • The area where the command console could not be clicked on decided to vanish
  • Giving a potion with commands with a space in the name works properly
  • Fixed various small command parsing issues
  • 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
  • Moved command output higher to no longer overlap command window and item text
  • mobGriefing for creepers properly matches gamerule by default
  • New game rules doMobLoot and sendCommandFeedback
  • Adventure game mode
  • Fill command now takes data tags
1.29.1Oct 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
1.29.2Oct 20, 2019
  • Entering a lightning command without parameters no longer randomizes the position
1.30Nov 13, 2020
  • Spectator game mode
  • Fill command can fill a maximum of 10000 blocks instead of 9999
1.30.3bNov 21, 2021
  • Command history now goes back 100 commands instead of only 10
  • Home and tp commands now reset player velocity
1.30.3b_1Dec 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"

Top Articles

Latest Posts

Article information

Author: Edmund Hettinger DC

Last Updated: 11/10/2022

Views: 5971

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.