11package com .example .mod ;
22
3- import club .maxstats .weave .loader .api .HookManager ;
43import club .maxstats .weave .loader .api .ModInitializer ;
4+ import club .maxstats .weave .loader .api .HookManager ;
55import club .maxstats .weave .loader .api .event .EventBus ;
6- import club .maxstats .weave .loader .api .event .annotation .SubscribeEvent ;
7- import club .maxstats .weave .loader .api .event .impl .InputEvent ;
6+ import club .maxstats .weave .loader .api .event .InputEvent ;
7+ import club .maxstats .weave .loader .api .event .SubscribeEvent ;
8+ import club .maxstats .weave .loader .util .ExtensionsKt ;
9+ import kotlin .Unit ;
10+ import net .minecraft .client .Minecraft ;
11+ import net .minecraft .util .ChatComponentText ;
812import org .jetbrains .annotations .NotNull ;
13+ import org .lwjgl .input .Keyboard ;
914import org .objectweb .asm .Opcodes ;
1015import org .objectweb .asm .Type ;
1116import org .objectweb .asm .tree .MethodInsnNode ;
@@ -27,15 +32,13 @@ public void preinit(@NotNull HookManager hookManager) {
2732 );
2833 });
2934
30- EventBus .INSTANCE .subscribe (this );
31- }
32-
33- @ SubscribeEvent
34- public void onInput (InputEvent e ) {
35- System .out .println ("Pressed: " + e .getKeycode ());
35+ EventBus .INSTANCE .subscribe (InputEvent .class , e -> {
36+ Minecraft .getMinecraft ().thePlayer .addChatMessage (
37+ new ChatComponentText ("Pressed: " + Keyboard .getKeyName (e .getKeyCode ()))
38+ );
39+ });
3640 }
37-
3841 public static void onStart () {
3942 System .out .println ("Hello World from Minecraft#startGame" );
4043 }
41- }
44+ }
0 commit comments