Sams Teach Yourself Mod Development for Minecraft in 24 Hours, Second Edition

Book description

In just 24 sessions of one hour or less, Sams Teach Yourself Mod Development for Minecraft in 24 Hours will help you transform Minecraft into anything you can imagine–and share your vision with millions of players worldwide! You’ll learn all the mod development skills you need as you walk through a complete step-by-step project, complete with a mob, new tools, new armor, food, ores, and much more. Every lesson builds on what you’ve already learned, giving you a rock-solid foundation for building any mod and creating any world!

Step-by-step instructions carefully walk you through the most common Minecraft mod development tasks.

Quizzes and exercises at the end of each chapter help you test your knowledge.

Notes present interesting information related to the discussion.

Tips offer advice or show you easier ways to perform tasks.

Cautions alert you to possible problems and give you advice on how to avoid them.

Minecraft is a registered trademark of Mojang Synergies / Notch Development AB. This book is not affiliated with or sponsored by Mojang Synergies / Notch Development AB.

Learn how to...

  • Set up the environment where you’ll write your mod for Minecraft 1.8

  • Create the basics for your mod with the Forge API

  • Establish a framework that makes it easier to build complex mods

  • Work with recipes and other small modifications

  • Create multiple recipes, items, blocks, and entities at once

  • Cook up food items that heal your players

  • Make custom pickaxes, shovels, and completely original tools

  • Use Tile Entities to create complex and unique mods

  • Create interesting custom armor for players

  • Generate entire worlds, including ores and plants

  • Design and generate new structures with MCEdit

  • Understand Entities and create Entity Models with Techne

  • Code mobs with a custom Entity Model

  • Manufacture Throwables

  • Edit Minecraft functionality without breaking other mods

  • Structure, package, and release your mod

  • Master Java programming techniques you can use far beyond Minecraft

  • On the Web:


    Register your book at informit.com/title/9780672337635 for access to all code examples and resources from this book, as well as updates and corrections as they become available.

    Table of contents

    1. About This E-Book
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Table of Contents
    6. About the Author
    7. Dedication
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
      1. Who Should Read This Book
      2. How This Book Is Organized
      3. Conventions Used
        1. Try It Yourself
        2. Notes
        3. Tips
        4. Cautions
        5. Code Listings
      4. Downloading the Code and Resources
    12. Part I: Introduction
      1. Hour 1. Setting Up the Minecraft Development Environment
        1. Understanding How Minecraft Is Written and What You Will Do with It
          1. Getting the Source Code
        2. Learning About Forge
        3. Setting Up the JDK
          1. Windows
          2. Mac
          3. Linux
        4. Setting Up Eclipse
        5. Setting Up Forge
        6. Troubleshooter
        7. Summary
        8. Q&A
        9. Workshop
          1. Quiz
          2. Answers
        10. Exercises
      2. Hour 2. Creating the Basics for Forge
        1. Understanding the Java in the ExampleMod
          1. Packages and Imports Explained
          2. The @Mod and the Class
        2. Creating Your Own Package
        3. Creating Your Own Class File
        4. Creating the Mod File
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
          1. Code Answers
      3. Hour 3. Working with Recipes and Other Small Modifications
        1. Learning About Recipes in Minecraft
        2. Crafting a Recipe
          1. Using GameRegistry
          2. The Shape of the Recipes
        3. Creating a Shapeless Recipe
        4. Creating a Smelting Recipe
        5. Using Special ItemStacks
        6. Changing the Mob Spawn in a Dungeon
          1. Removing a Mob
          2. Adding a Mob
        7. Changing Chest Items
          1. Removing an Item
          2. Adding an Item
        8. The Results in the Mod File
        9. Summary
        10. Q&A
        11. Workshop
          1. Quiz
          2. Answers
        12. Exercises
    13. Part II: Items
      1. Hour 4. Making Your First Item
        1. Understanding What an Item Is
        2. Coding a Basic Item
          1. Creating an Item File
          2. Fixing the Name
        3. Giving the Item a Texture
          1. Using a Custom Item In a Recipe
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      2. Hour 5. Creating Multiple Items in a Smart Way
        1. Adding Multiple Items Using the Same File
        2. Adding Metadata to Items
        3. Changing the Constructor
          1. Fixing the Name
          2. Variants and More
          3. Fixing the mod Class
          4. Fixing the Recipes
        4. Making Metadata Jsons
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
      3. Hour 6. Cooking Up a Food Item
        1. Understanding Food in Minecraft
        2. Creating a Food Item
          1. The Mod File Code
          2. Creating the ItemBerry Class
        3. Adding a Potion Effect
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercise
      4. Hour 7. Making Your Own Tools
        1. Creating a ToolMaterial
        2. Creating a Pickaxe
          1. The Mod File Code
          2. Creating the ItemSamPickaxe Class
        3. Creating Special Tools for Harvesting Different Blocks
          1. The Mod File Code
        4. Creating the ItemSamPaxel Class
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
      5. Hour 8. Creating Armor
        1. Creating Your ArmorMaterial
        2. Creating the Armor
          1. The Mod File Code
          2. Creating the ItemSamArmor Class
        3. Customizing Armor
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
    14. Part III: Blocks
      1. Hour 9. Making Your First Block
        1. Understanding What a Block Is
        2. Creating a Basic Block
          1. The Mod File Code
          2. Creating the BlockSamStone Class
          3. Customizing Your Block
        3. Making the Texture Jsons
        4. Using a Custom Block in a Recipe
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
      2. Hour 10. Block States
        1. Coding Block State Blocks
          1. Creating the BlockType Class
          2. Implementing OreType in BlockSamStone
          3. Coding ItemSamStone
          4. Finishing Your Block
          5. Localizations and Registry
        2. Making Block State Jsons
        3. Summary
        4. Q&A
        5. Workshop
          1. Quiz
          2. Answers
        6. Exercises
      3. Hour 11. Making Your Blocks Unique
        1. Adding Sided Textures
        2. Making Half Blocks
        3. Creating a Plant
          1. Coding the Basics
          2. Creating the Block States
          3. Making It a Crop
          4. Natural Growing
          5. Adding Textures
          6. Adding a Seed
          7. Customizing the Plant
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      4. Hour 12. Creating a Tile Entity
        1. Understanding What a Tile Entity Is
        2. Creating a Tile Entity Block
          1. Adding a Tile Entity to the Block
        3. Creating a Tile Entity
        4. Server Synchronization
          1. Adding Right-Clicking to Your Block
          2. Sending the Data
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
    15. Part IV: World Generation
      1. Hour 13. Generating Ores
        1. Using Forge and an EventHandler
        2. Creating a SamEventHandler
          1. Adding the World Generation Code
        3. Using OreDictionary
          1. OreDictionary Registry
          2. OreDictionary Recipes
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      2. Hour 14. Generating Plants
        1. Creating a Custom WorldGen Class
          1. Randomizing the Location
          2. Checking and Placing
        2. Adding Code to SamEventHandler
        3. Summary
        4. Q&A
        5. Workshop
          1. Quiz
          2. Answers
        6. Exercises
      3. Hour 15. Using MCEdit
        1. Why Use MCEdit
        2. Getting MCEdit
          1. Installing MCEdit
        3. Using MCEdit
          1. Importing a World
          2. Exporting Your Structure
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      4. Hour 16. Generating Your Structure
        1. Installing the Schematic Converter
        2. Using the Schematic Converter
          1. The Generation File After Exporting It
          2. Making the Structure Generate
        3. Adding Mobs to Your Structure
          1. Manual Spawning of Entities
          2. Using a Mob Spawner
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
    16. Part V: Entities
      1. Hour 17. Learning About Entities
        1. Understanding What an Entity Is
        2. Creating Proxies
          1. What Are Proxies?
          2. Adding Proxies to Your Mod
          3. Coding the CommonProxy
          4. Creating the ClientProxy
        3. Creating a Basic Entity
          1. Creating the EntitySamMob Class
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      2. Hour 18. Creating an Entity Model Using Techne
        1. What Are Models?
        2. Downloading and Installing Techne
        3. Using Techne
          1. Understanding the Interface
          2. Editing Cube Properties
          3. Adding and Removing Cubes
          4. Exporting Your Model
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      3. Hour 19. Coding a Mob
        1. Rendering the Mob
          1. Finishing the Model Class
          2. Coding the Render Class
          3. Registering the Render
        2. Making the Mob Spawn
          1. Adding a Mob Egg
          2. Adding Natural Spawns
        3. Making EntitySamMob a Mob
          1. Adding AI to the Mob
          2. Adding Base Values
          3. Adding Drops
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      4. Hour 20. Creating a Throwable
        1. Registering a Throwable Entity
        2. Creating the Entity Class
        3. Using the Entity
          1. Making the Item Throw the Entity
        4. Rendering the Entity
        5. Summary
        6. Q&A
        7. Workshop
          1. Quiz
          2. Answers
        8. Exercises
    17. Part VI: Final Pointers
      1. Hour 21. Editing Vanilla Minecraft
        1. How to Change Minecraft Indirectly
          1. Removing Entities
          2. Changing an Entity Without Replacing
          3. Editing Block Drops
        2. Other Events
        3. Giving Your Armor Egg-Throwing Abilities
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
      2. Hour 22. Structuring Your Mod
        1. Why It Is Important to Structure Your Mod
        2. How to Structure Your Mod
          1. Cleaning the Package
          2. Cleaning the Mod Class
        3. Summary
        4. Q&A
        5. Workshop
          1. Quiz
          2. Answers
        6. Exercises
      3. Hour 23. Releasing Your Mod
        1. Exporting Your Mod with Forge
          1. Creating the mcmod.info File
        2. Making Your Mod Public
          1. Uploading to the Most Used Website
          2. Setting Up a GitHub Repository
          3. Other Websites
        3. Summary
        4. Q&A
        5. Workshop
          1. Quiz
          2. Answers
        6. Exercise
      4. Hour 24. What’s Next
        1. Using IRC
          1. Installing IRC
        2. Using Open Source Mods
          1. Finding Open Source Mods
          2. Understanding the Code
          3. Using the Code
        3. Learning Java
        4. Summary
        5. Q&A
        6. Workshop
          1. Quiz
          2. Answers
        7. Exercises
    18. Appendices
      1. Appendix A. Additional Code Fragments
        1. Configs
        2. Custom Tree Generation
        3. Automatic Update Checking
        4. Custom Creative Tabs
        5. Custom TNT
        6. Changing Mob Behavior
        7. Armor Effects
        8. Creating a Custom Dimension
          1. WorldProviderExample
          2. ChunkProviderExample
        9. Custom Biomes
        10. Custom AI
          1. Fleeing When Hurt
          2. Attacking by Night
          3. Using Your Custom AI
        11. Spawning Particles
        12. Playing Sounds
    19. Index
    20. Code Snippets

    Product information

    • Title: Sams Teach Yourself Mod Development for Minecraft in 24 Hours, Second Edition
    • Author(s): Jimmy Koene
    • Release date: October 2015
    • Publisher(s): Sams
    • ISBN: 9780134389783