Jump to content

Key Bindings in 1.7.2


Recommended Posts

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() {

public void KeyInputEvent(KeyInputEvent event) {
	if(stats.func_151468_f()) {
		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());


Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.