Posted January 9, 20214 yr For some reason, the console doesnt print anything @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { System.out.println("Hello"); }
January 9, 20214 yr Author 37 minutes ago, Klarks said: For some reason, the console doesnt print anything @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { System.out.println("Hello"); }
January 9, 20214 yr Author MinecraftForge.EVENT_BUS.register(PlayerCapa.class); public class PlayerCapa { @SubscribeEvent (priority = EventPriority.LOWEST) public static void onClientTick(TickEvent.ClientTickEvent event) { } } Edited January 9, 20214 yr by Klarks
January 9, 20214 yr Author I use that way now //edited @Mod.EventBusSubscriber(modid = Main.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ClientEventBusSubscriber { public static final KeyBinding TEST = new KeyBinding("key.structure.desc", GLFW.GLFW_KEY_R, "key.magicbeans.category"); private static Field KEYBIND_ARRAY = null; @SubscribeEvent (priority = EventPriority.LOWEST) public static void onClientTick(TickEvent.ClientTickEvent event) throws Exception { if(KEYBIND_ARRAY == null){ KEYBIND_ARRAY = KeyBinding.class.getDeclaredField("KEYBIND_ARRAY"); KEYBIND_ARRAY.setAccessible(true); } if(event.phase.equals(TickEvent.Phase.END)){ Map<String, KeyBinding> binds = (Map<String, KeyBinding>) KEYBIND_ARRAY.get(null); for (String bind : binds.keySet()) { if(binds.get(bind).isKeyDown() && (binds.get(bind) == TEST)){ System.out.println("R"); break; } } } } } Edited January 9, 20214 yr by Klarks
January 9, 20214 yr Author I was rewriting my code and have not tested this event yet so I didn't know but will know
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.