zh_cn:tutorial:callbacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
zh_cn:tutorial:callbacks [2021/09/17 00:38] – [Fabric API 事件] solidblock | zh_cn:tutorial:callbacks [2021/10/23 02:04] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== 事件 ===== | ===== 事件 ===== | ||
- | Events are represented by instances of '' | + | 事件是用存储并调用回调的 |
===== 回调 ===== | ===== 回调 ===== | ||
- | Each event has a corresponding callback interface, conventionally named '' | + | 每个事件都有对应的回调接口,通常命名为 |
==== Fabric API 中的回调接口 ==== | ==== Fabric API 中的回调接口 ==== | ||
- | All event callback interfaces provided by Fabric API can be found in the '' | + | Fabric API 提供的所有事件回调接口可以在 |
- | A partial list of existing callbacks is provided at the bottom of this tutorial. | + | |
==== 自定义回调 ==== | ==== 自定义回调 ==== | ||
- | Although there are plenty of events already provided by Fabric API, you can still make your own events. Please refer to [[tutorial: | + | 虽然 |
===== 实例 ====== | ===== 实例 ====== | ||
- | This example registers an '' | + | 此例注册一个 |
< | < | ||
public class ExampleMod implements ModInitializer | public class ExampleMod implements ModInitializer | ||
Line 31: | Line 27: | ||
{ | { | ||
class_2680 state = world.method_8320(pos); | class_2680 state = world.method_8320(pos); | ||
- | /* Manual spectator check is necessary because | + | /* 手动的旁观者检查是必要的,因为 |
- | fire before the spectator check */ | + | |
if (state.method_29291() && !player.method_7325() && | if (state.method_29291() && !player.method_7325() && | ||
player.method_6047().method_7960()) | player.method_6047().method_7960()) |
zh_cn/tutorial/callbacks.txt · Last modified: 2023/05/04 11:01 by solidblock