Preface

One day a couple of years ago, I was stunned when my son told me, “Dad, my JAR snapshot messed up the configuration.” As a curious dad and an experienced Java programmer, my question to him was, “How do you know what a JAR is?”

What I didn’t anticipate at that time was how that one question would completely change our discussions over the ensuing months and years. I learned that the game of Minecraft is written in Java, and that my son had been installing mods, which are other JARs, to modify the gameplay. After helping him fix the configuration problem, my son expressed a desire to write a mod and we started exploring how to do that. This marked the beginning of an extremely rewarding and enjoyable journey for the both of us: he taught me about Minecraft, and I taught him basic Java programming concepts. Notes were exchanged over breakfast and dinner, during drives to school or classes while grocery shopping, and pretty much everywhere.

After building our first mod during Christmas 2012, we decided to share the knowledge with his Minecraft buddies. That gave rise to the first Minecraft modding workshop in our living room with about 12 kids. Most of the kids had no programming experience, let alone experience with Java. However, there was high Minecraft experience in the group, with some kids playing for about two years and up to two hours every day. When given the topic of Minecraft, the small group would talk excitedly about different aspects of the game, constantly using hundreds of game-specific terms and phrases as if speaking a different language. My goal was to leverage their passion and introduce them to Java programming.

We built our first trivial mod, but there were a lot of hiccups. After that, everything slowly started to get better. Once we learned more about modding and gained more experience, we were able to improve the quality of the workshops. Since then, my son and I have delivered multiple modding workshops in different cities around the world. Starting a US chapter of Devoxx4Kids in December 2013 definitely exploded the interest in and visibility of these workshops, as well as other technology-related workshops targeted toward kids. You can read more about Devoxx4Kids in Appendix D.

Parents whose kids play Minecraft are well aware of how addicting the game can become. Playing the game is a lot of fun, but what makes it more engaging, entertaining, and educational is when kids start building mods. This book is targeted at parents and kids who would like to learn how to mod the game of Minecraft. It can be read by parents or kids independently, but it is more fun to read it together. No prior programming experience is required, but some familiarity with software installation will be very helpful (you’ll also need some basic troubleshooting know-how in case there is a problem with the installation, but this information can easily be found via a quick Google search).

How to Use This Book

This book does not intend to teach the game of Minecraft, as that is a vast topic by itself. Refer to the numerous articles at the official Minecraft wiki or check out YouTube for tutorials. Appendix A provides a basic introduction to Minecraft for readers who have never played the game.

Chapter 1 starts with a quick overview of the tools required for modding, and provides step-by-step instructions on how to download and install them. The remainder of the chapter walks through how to verify the sample mod bundled in the downloads. We explain the key concepts of the modding tools and familiarize you with Minecraft Forge terminology. This chapter builds the fundamentals required to create mods in subsequent chapters. As with learning any new skill, the concepts covered in this first chapter might be overwhelming for some readers, but it will soon become more familiar.

Moving on from there, Chapters 2 through 5 will walk you through building mods that modify existing parts of the game, such as exploding minecarts, bigger TNT explosions, bouncy sponges, and zombie knights. Each of these chapters has a specific theme: block-break messages (Chapter 2), explosions (Chapter 3), entities (Chapter 4), and movement (Chapter 5). Some of the mods also have variations that you can try out.

Next, we’ll explain how to add features to the game such as new commands (Chapter 6), blocks (Chapter 7), items (Chapter 8), and recipes and textures (Chapter 9). This book shows multiple mods that you can build with Forge. Each chapter provides suggestions on what additional mods can be tried based upon what you’ve learned so far. You are encouraged to try them out.

Once you have them set up, you’ll want to share these mods with your friends, so we take a look at how to do that in Chapter 10.

Throughout the book, you will also be exposed to many Java concepts, including keywords and syntax, classes, methods, annotations, control structures, arrays, and much more. Eclipse tooling is used to author Java files, so you’ll pick up that skill as well.

The book is focused on learning, so you should find the instructions easy to follow.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Important

This element indicates a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/AdityaGupta1/minecraft-modding-book; see Appendix C for download details.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Minecraft Modding with Forge by Arun Gupta and Aditya Gupta (O’Reilly). Copyright 2015 Arun Gupta and Aditya Gupta, 978-1-491-91889-0.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/minecraft-modding-forge.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

We would like to express our gratitude to many people who made writing this book an extremely joyful experience.

First and foremost, many thanks to O’Reilly for providing an opportunity to write this book. The team provided excellent support throughout the editing, reviewing, proofreading, and publishing processes.

At O’Reilly, Brian Foster provided excellent editorial help throughout all the stages of the book. Brian MacDonald, the developmental editor, was always thorough and provided excellent and detailed feedback. Minecraft advice and information was provided to Brian by Alex MacDonald, a seventh grader at Lionville Middle School. Brian and Alex helped to make sure that the level of detail was appropriate for the intended audience, which was of utmost importance to us.

The Tools team at O’Reilly was very helpful in answering all authoring and formatting questions. Jasmine Kwityn’s copyedit and Kristen Brown’s work as production editor made the book fluent and consistent. Thanks also to the rest of the O’Reilly team, some of whom we may not have interacted with directly, but who helped in many other ways.

Jack Walker, a sophomore at The Dinoff School in Griffin, Georgia, and Adam Cameron Little, an eighth-grader from Consett Academy, Consett, County Durham, United Kingdom, did an excellent technical review and helped shape the book so that it’s easy for beginners to start modding.

This book also forms the basis of the Minecraft modding workshops delivered at different worldwide chapters of Devoxx4Kids. Most of our Minecraft modding experience has come from preparing instructions for these workshops. A huge thanks goes to all the instructors, volunteers, and attendees of these workshops over the past months.

Many thanks to Stephan Janssen, a good friend, the man behind Devoxx4Kids, and the author of Appendix D, which provides more information on Devoxx4Kids. May his positive energy and support keep inspiring kids to stay engaged in technology.

The members of the Minecraft Forge Forums were very patient and extremely helpful in answering our questions. We highly encourage you to ask any of your Forge-related questions there.

Last, but not least, we seek forgiveness from all those who have helped us over the past few months and whose names we have failed to mention.

Get Minecraft Modding with Forge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.