Enabling Command Permissions
- Enable Allow Cheats when creating a single-player world.
- If you forget to enable Allow Cheats, you can still open the game menu by pressing ESC and selecting Open to LAN.
- Enable Allow Cheats and then click Start LAN World.
- Press / on the keyboard in-game to open the chat.
- Type part of the command, use the arrow keys to select the complete command, and press Tab to finish typing. For example, for the gamerule command, you can just type game and use the arrow keys and Tab to quickly select it.
- You can do the same for subsequent parameters to reduce typing errors and speed up the process.
- Of course, you can also quickly double-click and copy any commands from this article to paste them into the game.
Selecting Players or Entities
Command | Description |
---|
@p | Nearest player; if entered by a player, it targets themselves |
@r | Random player |
@a | All players |
@e | All entities, including animals, neutral, and hostile mobs |
@s | The player or entity executing the command; if entered by a player, it targets themselves |
Game Modes
Command | Description |
---|
/gamemode creative | Creative |
/gamemode survival | Survival |
/gamemode spectator | Spectator |
/gamemode adventure | Adventure |
Game Difficulty
Command | Description |
---|
/difficulty peaceful | Peaceful, no hostile mobs, hunger does not decrease |
/difficulty easy | Easy, players take 0.5x damage |
/difficulty normal | Normal, players take 1x damage |
/difficulty hard | Hard, players take 1.5x damage, zombies can break doors |
Game Time
Command | Description |
---|
/time set day | Morning |
/time set noon | Noon |
/time set night | Night |
/time set midnight | Midnight |
Game Weather
Command | Description |
---|
/weather clear | Clear |
/weather rain | Rain |
/weather thunder | Thunderstorm |
Game Rules
Keep Inventory on Death
Set whether players keep their inventory when they die.
Command | Description |
---|
/gamerule keepInventory true | Enable |
/gamerule keepInventory false | Disable |
Mob Griefing
Set whether mobs like creepers or withers can destroy blocks or terrain.
Command | Description |
---|
/gamerule mobGriefing true | Enable |
/gamerule mobGriefing false | Disable |
Fire Spread
Set whether fire spreads to adjacent blocks.
Command | Description |
---|
/gamerule doFireTick true | Enable |
/gamerule doFireTick false | Disable |
Spawn Radius
Set the radius for players’ respawn coordinates.
Command | Description |
---|
/gamerule spawnRadius 1 | Fixed respawn point |
/gamerule spawnRadius 50 | Random respawn within a 50-block radius |
Skip Night
Set conditions for skipping the night when players sleep.
Command | Description |
---|
/gamerule playersSleepingPercentage 0 | Skip night when one player sleeps |
/gamerule playersSleepingPercentage 101 | Disable night skipping |
Phantom Spawning
Set whether phantoms spawn when players haven’t slept for three days.
Command | Description |
---|
/gamerule doInsomnia true | Enable |
/gamerule doInsomnia false | Disable |
Daylight Cycle
Set whether the game has a day-night cycle. This setting does not affect game time, which continues to flow and is influenced by time settings.
Command | Description |
---|
/gamerule doDaylightCycle true | Enable |
/gamerule doDaylightCycle false | Disable |
Player Experience
Set player experience points. Use selectors to target a player or enter a player name directly.
Command | Description |
---|
/xp add @p 999 levels | Add 999 levels to the nearest player |
/xp add @p 999 points | Add 999 experience points to the nearest player |
/xp query @p levels | Query the nearest player’s level |
/xp query @p points | Query the nearest player’s experience points |
/xp set @p 999 levels | Set the nearest player to level 999 |
/xp set @p 1 points | Set the nearest player’s experience to 1 point |
Locating Structures
Locate the nearest structure (building) or biome. After inputting the command, you can click the green coordinates, and the system will automatically fill in the tp command. Note: In survival mode, you might suffocate if stuck in terrain.
Command | Description |
---|
/locate structure minecraft:ancient_city | Ancient City |
/locate structure minecraft:mansion | Woodland Mansion |
Giving Items
Give items to players. Use selectors to target a player, and NBT tags to set properties.
Command | Description |
---|
/give @p minecraft:wooden_axe | Wooden Axe |
/give @p minecraft:iron_ingot | Iron Ingot |
/give @p minecraft:gold_ingot | Gold Ingot |
/give @p minecraft:diamond | Diamond |
/give @p minecraft:netherite_ingot | Netherite Ingot |
Applying Potions
Apply potion effects to players or entities. Use selectors to target a player.
Effect strength can be set from 0 to 255.
Clearing Effects
Command | Description |
---|
/effect clear @p | Remove all effects |
Regeneration Effect
Command | Description |
---|
/effect give @p minecraft:regeneration 60 | 60 seconds duration |
/effect give @p minecraft:regeneration 60 255 | 60 seconds duration, strength 255 |
/effect give @p minecraft:regeneration 60 255 true | 60 seconds duration, strength 255, hidden particles |
/effect give @p minecraft:regeneration infinite 255 true | Infinite duration, strength 255, hidden particles |
Night Vision Effect
Command | Description |
---|
/effect give @p minecraft:night_vision 60 | 60 seconds duration |
/effect give @p minecraft:night_vision 60 255 | 60 seconds duration, strength 255 |
/effect give @p minecraft:night_vision 60 255 true | 60 seconds duration, strength 255, hidden particles |
/effect give @p minecraft:night_vision infinite 255 true | Infinite duration, strength 255, hidden particles |
Other Commands
Command | Description |
---|
/kill | Kill yourself |
/kill @p | Kill specific player |
/clear | Remove all your items, weapons and armors in inventory, it’s available with creative mode. |