Minecraft has become a phenomenon over the last few years, from being almost unknown at the start of 2011 by an independent developer to becoming one of Microsoft's surprise purchases of 2014. Part of the reason for its success is that the virtual environment enables single-player and multi-player alike to build (and destroy) worlds, but also create new content by 'crafting' together existing resources to form new ones. But another key reason for its success is that the implementation, running in a Java VM, has spawned a world of 'modders', who build plug-ins to extend a Minecraft's world with new capabilities, or to enable building worlds programmatically.
Although Minecraft is distributed without source (and is obfuscated), a collection of reverse engineering tools provided a platform for making the core of the game understandable and extendable. Bukkit existed as a modding platform but ran into some problems whilst another modding community created Minecraft forge. These tools inspired the modding community which further helped fuel interest in the game; servers containing mods were popularised and group games helped propel Minecraft into the spotlight.
Despite the popularity of modding, actually getting the steps together to write a mod wasn't always obvious to those wanting to get started. As a result, Arun Gupta and his son Aditya Gupta created "Minecraft Modding with Forge" showing not only how to get started with creating mods, but also explaining the way in which the Minecraft mechanics work and using a number of simple examples showing how to implement features. In part this was inspired by Devoxx4Kids, an organisation helping to inspire children to learn to code, and needing a reference material or workshop helped get them moving in the right direction. The book is an evolution of those original workshops in an easy-to-follow printed version.
The book starts by showing how to get the tools installed and launched, so that a development version of Minecraft can be tested inside Eclipse. A simple mod, provided with Forge, shows how to get the application up and running and extended with new functionality. Subsequent chapters investigate the event bus and show how to interact with blocks, explosions and dealing with movement to provide parachute and jump effects. In addition, entities (Minecraft terminology for the animals and zombies that roam the land) can be equipped with armour as well as responding to user created commands. Finally, creating new blocks, items and recipes shows how a vanilla Minecraft world can be expanded to fill new ideas. A section on how to export the mod into a sharable JAR file concludes the book, along with references to other mods that can be installed.
The book's use of simple examples and code that can be typed in (or taken from Aditya's GitHub repository) is a great way of getting even novice users up to speed with experimenting with mods. Importantly, the examples provide guided imagination, so that someone working through the book will have plenty of ideas to try as well as a guide to do them. This makes exploring the world of Minecraft modding that much easier to write as although the contents will be familiar in syntax and style to existing Java developers, the Minecraft API is not widely known outside the modding community. It's a great book for technical parents to give to their children to encourage independent experimentation without needing to know much about how Minecraft works.
InfoQ caught up with the author Arun Gupta, and started off by asking why he thought children are so interested in Minecraft:
Arun: Minecraft is the modern day Lego where the number of bricks are unlimited. It takes that static Lego experience to a new dimension where you not only build creative structures but then you actually go through them. And during that process, you are chasing monsters, wearing armor, using recipes to create new materials, and a lot more. You don't need to be physically in the same room. For example, my son plays games with his school buddies in different arenas they build, all from their own home.
I also think kids love the first person aspect of the game. They get to go wherever, eat whatever, play with whoever, decide when to build or destroy a structure, etc. This game is a big hit in late elementary schools or early middle schools. These kids in real life rely upon parents for most of such activities. I think this first hand experience of independence is quite appealing.
The game play is very intuitive, there is no end goal, players define what they need to do at a given time. That does sound like a fun recipe for children :)
InfoQ: What makes Minecraft a particularly good target for modding?
Arun: Minecraft thrives on creativity - do whatever, whenever, with whoever. This is further bolstered by modding that allows to extend the game very easily. The kids that are already "addicted" to the game, its just about converting that energy and passion to show a way into the world of technology. I believe introducing Java using a conventional Hello World tutorial is boring and we are not going to attract any young developers that way. Let Minecraft modding be their first introduction to Java programming.
I don't know of any other games that have that capability of allowing to extend using programming.
InfoQ: Why is it so important to encourage children to get into coding?
Arun: Coding helps you think logically and therefore allows learning fundamental concepts. It gives them the power to make games, as opposed to just play the games. Technology has permeated into our daily lives like never before. Sooner or later, almost everything in this world will be driven or controlled by technology. Software is going to be a big part of it. Learning coding will allow the kids to create a more engaged and aware experience around them.
InfoQ: How long have you been involved with Devoxx4Kids?
Arun: For over 2 years now. I founded the US chapter and also run the San Francisco Bay Area chapter. We delivered ~40 workshops last year and reached out to 2.5k kids all over the Bay Area. It all started with the very first workshop on Minecraft modding in our living room for my son's buddies.
InfoQ: If other practitioners wanted to follow your lead, how could they get involved with Devoxx4Kids?
Arun: There are plenty of ways to join and help us. If you are looking for helping out anywhere in the US, then more details are here.
InfoQ: Finally, how was it in writing the book in conjunction with Aditya?
Arun: Many thanks to O'Reilly for giving us this lifetime opportunity of authoring the book together. It has been a completely joyful experience where I learned a bit of Minecraft terminology from my son and taught some Asciidoc and Java skills to him. We used to discuss the chapters on breakfast/dinner table, during grocery trips, drive to school/work, and every where else. The first draft of book using NetBeans and Bukkit was ready for pre-release in August 2014. But then Bukkit got shot down by DMCA. And so we had to rewrite the entire book, mostly from scratch but using Eclipse and Forge. There was a lot of positive coaching required to create new mods at that time.
Minecraft Modding with Forge is published by O'Reilly. Devoxx4Kids is a global organisation helping to inspire kids to code. Devoxx4Kids UK is running a meeting on June 20th 2015 in conjunction with the London Java Community.
About the Book Authors
Arun Gupta is Director of Developer Advocacy at Red Hat and focuses on JBoss Middleware. As a founding member of the Java EE team at Sun Microsystems, he spread the love for technology all around the world. At Oracle, he led a cross-functional team to drive the global launch of the Java EE 7 platform through strategy, planning, and execution of content, marketing campaigns, and program. After authoring ~1400 blog posts at blogs.oracle.com/arungupta on different Java technologies, he continues to promote Red Hat technologies and products at blog.arungupta.me. Arun has extensive speaking experience in 37 countries on myriad topics and is a JavaOne Rockstar. An author of a best-selling book, an avid runner, and a globe trotter, he is easily accessible at @arungupta.
Aditya Gupta is a twelve-year old Minecraft enthusiast who loves to create new mods for the game. He has experience working with many different types of programming languages, including Scratch, Java, Python, Greenfoot, and iOS. Alongside his father, Arun Gupta, he builds and delivers workshops for Devoxx4Kids.