Minecraft Education – Lesson 1

Getting Started with Python in Minecraft Education

Objectives

Vocabulary


Setup Steps

  1. Launch Minecraft Education.
  2. Open a new world or an existing world.
  3. Press C (or the Code Builder key) to open Code Builder.
  4. Select Python as the language.

Part A – Saying Hello

We’ll start by making our player speak using Python.

Sample Code:

player.say("Hello, Minecraft world!")
player.say("I am coding with Python!")

Run the code and watch the messages appear above your character.


Part B – Teleporting the Player

We can move the player instantly using coordinates (x, y, z).

Sample Code:

# Teleport the player to coordinates (0, 10, 0)
player.teleport(pos(0, 10, 0))

player.say("I just teleported!")

Try:


Part C – Spawning Mobs

We can create (spawn) animals and mobs using Python commands.

Sample Code:

# Spawn a cow near the player
mobs.spawn(COW, pos(1, 0, 1))

# Spawn a chicken behind the player
mobs.spawn(CHICKEN, pos(-1, 0, -1))

Challenge:


Exit Ticket / Reflection