small medium large xlarge

Learn to Program with Minecraft Plugins (2nd edition): Create Flaming Cows in Java Using CanaryMod


Cover image for Learn to Program with Minecraft Plugins

Learn to Program with Minecraft Plugins (2nd edition)

Create Flaming Cows in Java Using CanaryMod


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.

Printed in full color.

This new edition has been completely revised to replace Bukkit with the CanaryMod library. The first edition of this book used the Bukkit modding server and library, but Bukkit was taken down due to a legal dispute in September 2014.

Customer Reviews

A handful of boilerplate and about five lines of custom code, and suddenly, exploding
arrows! All of a sudden, doing something cool in the context of a fully realized
3D game engine is very easy. And that’s how programming has to be learned…in
easy, bite-sized chunks.

- Carl Cravens

Linux system architect and Minecraft dad

Learn to Program with Minecraft Plugins explains things very well—no programming
experience required. It’s very helpful for new programmers. And so far, it’s been
an excellent vehicle for some quality father-son bonding.

- Mel Riffe, Minecraft dad, and Noah Riffe, age 12

Phenomenal. Approachable and simple, without talking down to the audience. I
could see anyone at any age reading this.

- David Bock, age 44

Well, first off, this is a wonderful book. The way it is written is amazing. I am
learning BASH and Java! I’ve tried to learn BASH, but all the other books I’ve
found are just way too hard. Not only that, but modding Minecraft while running
a server? EPIC! Thank you for writing this book!

- Jack H., age 13

I really liked making the server plugins. My favorite was the cow shooter.

- Jonathan Knowles, age 13

Go, you—this book is awesome!

- Stina Qvarnström

Developer, Book Noridc AB, Sweden


- A creeper

See All Reviews

What You Need

A modern PC running the Windows, Mac OS X, or Linux operating systems. The book explains how to download Java, the CanaryMod server and API, and all the tools you’ll need.

Please note that the first edition of this book used the Bukkit library, which became unavailable as of September, 2014.

User Level

Contents & Extracts

  • Start Here
    • Who This Book Is For
    • Getting Started
    • Swimming in the Deep End
    • Getting Help
    • Conventions
  • Command Your Computer
    • Use the Command Line
    • Move around in File Directories
    • Start at the Desktop
    • Common Commands
    • Next Up
  • Add an Editor and Java
    • Install an Editor to Write Code
    • Install the Java Programming Language
    • If the Java Command Is Not Found
    • Other Reasons It Might Not Work
    • Install the Minecraft Client and Server
    • Next Up
  • Build and Install a Plugin excerpt
    • Plugin: HelloWorld
    • Configure with Canary.inf
    • Build and Install with
    • Next Up
  • Plugins Have Variables, Functions, and Keywords
    • Keep Track of Data with Variables
    • Plugin: BuildAHouse
    • Plugin: Simple
    • Organize Instructions into Functions excerpt
    • Use a for Loop to Repeat Code
    • Use an if Statement to Make Decisions
    • Compare Stuff with Boolean Conditions
    • Use a while Loop to Repeat Based on a Condition
    • Next Up
  • Plugins Have Objects
    • Everything in Minecraft Is an Object
    • Why Bother Using Objects?
    • Combine Data and Instructions into Objects
    • Plugin: PlayerStuff
    • Next Up
  • Add a Chat Command, Locations, and Targets excerpt
    • How Does Minecraft Know About Your Plugin?
    • Plugin: SkyCmd
    • Handle Chat Commands
    • Use Minecraft Coordinates
    • Find Nearby Blocks or Entities
    • Plugin: LavaVision
    • Next Up
  • Use Piles of Variables: Arrays
    • Variables and Objects Live in Blocks
    • Plugin: CakeTower
    • Use a Java Array
    • Plugin: ArrayOfBlocks
    • Use a Java ArrayList
    • Plugin: ArrayAddMoreBlocks
    • Next Up
  • Use Piles of Variables: HashMap
    • Use a Java HashMap
    • Keep Things Private or Make Them Public
    • Plugin: NamedSigns
    • Next Up
  • Modify, Spawn, and Listen in Minecraft excerpt
    • Modify Blocks
    • Plugin: Stuck
    • Modify Entities
    • Spawn Entities
    • Plugin: FlyingCreeper
    • Listen for Events
    • Plugin: BackCmd
    • Check Permissions
    • Next Up
  • Schedule Tasks for Later
    • What Happens When?
    • Put Code in a Class by Itself
    • Make a Runnable Task
    • Schedule to Run Later
    • Schedule to Run Once, or Keep Running
    • Plugin: CowShooter
    • Next Up
  • Use Configuration Files and Store Game Data
    • Use a Configuration File
    • Plugin: SquidBombConfig
    • Store Game Data in a Database
    • Plugin: LocationSnapshot
    • Plugin: BackCmd with Save
    • Next Up
  • Keep Your Code Safe
    • Install Git
    • Remember Changes
    • An Easy Undo
    • Visit Multiple Realities
    • Back Up to the Cloud
    • Share Code
    • Next Up
  • How to Read Error Messages
    • Java-Compiler Error Messages
    • Canary Server Error Messages
  • How to Read the Canary Documentation
    • Canary JavaDoc Documentation
    • Oracle JavaDoc Documentation
    • The Wiki and Tutorials
  • How to Install a Desktop Server
    • The Easy Way: LogMeIn
    • The Harder Way: By Hand
  • How to Install a Cloud Server
    • What Is the Cloud?
    • Remote Operating Systems
    • Remote Access
    • Installing Packages
    • Installing Java
    • Running Remotely
    • Domain Name
    • What’s Next
  • Cheat Sheets
    • Java Language
  • Glossary
  • Common Imports


Andy Hunt has written and co-written a half-dozen previous titles, including the classic The Pragmatic Programmer, Practices of an Agile Developer, and Pragmatic Thinking & Learning, and regularly speaks at conferences on software development around the world. He used Minecraft to help teach his son programming. When not wrangling bits, he’s an avid musician and sometimes woodworker.