tutorial:callbacks
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
tutorial:callbacks [2020/02/17 09:29] – created mkpoli | tutorial:callbacks [2020/02/17 18:26] – accept suggestions from @JamiesWhiteShirt et al. at Discord (renaming) & Add events mkpoli | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Register a Callback | + | ====== Register a Callback |
+ | In this tutorial, you are going to achieve: | ||
+ | - Understand Events and Callbacks | ||
+ | - Be able to register a Callback on an existing Event | ||
- | ===== Callbacks Classes | + | ===== Callback Interfaces |
- | Callbacks Classes are a series of Classes which named [Eventname]Callback | + | There is a series of interfaces |
- | ==== Callbacks | + | ==== Callback Interfaces |
Event Callbacks provided by Fabric API can be found in '' | Event Callbacks provided by Fabric API can be found in '' | ||
- | A list of existing callbacks | + | Here is a partial |
=== Player Interactive Events === | === Player Interactive Events === | ||
Line 16: | Line 18: | ||
=== Registry Events === | === Registry Events === | ||
- | <!-- TODO: Add Events | + | [[https:// |
- | === Looting Events === | + | [[https:// |
- | <!-- TODO: Add Events | + | |
=== Looting Events === | === Looting Events === | ||
- | <!-- TODO: Add Events | + | [[https:// |
- | + | ||
- | === Render Events === | + | |
- | <!-- TODO: Add Events --> | + | |
There is an example using '' | There is an example using '' | ||
+ | === World Events === | ||
+ | [[https:// | ||
+ | === Server Events === | ||
+ | [[https:// | ||
+ | |||
+ | === Network Events === | ||
+ | [[https:// | ||
==== Custom Callbacks ==== | ==== Custom Callbacks ==== | ||
- | Although there is plenty of Callbacks | + | Although there are plenty of events already |
+ | ===== Practice ====== | ||
+ | <!-- TODO: Add explaination --> | ||
- | ===== Practice ===== | ||
Let's see Take '' | Let's see Take '' | ||
+ | |||
+ | Basically, we are going to ... (an event listener) callback to listen the event. | ||
Since there is not more a method that is able to be called on a block clicked, you may want to. If you want to make a ; | Since there is not more a method that is able to be called on a block clicked, you may want to. If you want to make a ; | ||
- | You can interrupt and stop continuing by sending ActionResult.SUCCESS; | ||
+ | As stated in javadoc of '' | ||
- | As stated in javadoc of '' | + | < |
- | + | ||
- | < | + | |
/** | /** | ||
* Callback for left-clicking (" | * Callback for left-clicking (" | ||
Line 58: | Line 64: | ||
*/ | */ | ||
</ | </ | ||
+ | |||
+ | <!-- TODO: Really do sth. --> | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
Line 78: | Line 86: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | <!-- TODO: An image of the effect of something have done --> | ||
tutorial/callbacks.txt · Last modified: 2023/05/04 11:01 by solidblock