Jump to content

Multiple Keybinding Issues


pogo4545

Recommended Posts

So I am having issues with more then 1 key bind. Below is my code


package com.lcsurvival.pogo4545.toolkit;

import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.server.management.PlayerManager;
import net.minecraft.src.ModLoader;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;

public class KeyBindingHandler extends KeyHandler{

public static KeyBinding login = new KeyBinding("Login", Keyboard.KEY_L);
public static KeyBinding fkjoin = new KeyBinding("1", Keyboard.KEY_J);
//public static KeyBinding login = new KeyBinding("Login", Keyboard.KEY_L);
//public static KeyBinding login = new KeyBinding("Login", Keyboard.KEY_L);
//public static KeyBinding login = new KeyBinding("Login", Keyboard.KEY_L);


public static KeyBinding[] arrayOfKeys = new KeyBinding[] {login};
public static boolean[] areRepeating = new boolean[] {false};

public KeyBindingHandler() {
super(arrayOfKeys, areRepeating);
}
@Override
public String getLabel() {
return "LCTK KeyBindings";
}
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
if (tickEnd) {
if(kb.keyCode == login.keyCode) {
LoginSystem.loginInit();
}

if (kb.keyCode == fkjoin.keyCode)//J
{
CommandHandler.fakeJoin();
}
}
}
@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {

}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT);
}

}

 

Whenever I try to add another keybind (fkjoin) like this

public static KeyBinding[] arrayOfKeys = new KeyBinding[] {login, fkjoin};
public static boolean[] areRepeating = new boolean[] {false};

 

login works but fkjoin doesn't. Anyone know what I am doing wrong? Is it in the wrong spot or something?

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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