tutorial:callbacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:callbacks [2021/07/14 23:33] – Add Fabric API Events heading daomephsta | tutorial:callbacks [2024/12/18 19:41] (current) – [Fabric API Events] Fix outdated server start/stop events radstevee | ||
---|---|---|---|
Line 18: | Line 18: | ||
===== Practice ====== | ===== Practice ====== | ||
- | This example registers an '' | + | This example registers an '' |
< | < | ||
- | public class ExampleMod implements ModInitializer | + | public class ExampleMod implements ModInitializer { |
- | { | + | |
[...] | [...] | ||
| | ||
@Override | @Override | ||
- | public void onInitialize() | + | public void onInitialize() { |
- | | + | AttackBlockCallback.EVENT.register((player, |
- | AttackBlockCallback.EVENT.register((player, | + | |
- | | + | |
class_2680 state = world.method_8320(pos); | class_2680 state = world.method_8320(pos); | ||
/* Manual spectator check is necessary because AttackBlockCallbacks | /* Manual spectator check is necessary because AttackBlockCallbacks | ||
fire before the spectator check */ | 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()) { |
- | | + | |
player.method_5643(class_1282.field_5869, | player.method_5643(class_1282.field_5869, | ||
} | } | ||
Line 64: | Line 60: | ||
=== Server Events === | === Server Events === | ||
- | [[https:// | + | [[https:// |
=== Network Events === | === Network Events === | ||
[[https:// | [[https:// | ||
+ | |||
+ | See [[tutorial: |
tutorial/callbacks.1626305609.txt.gz · Last modified: 2021/07/14 23:33 by daomephsta