Teaching Kids to Code with Minecraft Mods made easy using MakeCode and Code Connection
Back in the day, making a Minecraft mod was...challenging. It was a series of JAR files and Java hacks and deep folder structures. It was possible, but it wasn't fun and it surely wasn't easy. I wanted to revisit things now that Minecraft is easily installed from the Windows Store.
Today, it couldn't be easier to make a Minecraft Mod, so I know what my kids and I are doing tonight!
I headed over to https://minecraft.makecode.com/setup/minecraft-windows10 and followed the instructions. I already have Minecraft installed, so I just had to install the Minecraft Code Connection app. The architecture here is very clean and clever. Basically you turn on cheats in Minecraft and use a local websockets connection between the Code Connection app and Minecraft - you're automating Minecraft from an external application!
Here I'm turning on cheats in a new Miencraft world:
Then from the Code Connection app, I get a URL for the automation server, then go back to Minecraft, hit "t" and paste it in the URL. Now the two apps are talking to each other.
I can automate with MakeCode, Scratch, or other editors. I'll do MakeCode.
Then an editor opens. This is the same base open source Make Code editor I used when I was coding for an Adafruit Circuit Playground Express earlier this year.
Now, I'll setup a chat command in Make Code that makes it rain chickens when I type the chat command "chicken." It runs a loop and spawns 100 chickens 10 blocks above my character's head.
I was really surprised how easy this was. It was maybe 10 mins end to end, which is WAY easier than the Java add-ins I learned about just a few years ago.
There are a ton of tutorials here, including Chicken Rain. https://minecraft.makecode.com/tutorials
The one I'm most excited to show my kids is the Agent. Your connection to the remote Code Connection app includes an avatar or "agent." Just like Logo (remember that, robot turtles?) you can control your agent and make him build stuff. No more tedious house building for us! Let's for-loop our way to glory and teach dude how to make us a castle!
Sponsor: Get the latest JetBrains Rider with Code Vision, Rename Project refactoring, and the Assembly Explorer. Improved support for C#, VB.NET, F#, TypeScript, and Angular is all included.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
let fdCalled = false
player.onChat("fd", function () {
fdCalled = !(fdCalled)
if (!(fdCalled)) {
agent.move(SixDirection.Forward, 3)
}
})
I'm also not getting console.log() to work. In the MakeCode simulator, you can navigate to core/helpers.ts and see the definition of console.log shims to minecraft::serialSendString, but when I try to use it I get "Program Error: Cannot read property 'serialSendString' of undefined"
I am following the instructions above, as I did in Minecraft Windows 10 Edition v1.8.0 and Minecraft Windows 10 Edition v1.8.1.
When I try to connect with "/connect 192.168.178.30:19131", I get this error: "Kan geen verbinding maken met server ws://192.168.178.30:19131" which translates to: "Can not connect to server ws://192.168.178.30:19131".
Any suggestions?
Comments are closed.