Understand and Use the NeoForge Event System
What Are Events?
NeoForge's event system allows mods to react to things happening in the game—player actions, block changes, entity spawning, and more. Events are the foundation for mod functionality.
Common Event Types
Events fire at different moments:
- Player events: Login, inventory changes, damage taken
- World events: Block placement, block breaking, chunk loading
- Entity events: Spawning, death, interaction
- Tick events: Every game tick (20 per second)
How Mods Use Events
When an event occurs, NeoForge notifies all listening mods. Each mod can then:
1. Check if the event matches what it's looking for
2. Read information from the event (what block was broken, which player, etc.)
3. Perform actions (spawn particles, modify items, cancel the event)
4. Optionally cancel the event to prevent the default behavior
For Players
You don't directly interact with events, but understanding them helps explain mod behavior. If a mod prevents something from happening or triggers something unexpected, it's likely responding to an event.