drafts:new_mixin_example
Playground
Possible addition to Mixin Examples External Link
Modifying a static block
static { int i = 4; }
public class ExampleMod implements ModInitializer { [...] @Override public void onInitialize() { AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { BlockState state = world.getBlockState(pos); /* Manual spectator check is necessary because AttackBlockCallbacks fire before the spectator check */ if (state.isToolRequired() && !player.isSpectator() && player.getMainHandStack().isEmpty()) { player.damage(player.getDamageSources().generic(), 1.0F); } return ActionResult.PASS; }); } }
drafts/new_mixin_example.txt · Last modified: 2023/09/13 18:46 by nebelnidas