drafts:new_mixin_example
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| drafts:new_mixin_example [2023/09/13 18:46] – removed - external edit (Unknown date) 127.0.0.1 | drafts:new_mixin_example [2023/09/13 18:46] (current) – ↷ Page moved and renamed from playground:playground to drafts:new_mixin_example nebelnidas | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Playground ====== | ||
| + | Possible addition to [[tutorial: | ||
| + | [[http:// | ||
| + | ===== Modifying a static block ===== | ||
| + | <code diff> | ||
| + | static { | ||
| + | int i = 4; | ||
| + | } | ||
| + | </ | ||
| + | {{ | ||
| + | https:// | ||
| + | }} | ||
| + | |||
| + | < | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | [...] | ||
| + | | ||
| + | @Override | ||
| + | public void onInitialize() { | ||
| + | AttackBlockCallback.EVENT.register((player, | ||
| + | class_2680 state = world.method_8320(pos); | ||
| + | /* Manual spectator check is necessary because AttackBlockCallbacks | ||
| + | fire before the spectator check */ | ||
| + | if (state.method_29291() && !player.method_7325() && | ||
| + | player.method_6047().method_7960()) { | ||
| + | player.method_5643(player.method_48923().method_48830(), | ||
| + | } | ||
| + | return class_1269.field_5811; | ||
| + | }); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | [[ns: | ||