jumm
i just folow this http://www.minecraftforge.net/wiki/Key_Binding
soo in mi folder forge-1.8-11.14.0.1261-1.8-src/src/main/java/mercenarymod/utilidades/
i create
//KeyBindings.java
//__________________________________________________________
package mercenarymod.utilidades;
import org.lwjgl.input.Keyboard;
//import net.java.games.input.Keyboard;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.registry.ClientRegistry;
public class KeyBindings {
// Declare two KeyBindings, ping and pong
public static KeyBinding ping;
public static KeyBinding pong;
public static void init() {
// Define the "ping" binding, with (unlocalized) name "key.ping" and
// the category with (unlocalized) name "key.categories.mymod" and
// key code 24 ("O", LWJGL constant: Keyboard.KEY_O)
ping = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.MercenaryMod");
// Define the "pong" binding, with (unlocalized) name "key.pong" and
// the category with (unlocalized) name "key.categories.mymod" and
// key code 25 ("P", LWJGL constant: Keyboard.KEY_P)
pong = new KeyBinding("key.pong", Keyboard.KEY_P, "key.categories.MercenaryMod");
// Register both KeyBindings to the ClientRegistry
ClientRegistry.registerKeyBinding(ping);
ClientRegistry.registerKeyBinding(pong);
}
}
//_____________________________________________________________
//and create too
//KeyInputHandler.java
//_____________________________________________________________
package mercenarymod.utilidades;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
//import cpw.mods.fml.common.eventhandler.SubscribeEvent;
//import cpw.mods.fml.common.gameevent.InputEvent;
public class KeyInputHandler {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if(KeyBindings.ping.isPressed())
System.out.println("ping");
if(KeyBindings.pong.isPressed())
System.out.println("pong");
}
}
//_____________________________________________________________
¿but where the fucks goes this line?
FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyBindings());
putit in preinit, noting happen when press 'p' or 'o' nothing in the controls menu
putit in init, noting happen when press 'p' or 'o' nothing in the controls menu
putit in postinit, noting happen when press 'p' or 'o' nothing in the controls menu
all the code seems to be rigth in eclipse.