In this project, we're going to write our first Minecraft program. This program will simply open the Minecraft window and print "Hello, Minecraft!" to the screen (similar to our very first "Hello, World!" program).

This project won't use the CREATOR Kit hardware, so no hardware setup required.

Here is the code that will open the Minecraft window and write your own custom text. Below, we will discuss the code line-by-line.

from rstem.mcpi import minecraft, control import time control.show() mc = minecraft.Minecraft.create() *mc.postToChat("Hello, Minecraft!") while True: * time.sleep(1)

For this project, this program is nearly identical to the code in the concept. We've simply added two small items:

- On Line 7, we use a function from the Minecraft API called `postToChat` to write "Hello, Minecraft!" in the Minecraft window

- On Line 10, we implement our Game Loop — this is the loop that will allow us to do more complex interactions with the Minecraft environment. For now, we'll leave our loop empty except for a `sleep` which will keep it from running too fast and hogging the processor

Remember, when you give this program (any any future program) a try, you need to follow the instructions in the project. First, you must exit the RDE, start Minecraft, minimize it and then come back to the RDE to run the program. Once you run the program, the Minecraft window should pop back up, and if you click in the window, you'll be back playing the game with your mouse and keyboard.

You can then move around the Minecraft world as long as you want. When you're done, hit "TAB" key on the keyboard (to free up the mouse) and then click the stop icon in the RDE. The Minecraft window will close automatically, but will still be running minimized in the background.

1. Can you modify the code so that Minecraft displays "Hello, Minecraft!" once per second while the you are playing in Minecraft?

2. Can you modify the code so that Minecraft displays a countdown number once per second? The countdown could start at 10, for example, and then decrease to 9, 8, 7... Once it hits zero, end your program (and the Minecraft window will automatically be minimized).