This is the first post in a series of tutorials about learning how to code. Check out other articles from the series here.
One of the best ways to learn how to write code is to make changes to something you already know. "Sure, zombies can only attack when the sun has set in Minecraft, but what if they could survive during the day, too?"
Everyone's already familiar with Minecraft, the best-selling video game of all time. In the 10+ years since Notch first started developing the game, it has sold over 200 million copies. If you've been playing this game for years, or even if you've only seen a few videos of it online, Minecraft is a perfect way to develop new programming skills.
As you may already know, there are two main editions of Minecraft: Java edition and Bedrock edition. The Java edition was the original version that was released in 2011. This edition is only playable on Windows, macOS, and Linux. Since then, various other versions of the game have been developed for Xbox, PlayStation, iOS, Android, and many more platforms, all called the Bedrock edition of the game. There's also a Bedrock edition version for Windows 10, which makes things more confusing!
There are many technical reasons behind having separate editions, but for now all you need to know is this:
Java Edition: Windows, macOS, and Linux
Bedrock Edition: Windows, consoles, and mobile platforms
Okay, now that you have a basic understanding of the different versions of Minecraft, let's start talking about programming! We'll be writing "plugins" for Minecraft: Java edition. These plugins can add on extra abilities to the game, depending on what you write. If you want, you can make a plugin that spawns a creeper instead of a chicken when you throw an egg!
Why are we using the Java edition, though? Also, what are the differences between the Java edition and the Bedrock edition?
Good questions! For the most part, the Java and Bedrock editions offer the same experience in-game. However, there are many technical differences behind the scenes.
The main difference between the two editions are the programming languages they are written in. Programming languages are like the languages we speak and write (English, Spanish, etc.), except they're used to talk to computers instead of people.
The Bedrock edition of Minecraft is written in the C++ programming language, and the Java edition is written in the Java programming language. These two languages look different from one another, but can still be used to do the same things. Here's a line of code in each language that prints out "Hello, world!"
Both languages are formatted differently, but they can still do the same thing. This is just an example though - Minecraft is a lot more complex than just printing out some text!
For our use case, we will be focusing on the Java edition of Minecraft. I think Java is an easier language to start with for someone who is new to writing code. It's better at catching mistakes before you run your code, which can help you learn quicker.
Also, it's much easier to write a plugin for the Java edition than the Bedrock edition. There are technical reasons for this, but a big reason is that the Java edition has existed for a longer period of time. This means it has a more established "modding" community, or a community of people who write code libraries that allow others to write plugins (which modify the game).
That wraps up the first part! You're now familiar with the different editions of Minecraft and why we will be focusing on the Java edition. In the next part, we will get your computer set up to start writing plugins!
Note: In future parts, we will start writing plugins and testing them in-game. You will need an official Minecraft: Java Edition account to do this. You can only buy this edition of the game from the official Minecraft.net site at this link. This is not the edition you get from the Microsoft Store in Windows 10, or one that you get on any smartphone or gaming console.
Part 1 - Introduction
Part 2 - Setting up your IDE and JDK
Part 3 - Writing some Java code
Part 4 - Testing Your Plugin
Part 5 - Coming soon!