Meeting 2019-12-03

Welcome to the first meeting of the Lowell School coding class!

Our goal for the term is to learn the basics of programming in the Python language. Python is a good language for beginners, but it is a "real" language that you can use to do almost anything you need to do in school, college, or your career (as long as you're not a web designer - then you'll want to learn Javascript).

Learning the details of any programming language can get a little dull, so I have tried to come up with a fun environment to do our coding in: Minecraft! All term long we will be practicing our new coding skills by writing Python programs that will interact with the Minecraft world running on our PCs.

This takes a bit of setup so for the first class we will work on getting the Python+Minecraft environment set up on the PC laptops we will be using.

Once you've done it in class you can follow the same instructions on a home PC if you'd like to get more practice in. Macs can run the same environment but the installation steps will be different.

Running our Python programs will require a Minecraft Java Edition license. If you have your own Minecraft login and license, please use it for the class. I'm hoping we can use the same Minecraft licenses that the Friday Minecraft elective class uses, but if that doesn't work out I have four family licenses we can start out with, and can add more if needed. You'll need to have your own license if you want to work on projects at home however.

Installing the Software

We need to install Java, Minecraft 1.12.2, Minecraft Forge, Python 3.8, and the Raspberry Jam Mod and example programs. We will follow the instructions from mod author Alexander Pruss on Instructables:

    1. Install the Java SE Runtime - Version 8.231 from the Java website. The installer will download the right Java version for your computer.

    2. Install the Minecraft Java Edition Launcher (if it isn't already installed on your laptop.)

    3. Run the Minecraft Launcher. Log in using your personal Minecraft account, a Lowell account, or an account the instructor provides.

    4. In the top menu bar, click Installations, and add a New installation for MC 1.12.2. Call it "Python MC 1.12.2" and pick VERSION "release 1.12.2", then click Create.

    5. Back in the Installations menu, click Play on the Python MC 1.12.2 you just created. Have it download the v1.22.2 files but click on "Quit Game" at the MC menu - you don't need to create a world.

    6. Download and run Minecraft Forge for MC 1.12.2 - the latest Windows Installer. Be patient while the AdFoc.us page counts down and click the gray "skip" button in the upper right to download. Run the .exe and click OK to Install Client in the default location. It will download some additional libraries.

    7. Run the MC Launcher again, under Installations you should have an entry for "1.12.2-forge". Run it and make sure Forge is loading - it has a different MC startup screen. Click on "Quit Game" again to exit.

    8. Download and install Python 3.8.0 from python.org. The default should be the 32-bit version. In the installer, select "Add Python 3.8 to PATH" at the bottom, and click the default "Install Now".

    9. Now download and run RaspberryJamMod-Installer.exe from the arpruss GitHub v0.94 release. Accept the agreement. Leave "Raspberry Jame Mod" checked, check "Sample Python scripts and mcpi framework" but DO NOT install Python3 - click to clear the "Python interpreter" checkbox. The installer should say it requires 4.4MB of disk space.

    10. Run the Minecraft Forge 1.12.2 installation again. Check in the lower left of the startup screen that there are 5 mods installed, including the RaspberryJamMod.

    11. Click on Singleplayer mode and "Create New World" to create a new test world. Name it "Python World" (or something more creative), select Game mode: Creative, and press "More World Options...". Press "World Type:" to get "Superflat" and optionally Customize your flat world. Leave "Allow Cheats: ON" and press "Create New World" at the bottom.

    12. Once in your new world, enter /py donut to test Python script running - it should make a huge glass torus filled with water! If it says "[ERR] Python not found" you need to reinstall Python and check the Add to PATH box.

    13. Set Minecraft to be windowed (not full screen) by pressing ESC, then Options->Video Settings->Fullscreen->OFF. Resize the MC window to 2/3rds of your screen area to make room for the Python editor.

    14. Open IDLE from Python using the Recently Added group of the Windows Start Menu. Select File->New File, and enter the following program in the editor window:

      1. from mine import *

      2. mc = Minecraft()

      3. mc.postToChat("Hello Minecraft World from Lowell")

    15. Save the program as HelloLowell.py in the Python scripts folder: %appdata%\.minecraft\mcpipy

    16. In Minecraft enter "/py HelloLowell" and look for the message in the console

If you saw the glass donut and the console message, your Minecraft+Python installation is working! Try running some of the other demo Python programs by entering the /py <programname> command in Minecraft. Some of them take a while to generate all the blocks, so keep on the lookout if you don't see anything at first.

Once everything is working, exit Minecraft. To avoid future confusion, run the Minecraft Launcher again and under Installations, you can delete the original Python MC 1.12.2 instance, and rename the "forge" one to be "Python MC Forge 1.12.2", which is what we will be running from now on.

Next week we will start programming once everyone has the software installed.