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 ...
Get Absolute Beginner’s Guide to Minecraft® Mods Programming, Second 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.