S omething always feels slightly off when I tinker with the learn-to-code games on a site like Hour of Code. Yes, the games can be fun. But they always seem like a coding simulation rather than a true coding experience. And the way they sweeten up algorithmic concepts with animation and cute characters feels a bit like the Flash games you use to drill multiplication tables or practice typing.
Đang xem: How to make minecraft hacks
It doesn’t need to be this way. The best programming experiences take place outside of a coding simulator. They happen you’re trying to accomplish something, whether it’s making a story, tinkering with a bit of electronics, or building a game. They’re not about finding the right commands to solve a maze — they’re about building your own maze.
Minecraft hacking is my new favorite example.
The idea is simple. A tool, called Microsoft MakeCode, opens a doorway between your coding environment and the real Minecraft program. Using this access, you can write programming logic that manipulates the Minecraft world. Your code can grow flowers, make chickens rain from the sky, and build massive walls. And there’s a real payoff, because Minecraft hacking lets you accomplish tasks that wouldn’t be possible any other way. For example, you can launch huge terraforming projects that would take days to do by hand. Or you can build mini games that run inside your Minecraft worlds and test your friends!
Minecraft hacking lets you accomplish tasks that wouldn’t be possible any other way.
A brief history of Minecraft modding
Minecraft hacking is not a new concept. It’s been possible for years, although it’s usually called modding, because these changes modify the way Minecraft works.
The Minecraft modding of the past was a challenging task for beginners. If you wanted to create your own mod, you needed to undertake a lengthy setup process, install Java development tools, and then spend more than a little time grappling with Java code. (The Raspberry Pi edition of Minecraft supports a slightly easier option, and lets you write mods in the Python programming language. You can enable this feature on normal Minecraft if you’re willing to set up a custom Minecraft server, but that’s its own headache.)
Even savvy Minecraft players rarely code their own mods. Instead, they download the most popular mods written by other people. Or, they use a dedicated piece of mod-making software that shelters them from the code, but also limits what they can do. That’s not to say that ambitious kids can’t mod Minecraft, but it’s a big jump if you don’t already have some basic coding experience under your belt.
MakeCode changes this situation, because it gives would-be hackers a much easier setup process and a far simpler programming environment. The most important difference is that you can build mods using Blockly, a Google-designed visual environment that lets you code by snapping together blocks, much like Scratch. (You may have seen Blockly before — it’s also used to control the Dash robot from Wonder Workshop, the micro:bit controller from the BBC, and the Circuit Playground board from Adafruit, among other uses .)
Here’s an example of a Blockly program that controls Minecraft:
Ready to set up this environment for yourself? Read on!
Connecting MakeCode to Minecraft
Before you begin, there’s one requirement to get out of the way. In order to hack Minecraft with MakeCode, you need one of the following editions of Minecraft:
Minecraft for Windows 10Minecraft: Education Edition
Unfortunately, there’s a gap for Mac users. They need the Education Edition, which is only available to accredited schools. Home Mac users are currently out of luck. Sadly, the original Java Edition of Minecraft won’t work with MakeCode on any operating system.
It’s also worth stating the obvious: Even though MakeCode is free, Minecraft isn’t. At the time of this writing, a copy of Minecraft for Windows 10 costs slightly less than $30.
Once you’ve got Minecraft on your computer, it’s all smooth sailing. First you need to download a tiny utility called Code Connection, which opens the connection between MakeCode and Minecraft. (You can get that on the Minecraft Education site.) Then, follow these steps:
1. Launch Minecraft and create a new world. Make sure to set Activate Cheats to On — without that change, your code won’t be allowed to tamper with anything in your world.
2. Start Code Connect. It will show you a special command with the address you need to open your connection. Press the copy icon to copy the command text.
3. Switch back to Minecraft and press T to open the chat bar. Press Ctrl+V to paste the command you copied from Code Connection, and then press Enter to put it into action.
Read more: how to hide chat in wow
4. At this point, Code Connection pops open a new window that asks what coding environment you want to connect. Click the MakeCode button, and Code Connection opens a new browser window at sends it to the MakeCode website.
At this point, your setup is complete, and you’re ready to start coding.
The MakeCode Website
All the coding with MakeCode takes place online, at its web site https://minecraft.makecode.com.
You can visit the MakeCode website, watch tutorials, and create Minecraft programs, even if you don’t own a copy of Minecraft. However, unless you have Minecraft (and the help of Code Connection) there’s no way for you to run your mods and see them in action.
If you’ve played with a visual programming environment before, the MakeCode editor will be easy to navigate. (And if you haven’t you can watch a quick video tutorial that introduces the MakeCode editor.)
The simplest Minecraft programs are triggered using chat commands, so the first step to building one is to add an event block that responds to the command you chose. In the wandering agent example shown earlier, the chat command is “wander”, and you can see it written in the opening event block. In this example, the chat command is “come”:
You can also react to other types of in-game events — for example, when an animal dies or a player uses an item.
Once you’ve added an event block, it’s a simple matter of dragging more blocks from the menu and snapping them into place inside the event block. You’ll see plenty of Minecraft-focused commands for spawning animals, moving to new locations, placing blocks, and changing the weather. Here’s a super-simple example that replies when the player types “come” and then teleports the agent — MakeCode’s Minecraft helper — over to the player’s current location.
When you’re finished assembling your program, press the play button to send your code through Code Connection and into your Minecraft world.
The best part of learning to program Minecraft is the way that beginners are encouraged to learn algorithmic basics as they go. Loops emerge naturally if you want to build a structure — there’s no other way to assemble a big building. If you want to react to other players, animals, and the terrain around you, you’ll need to learn to master conditional logic. Want to learn functions and recursion? Challenge yourself to build an agent that can find the path through a Minecraft maze.
To learn more, check out the sample projects on the MakeCode site. There are step-by-step tutorials for complete beginners starting out, and example projects that make towers of lava, mega cubes of TNT, and earthquake simulations. For more detailed information, you can read through the MakeCode reference. But there’s really no substitute for just diving in.
Read more: how to swim down in wow
Learning to code in Minecraft isn’t for everyone. For kids who aren’t interested in Minecraft’s virtual world building, programming Minecraft is a less exciting proposition. But if you know a Minecraft-obsessed middle-grade student, MakeCode feels more like play than work. Best of all, you aren’t playing a Minecraft-themed coding game that has a set solution and just one path to get there. Instead, you’re interacting with the real Minecraft application, and there are no limits to where your creativity can take you.