Java Code Examples for cpw.mods.fml.common.gameevent.InputEvent#KeyInputEvent

The following examples show how to use cpw.mods.fml.common.gameevent.InputEvent#KeyInputEvent . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyInputHandler.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event){
    Keybindings key = getPressedKey();
    if(key != null) {
        switch(key){
            case EXPLODE:
                NetworkHandler.sendToServer(new MessageExplode(3));
                break;
            case EXPLODE_BIG:
                NetworkHandler.sendToServer(new MessageExplode(30));
                break;
        }
    }
}
 
Example 2
Source File: GuiKeybindCheckBox.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event){
    Minecraft mc = FMLClientHandler.instance().getClient();
    if(mc.inGameHasFocus && keyBinding != null && keyBinding.isPressed()) {
        onMouseClicked(0, 0, 0);
        HUDHandler.instance().addMessage(I18n.format("pneumaticHelmet.message." + (checked ? "enable" : "disable") + "Setting", I18n.format(text)), new ArrayList<String>(), 60, 0x7000AA00);
    }
}
 
Example 3
Source File: MwKeyHandler.java    From mapwriter with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onKeyPress(InputEvent.KeyInputEvent event){
    if(keyMapGui.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyMapGui.getKeyCode(), false);
        Mw.instance.onKeyDown(keyMapGui);
    }
    if(keyNewMarker.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyNewMarker.getKeyCode(), false);
        Mw.instance.onKeyDown(keyNewMarker);
    }
    if(keyMapMode.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyMapMode.getKeyCode(), false);
        Mw.instance.onKeyDown(keyMapMode);
    }
    if(keyNextGroup.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyNextGroup.getKeyCode(), false);
        Mw.instance.onKeyDown(keyNextGroup);
    }
    if(keyTeleport.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyTeleport.getKeyCode(), false);
        Mw.instance.onKeyDown(keyTeleport);
    }
    if(keyZoomIn.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyZoomIn.getKeyCode(), false);
        Mw.instance.onKeyDown(keyZoomIn);
    }
    if(keyZoomOut.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyZoomOut.getKeyCode(), false);
        Mw.instance.onKeyDown(keyZoomOut);
    }
    if(keyUndergroundMode.getIsKeyPressed()){
        KeyBinding.setKeyBindState(keyUndergroundMode.getKeyCode(), false);
        Mw.instance.onKeyDown(keyUndergroundMode);
    }
}
 
Example 4
Source File: KeyInputEventHandler.java    From LetsModReboot with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
{
    LogHelper.info(getPressedKeybinding());
}
 
Example 5
Source File: ShipKeyHandler.java    From archimedes-ships with MIT License 4 votes vote down vote up
@SubscribeEvent
public void keyPress(InputEvent.KeyInputEvent e)
{
}