O'Reilly logo

Minecraft Mods Programming Absolute Beginner’s Guide by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

24. Respond to Events in the Game

In This Chapter

Turn a mod’s functionality on and off

Create a mod that listens to events

Run code the first time a server loads a mod

Access the server and server’s mod manager

Use the this keyword in a Java class

Listen every time a player moves in Minecraft

Find the block below a player’s location

Mods can do something once when a command is entered by a player. Enter a /choptrees command and chop down a forest of trees.

Mods can do something that affects game play for a sustained time. Enter /petwolf multiple times and attract a pack of wolves who come to your defense whenever mobs attack.

Mods also can do nothing.

The mod you create during this chapter does nothing until an event happens ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required