Plugin: CowShooter

Now we have enough parts to make a really fun plugin: the CowShooter. If you have a piece of leather in your hand in the game world, you can click to shoot a flaming cow out into the world. When the cow hits the ground, it will explode in a ball of flame, fire, and hamburger.

This plugin is a little different from what we’ve seen so far; there’s no @Command section at all. It’s driven entirely by events.

One problem with a flaming cow is that it won’t stay flaming forever, or even for very long. Normally a flaming cow will catch fire, then the cow dies and the fire goes out. That’s not quite suitable for our purposes: we need the cow to stay on fire as long as it’s flying through the air.

To make that happen, we’ll schedule ...

Get Learn to Program with Minecraft Plugins, 2nd Edition 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.