Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 1 — Your First Commands

What You’ll Build

This is the most important five minutes in the whole book, because it’s the moment Minecraft stops feeling like a finished thing you play and starts feeling like a thing you can talk to. You’re going to open a world, type a short instruction into the chat box, press Enter, and watch the game do exactly what you said: hand you a diamond sword, drop a cow at your feet, whisk you across the map. No files, no setup beyond ticking one box. Just you and the game, having a conversation.

By the end of this chapter you’ll know the handful of commands that do the most useful “just make something happen” jobs: making the game talk (/say), handing yourself items (/give), spawning mobs and other entities (/summon), and moving things around (/teleport, which you can also write /tp). You’ll learn to read the little feedback line a command prints, so you can tell “it worked” from “it failed,” and you’ll meet the three simplest ways to point a command at someone: @s, @p, and @a. Everything in this chapter is typed straight into the chat box and happens the instant you press Enter.

Setting up a world to play in

Commands are powerful, so Minecraft only lets you use them in a world where cheats are turned on. (“Cheats” is just Minecraft’s word for “commands allowed.” There’s nothing sneaky about it; it’s the switch that hands you the controls.) Make yourself a world to experiment in:

  1. Click Create New World.
  2. Set the Game Mode to Creative (you get every block, you can fly, and nothing can kill you, perfect for tinkering).
  3. Open the More tab and turn Allow Cheats on.
  4. Create the world and drop in.

That’s your test world: a safe sandbox where a mistake costs you nothing. Do all your experimenting here, not in a survival world you care about. (When you start building real projects later in the book, you’ll keep using a world set up exactly like this one.)

Try It! Press T to open the chat box. A line opens at the bottom of the screen with a / already waiting. Type time set day and press Enter. If it’s night, the sun jumps up. You just ran your first command. Figure (to be captured). the chat box open with /time set day typed in, ready to press Enter

Concepts

A command is a single instruction to the game: “give this player a sword,” “spawn a zombie here,” “send everyone a message.” You open the chat box with T, and every command starts with a slash (/). The slash is how the game knows you’re giving an order instead of just chatting. Type the command, press Enter, and it happens immediately.

Most commands need to know who or what they act on. Instead of typing a player’s exact name every time, Minecraft gives you target selectors: short codes that stand for “some players or entities.” This chapter uses only the three simplest ones:

  • @s is yourself, the one running the command. When you type a command in chat, @s is you.
  • @p is the nearest player to where the command runs.
  • @a is all players online.

(There are more, like @e for all entities, @r for a random one, and @n for the nearest entity, but they come with filters and fine print that we save for Chapter 3. Three is plenty for now.)

Finally, almost every command prints a line of feedback after it runs: a short message telling you it worked, or a red message telling you it didn’t and roughly why. Learning to glance at that line is the fastest debugging habit there is, and we’ll lean on it at the end of the chapter.

Modern Minecraft Typing commands one at a time in chat is the fastest way to learn them, and that’s exactly what this chapter is for. Later you’ll discover two ways to save commands so you don’t retype them: putting them in a command block inside the world (Chapter 6), and saving whole lists of them in a data pack (Part III), which is how real creations are built and shared. For now, the chat box is your workbench.

Making the game talk: /say

The simplest “make something happen” command is /say. Its job: broadcast a plain-text message in the chat to everyone in the world. The syntax is just:

/say <message>

The <message> is everything after the word say. You don’t put it in quotes, you just type it. Open the chat box and try:

/say Welcome to my world!

Press Enter, and everyone in the world (in single-player, that’s you) sees [<your name>] Welcome to my world! in chat. That’s /say in full: plain, unstyled, broadcast to all.

/say is great for a quick “did that work?” check. The text is always plain, though: you can’t color it or make it clickable. When you want a styled, colored, or clickable message, there’s a fancier command called /tellraw. It’s genuinely useful, but it needs you to write the message in a small data format, and that format deserves a proper, gentle introduction rather than a surprise here on page one. So /tellraw gets its own chapter (Chapter 5), once you’ve got a few easy commands under your belt. For now, /say is all you need to make the game talk.

Figure (to be captured). chat showing a /say line broadcast to everyone, with the player-name prefix visible

Giving yourself items: /give

/give puts items straight into a player’s inventory. The syntax is:

/give <targets> <item> [<count>]

  • <targets>: who gets the item (@s = you, @p = nearest player, @a = everyone).
  • <item>: the item’s identifier, like minecraft:diamond (the minecraft: part can be left off for vanilla items, so diamond works too).
  • [<count>]: optional how many. The square brackets mean “you can leave this out”; if you do, it defaults to 1.

Try giving yourself a few things. Type these one at a time, pressing Enter after each:

/give @s diamond_sword /give @s diamond_pickaxe /give @s cooked_beef 16 /give @s oak_planks 64

The first two leave out the count, so you get one of each. The last two ask for 16 steaks and a full stack of 64 planks. Your inventory fills up as you press Enter.

What Went Wrong? “Nothing went into my inventory.” Two usual causes. First, your inventory might be full: in Creative the extra is simply discarded; in Survival it drops on the ground. Second, you may have misspelled the item ID (diamnod_sword). A wrong ID makes the command fail with a red feedback line; read it (see “Reading feedback” below).

Under the Hood /give items can carry extra built-in data in square brackets after the ID (for example a custom name, a color, or enchantments), written like diamond_sword[...]. That square-bracket syntax is the data component system, and it’s the whole of Chapter 21. You don’t need it yet; plain item IDs are all this chapter uses. (Skippable.)

Spawning entities: /summon

/summon creates an entity: a mob, a dropped item, a lightning bolt, anything that moves or lives in the world. The syntax is:

/summon <entity> [<pos>] [<nbt>]

  • <entity>: what to spawn, by identifier: minecraft:cow, minecraft:zombie, minecraft:lightning_bolt. (One catch: you can’t summon a player or a fishing bobber; those always fail.)
  • [<pos>]: optional where to spawn it. The brackets mean you can leave it out, and if you do, the entity spawns right where you’re standing. That’s perfect for us right now.
  • [<nbt>]: optional extra data describing the entity (its name, whether it’s a baby, effects on it, and so on). That’s a more advanced topic; we’ll spawn plain default mobs here.

Stand in an open spot, open chat, and try:

/summon cow /summon cow /summon zombie

Each press of Enter pops a mob into existence right on top of you: two cows and a zombie.

What Went Wrong? “I tried to put the mob at a specific spot and it failed / went somewhere weird.” To place a summon at an exact place you give it coordinates, and coordinates are the whole of the next chapter (Chapter 2). Until you’ve read it, the easy path is to leave the position out, which spawns the mob right where you stand. Walk to where you want it and summon there.

What Went Wrong? “Summoning a hostile mob did nothing.” On Peaceful difficulty the game refuses to summon hostile mobs like zombies. Open your world to Easy (or harder) and try again.

Moving things around: /tp and /teleport

To move a player or entity, use /teleport. It has a short alias, /tp, and they’re the same command, so tp and teleport do exactly the same thing; pick whichever you like to type. The two forms you’ll use most are:

/teleport <targets> <location> moves the target(s) to a set of coordinates. /teleport <targets> <destination> moves the target(s) to another entity’s position.

(If you give just one argument, /teleport <location> or /teleport <destination>, it moves you.)

A couple of examples to try:

  • /tp @a @s teleports all players to you (@s). The first selector is who moves, the second is where they go (here, to you). In single-player this just keeps you put, a safe way to watch the command parse without error.
  • Teleporting to exact coordinates is also possible, but coordinates are the next chapter; for now, teleporting to an entity (like @s) is the form to play with.

What Went Wrong? “Teleport sent me somewhere strange.” If you tried typing raw numbers, the order is always X Y Z, and a common mix-up is putting the height (Y) in the wrong slot, sending you underground or into the sky. Coordinates get their own chapter next (Chapter 2); until then, teleport to an entity rather than to numbers.

Reading feedback messages

Every command you run prints a small feedback line, and reading it is how you tell success from failure without guessing:

  • On success, the game prints a confirming line. For example, after a /give it tells you the item was handed over; after a /summon it confirms something was created.
  • On failure, the game prints a red line that names the problem: an argument that wasn’t filled in correctly, a target that matched nobody, a position the game couldn’t use.

A few common failures worth knowing as a checklist when a red line appears:

  • /give fails if the targets don’t resolve to any online player, or the item can’t be given.
  • /summon fails if you try to summon a player/fishing bobber, the spot is in an unloaded chunk, you summon a hostile mob on Peaceful, or the coordinates are out of the world’s huge legal range.
  • /teleport fails if the targets or the destination entity don’t resolve, or the coordinates are out of range.

So the routine is always the same: run the command, glance at the feedback line, and if it’s red, match it against the command’s failure reasons. The exact wording changes from command to command, so rather than memorize a message string, read the actual words your game prints and map them to a cause.

Common mistakes

A quick field guide to the beginner trip-ups this chapter tends to produce:

  • Forgetting the /. In the chat box, a command must start with a slash. Without it, the game thinks you’re just chatting and prints your text as a message instead of running it.
  • Forgetting the target on /give or /teleport. Unlike /say (which always goes to everyone), these need you to say who: @s, @p, or @a. Leaving it out is an error.
  • Misspelling an identifier. zombei, diamnod_sword, coww: a wrong ID fails the command with a red line. Type IDs carefully.
  • Trying to summon hostiles on Peaceful. The command quietly fails. Set your world to Easy or harder.

Practice

Build a one-shot “test playground” by typing a sequence of commands: announce it, kit yourself out, and spawn a few mobs to experiment on. Stand in an open area in your test world and type these in order:

/say Setting up the test area... /give @s diamond_sword /give @s diamond_pickaxe /give @s bread 16 /give @s torch 64 /summon cow /summon pig /summon zombie /summon skeleton /say Test area ready!

You should get your kit, see four mobs appear, and read the “setting up” and “ready” messages in chat.

Figure (to be captured). the test world right after running the setup sequence — the player holding the kit, with a cow, pig, zombie, and skeleton spawned nearby, and the setup messages in chat

Typing all ten lines every time you want a fresh playground gets old fast, and that nagging feeling is exactly the itch the rest of the book scratches. In Chapter 6 you’ll wire a sequence like this into a command block so a button press runs it, and in Part III you’ll save it as a function you can trigger with a single command. For now, just notice the wish: “I’d love to run all of these at once.” Hold onto it.

Now make the playground yours:

  1. Personalize the kit. Swap in items you like to test with, maybe bow and arrow 32, or a stack of tnt. Read each /give’s feedback to confirm it worked.
  2. Pick your mobs. Replace one mob with another you want to experiment on (creeper, villager, armor_stand). Remember hostiles need a non-Peaceful difficulty.
  3. Break one on purpose. Misspell an item or a mob (try /give @s diamnod_sword or /summon coww) and read the red feedback line it prints. Getting comfortable reading that red line now, when the mistake is harmless, is the single most useful habit you’ll carry through the whole book.

Try It! Here’s a wish you can’t grant yet: cleaning the playground back up. Removing only certain entities (say, just the zombies) needs target-selector filters like @e[type=zombie]. That’s Chapter 3, a good reason to keep reading.

What Can Go Wrong

  • Nothing happens and my text shows up in chat. You forgot the leading /, so the game treated your command as a chat message. Open chat, start with the slash, try again.
  • A command runs but seems to do nothing. Read its feedback line. A red line means it failed: match it to the command’s failure reasons (wrong ID, no matching target, Peaceful difficulty, a position the game can’t use). No red line plus no visible effect often means you weren’t looking where it happened (a mob summoned behind you, an item that overflowed a full inventory).
  • Mobs spawn in the wrong place, or not at all. With no position, a /summon spawns where you stand, so face an open area first. Precise placement needs coordinates, which is the very next chapter.

What You Know Now

You can open the chat box and talk to Minecraft: make it broadcast with /say, give items with /give (with an optional count), summon entities with /summon (spawning where you stand when you omit the position), and teleport players or entities with /teleport / /tp. You can aim any of them at @s (yourself), @p (nearest player), or @a (all players), and you can read a command’s feedback line to tell success from a red failure. You also felt the first real itch of this whole book (“I wish I could run all of these at once”), which is the thread everything else pulls on. Next, in Chapter 2, you’ll unlock real positioning power: the X/Y/Z axes and the ~ and ^ coordinate shortcuts that let your commands aim anywhere in the world.