Posted January 29, 201411 yr I've looked on some threads, and I've got this code: package net.rpg.handler; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.rpg.RPG; import org.lwjgl.input.Keyboard; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; public class KeyHandler { private KeyBinding stats = new KeyBinding("Stats", Keyboard.KEY_F, "RPG"); public KeyHandler() { ClientRegistry.registerKeyBinding(stats); } @SubscribeEvent public void KeyInputEvent(KeyInputEvent event) { System.out.println("1"); if(stats.func_151468_f()) { System.out.println("2"); if(Minecraft.getMinecraft().currentScreen == null) { EntityPlayer p = Minecraft.getMinecraft().thePlayer; p.openGui(RPG.instance, 1, p.worldObj, (int) p.posX, (int) p.posY, (int) p.posZ); } } } } And I've registered it, and the keybinding appears in the menu. The problem is, the event is never called. Am I using the wrong event? Here's my code for registering it: package net.rpg.helper; import net.minecraftforge.common.MinecraftForge; import net.rpg.handler.ClientEventHandler; import net.rpg.handler.KeyHandler; import cpw.mods.fml.common.eventhandler.EventBus; public class ClientEventHelper { public static void init() { EventBus funBus = MinecraftForge.EVENT_BUS; funBus.register(new KeyHandler()); funBus.register(new ClientEventHandler()); } } Kain
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.