You are previewing Learn to Program with Minecraft Plugins, 2nd Edition.
O'Reilly logo
Learn to Program with Minecraft Plugins, 2nd Edition

Book Description

The bestselling, kid-tested book for Minecraft is now updated for CanaryMod! Write your own Minecraft plugins and watch your code come to life with flaming cows, flying creepers, teleportation, and interactivity. Add your own features to the Minecraft game by developing Java code that "plugs in" to the server. You'll manipulate and control elements in the 3D graphical game environment without having to write tons of code or learn huge frameworks. No previous programming experience necessary.

Table of Contents

  1. Learn to Program with Minecraft Plugins, 2 Edition
    1. Copyright
    2. For the Best Reading Experience...
    3. Table of Contents
    4. Praise for This Book
    5. Acknowledgments
    6. Start Here
      1. Who This Book Is For
      2. Getting Started
      3. Swimming in the Deep End
      4. Getting Help
      5. Conventions
    7. Chapter 1: Command Your Computer
      1. Use the Command Line
      2. Move Around in File Directories
      3. Start at the Desktop
      4. Common Commands
      5. Next Up
      6. Your Growing Toolbox
    8. Chapter 2: Add an Editor and Java
      1. Install an Editor to Write Code
      2. Install the Java Programming Language
      3. If the Java Command Is Not Found
      4. Other Reasons It Might Not Work
      5. Install the Minecraft Client and Server
      6. Next Up
      7. Your Growing Toolbox
    9. Chapter 3: Build and Install a Plugin
      1. Plugin: HelloWorld
      2. Configure with Canary.inf
      3. Build and Install with build.sh
      4. Using EZPlugin
      5. Next Up
      6. Your Growing Toolbox
    10. Chapter 4: Plugins Have Variables, Functions, and Keywords
      1. Keep Track of Data with Variables
      2. Plugin: BuildAHouse
      3. Plugin: Simple
      4. Organize Instructions into Functions
      5. Use a for Loop to Repeat Code
      6. Use an if Statement to Make Decisions
      7. Compare Stuff with Boolean Conditions
      8. Use a while Loop to Repeat Based on a Condition
      9. Next Up
      10. Your Growing Toolbox
    11. Chapter 5: Plugins Have Objects
      1. Everything in Minecraft Is an Object
      2. Why Bother Using Objects?
      3. Combine Data and Instructions into Objects
      4. Plugin: PlayerStuff
      5. Next Up
      6. Your Growing Toolbox
    12. Chapter 6: Add a Chat Command, Locations, and Targets
      1. How Does Minecraft Know About Your Plugin?
      2. Plugin: SkyCmd
      3. Handle Chat Commands
      4. Use Minecraft Coordinates
      5. Find Nearby Blocks or Entities
      6. Plugin: LavaVision
      7. Next Up
      8. Your Growing Toolbox
    13. Chapter 7: Use Piles of Variables: Arrays
      1. Variables and Objects Live in Blocks
      2. Plugin: CakeTower
      3. Use a Java Array
      4. Plugin: ArrayOfBlocks
      5. Use a Java ArrayList
      6. Plugin: ArrayAddMoreBlocks
      7. Next Up
      8. Your Growing Toolbox
    14. Chapter 8: Use Piles of Variables: HashMap
      1. Use a Java HashMap
      2. Keep Things Private or Make Them Public
      3. Plugin: NamedSigns
      4. Next Up
      5. Your Growing Toolbox
    15. Chapter 9: Modify, Spawn, and Listen in Minecraft
      1. Modify Blocks
      2. Plugin: Stuck
      3. Modify Entities
      4. Spawn Entities
      5. Plugin: FlyingCreeper
      6. Listen for Events
      7. Plugin: BackCmd
      8. Check Permissions
      9. Next Up
      10. Your Growing Toolbox
    16. Chapter 10: Schedule Tasks for Later
      1. What Happens When?
      2. Put Code in a Class by Itself
      3. Make a Runnable Task
      4. Schedule to Run Later
      5. Schedule to Run Once, or Keep Running
      6. Plugin: CowShooter
      7. Next Up
      8. Your Growing Toolbox
    17. Chapter 11: Use Configuration Files and Store Game Data
      1. Use a Configuration File
      2. Plugin: SquidBombConfig
      3. Store Game Data in a Database
      4. Plugin: LocationSnapshot
      5. Plugin: BackCmd with Save
      6. Next Up
      7. Your Growing Toolbox
    18. Chapter 12: Keep Your Code Safe
      1. Install Git
      2. Remember Changes
      3. An Easy Undo
      4. Visit Multiple Realities
      5. Back Up to the Cloud
      6. Share Code
      7. Next Up
      8. Your Growing Toolbox
    19. Chapter 13: Design Your Own Plugin
      1. Have an Idea
      2. Gather Your Materials
      3. Lay Them Out
      4. Try Each Part
      5. Knit It All Together
      6. Your Full Toolbox!
      7. Just the Beginning
    20. Appendix 1: How to Read Error Messages
      1. Java-Compiler Error Messages
      2. Canary Server Error Messages
    21. Appendix 2: How to Read the Canary Documentation
      1. Canary JavaDoc Documentation
      2. Oracle JavaDoc Documentation
      3. The Wiki and Tutorials
    22. Appendix 3: How to Install a Desktop Server
      1. The Easy Way: LogMeIn
      2. The Harder Way: By Hand
    23. Appendix 4: How to Install a Cloud Server
      1. What Is the Cloud?
      2. Remote Operating Systems
      3. Remote Access
      4. Installing Packages
      5. Installing Java
      6. Running Remotely
      7. Domain Name
      8. What’s Next
    24. Appendix 5: Cheat Sheets
      1. Java Language
    25. Appendix 6: Glossary
    26. Appendix 7: Common Imports
    27. Bibliography
      1. You May Be Interested In…