User Tools

Site Tools


tutorial:callbacks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tutorial:callbacks [2021/07/26 23:00] – Typo daomephstatutorial:callbacks [2023/05/04 11:01] (current) – [Practice] solidblock
Line 21: Line 21:
  
 <yarncode java [enable_line_numbers="true"]> <yarncode java [enable_line_numbers="true"]>
-public class ExampleMod implements ModInitializer +public class ExampleMod implements ModInitializer {
-{+
     [...]     [...]
          
     @Override     @Override
-    public void onInitialize()  +    public void onInitialize() { 
-    +        AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> {
-        AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) ->  +
-        {+
             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, 1.0F);                 player.method_5643(class_1282.field_5869, 1.0F);
             }              } 
tutorial/callbacks.1627340422.txt.gz · Last modified: 2021/07/26 23:00 by daomephsta