← Back to Home Phase 1: Command Blocks Next: Phase 2 →

🟩 Phase 1: Command Blocks

Your First Step into Minecraft Programming!

Steve with Command Block

Welcome to Command Blocks!

Command Blocks are special blocks in Minecraft that let you run commands automatically. They're perfect for beginners because:

💡 What You'll Learn: By the end of this tutorial, you'll understand how to give Minecraft commands, how to chain commands together, and how to make things happen automatically - these are the same concepts used in ALL programming!

Getting Started

Step 1: Enable Cheats

Command blocks only work when cheats are enabled. Here's how:

  1. Open Minecraft Bedrock Edition
  2. Create a new world or open an existing one
  3. If creating new: Toggle "Activate Cheats" to ON before creating
  4. If existing world: Pause game → Settings → Game → Toggle "Activate Cheats"
⚠️ Note: Enabling cheats will disable achievements for that world. Create a separate "coding practice" world so you don't affect your main game!

Step 2: Get Your First Command Block

You can't find command blocks in creative inventory - you need to give them to yourself using a command!

/give @s command_block

How to use this command:

  1. Press T (on PC) or the chat button (on console) to open the chat
  2. Type the command exactly as shown above
  3. Press Enter
  4. A command block will appear in your inventory!
🤔 What does this mean?
  • /give - The command to give items
  • @s - Means "yourself" (the person running the command)
  • command_block - The item you're giving yourself

Your First Command Block Program

Project: The Teleporter

Let's create a simple teleporter that moves you to a different location when you press a button!

What You'll Need:

Step-by-Step Instructions:

1. Place the Command Block

  1. Find a spot in your world
  2. Place the command block on the ground
  3. Right-click (or interact) with the command block to open its interface

2. Configure the Command Block

In the command block interface, you'll see several options:

Command Block Interface
Block Type: Set to "Impulse" (this is default - it runs once when triggered)
Condition: Set to "Unconditional" (it always runs)
Redstone: Set to "Needs Redstone" (it waits for a button press)

3. Enter the Command

In the command input box, type:

tp @p ~ ~10 ~
🤔 Breaking it down:
  • tp - Short for "teleport"
  • @p - Means "nearest player" (probably you!)
  • ~ - Means "current position"
  • ~10 - Means "10 blocks up from current position"
  • ~ - Current position (no change in Z direction)

So this command says: "Teleport the nearest player 10 blocks straight up!"

4. Add a Button

  1. Place a button on the command block or next to it
  2. Press the button
  3. You should teleport 10 blocks up! 🚀
Teleporter setup with command block and button
🎉 Congratulations! You just wrote your first Minecraft program! You used:
  • Input: The button press
  • Processing: The command block executing the command
  • Output: Your character teleporting up
This is the same pattern used in ALL programming!

Understanding Coordinates

To make cooler teleporters, you need to understand coordinates. Minecraft uses three numbers to describe every position:

Two Ways to Specify Positions:

1. Absolute Coordinates

tp @p 100 65 200

This teleports you to the EXACT position X=100, Y=65, Z=200 in the world.

2. Relative Coordinates (using ~)

tp @p ~5 ~0 ~-3

This teleports you RELATIVE to where you are now: 5 blocks East, same height, 3 blocks North.

💡 Pro Tip: To see your current coordinates in Minecraft, turn on "Show Coordinates" in world settings!
Show Coordinates setting in Minecraft

More Fun Commands to Try

Give Yourself Items

give @p diamond 64

Gives the nearest player 64 diamonds. You can change "diamond" to any item and "64" to any number!

Change the Time

time set day

Sets the time to daytime. Try: night, noon, midnight

Change the Weather

weather clear

Makes it sunny. Try: rain, thunder

Summon Mobs

summon pig ~ ~ ~

Spawns a pig at the command block's location. Try: cow, sheep, zombie

Fill Areas with Blocks

fill ~0 ~0 ~0 ~5 ~5 ~5 stone

Creates a 5×5×5 cube of stone. Great for building!

Advanced: Chaining Command Blocks

You can make command blocks run in sequence - this is just like writing a program with multiple steps!

Project: The Ultimate Teleporter

Let's make a teleporter that gives you a message, plays a sound, AND teleports you!

  1. Place 3 command blocks in a row (Command Blocks in series must point in line to the next one to be triggered)
  2. Set the first one to: Impulse, Needs Redstone
  3. Set the next two to: Chain, Always Active

Command Block 1 (Impulse):

say Teleporting in 3... 2... 1...

Command Block 2 (Chain):

playsound random.levelup @p

Command Block 3 (Chain):

tp @p 100 70 100

Put a button on the first command block. When you press it, all three commands run in order!

Three command blocks chained together
🎓 What You Learned: You just learned sequential execution - making things happen in order. This is a fundamental programming concept!

Challenge Projects

Now that you know the basics, try these challenges:

Easy Challenges:

  1. Home Button: Create a button that teleports you to your house coordinates
  2. Day/Night Switch: Create buttons to instantly change between day and night
  3. Item Shop: Create buttons that give you different items

Medium Challenges:

  1. Mob Spawner: Create a button that spawns 5 different friendly animals
  2. Instant House: Use the /fill command to build a simple house instantly
  3. Treasure Hunt: Place multiple teleporters that take you to different locations

Advanced Challenges:

  1. Minigame Arena: Create a teleporter to an arena, then use /fill to create walls
  2. Weather Control Room: Create multiple buttons for different weather and time settings
  3. Elevator System: Create teleporters that go to different "floors" in a building

Target Selectors - The Power of @

You've seen @p and @s, but there are more! These are called "target selectors":

Examples:

tp @a ~ ~20 ~

Teleports EVERYONE 20 blocks up - great for getting everyone's attention!

give @r diamond 1

Gives a random player a diamond - fun for games!

kill @e[type=zombie]

Removes all zombies - notice the [type=zombie] filter!

Tips & Troubleshooting

Common Mistakes:

  • Typos: Commands are case-sensitive and spelling matters! tp works, TP doesn't.
  • Spaces: Make sure you have spaces in the right places: tp @p ~ ~ ~ not tp@p~~~
  • Quotes: If a command doesn't work, try not using quotes unless they're needed for text with spaces

Debugging Tips:

What's Next?

🎉 You've Completed Phase 1!

You've learned the basics of:

  • ✅ Commands and syntax
  • ✅ Coordinates and positioning
  • ✅ Sequential execution (making things happen in order)
  • ✅ Target selectors and filtering

When you're ready to level up, move on to Phase 2: MakeCode where you'll learn visual programming and be able to create even more amazing things!

💡 Before Moving On: Make sure you're comfortable with command blocks. Try creating a few of the challenge projects above! The more you practice, the easier the next phase will be.
Continue to Phase 2: MakeCode → ← Back to Home