tutorial:events
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:events [2020/06/09 23:16] – formatting changes draylar | tutorial:events [2025/12/29 07:00] (current) – gauntrecluse | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~REDIRECT> | ||
| + | |||
| ====== Custom Events ====== | ====== Custom Events ====== | ||
| Fabric API provides a system that allows mods to react to events that occur in the game. Events are hooks that satisfy common use cases and/or provide enhanced compatibility and performance between mods that hook into the same areas of the code. The use of events often substitutes the use of mixins. Fabric API provides events for important areas in the Minecraft codebase that multiple modders may be interested in hooking into. Some areas do not have hooks, so you can opt to use a mixin, or create your own event. | Fabric API provides a system that allows mods to react to events that occur in the game. Events are hooks that satisfy common use cases and/or provide enhanced compatibility and performance between mods that hook into the same areas of the code. The use of events often substitutes the use of mixins. Fabric API provides events for important areas in the Minecraft codebase that multiple modders may be interested in hooking into. Some areas do not have hooks, so you can opt to use a mixin, or create your own event. | ||
| Line 37: | Line 39: | ||
| <code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
| (listeners) -> (player, sheep) -> { | (listeners) -> (player, sheep) -> { | ||
| - | for (SheepShearCallback | + | for (SheepShearCallback |
| </ | </ | ||
| We then call our method (in this case, '' | We then call our method (in this case, '' | ||
| <code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
| - | ActionResult result = event.interact(player, | + | ActionResult result = listener.interact(player, |
| </ | </ | ||
| If the listener says we have to cancel ('' | If the listener says we have to cancel ('' | ||
tutorial/events.1591744571.txt.gz · Last modified: 2020/06/09 23:16 by draylar