Java 类cpw.mods.fml.common.gameevent.InputEvent 实例源码

项目:Lotr_Mod_Addons    文件:CustomKeyHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    // first check that the player is not using the chat menu
    // you can use this method from before:
    // if (FMLClientHandler.instance().getClient().inGameHasFocus) {
    // or you can use this new one that is available, doesn't really matter
    if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
        // you can get the key code of the key pressed using the Keyboard class:
        int kb = Keyboard.getEventKey();
        // similarly, you can get the key state, but this will always be true when the event is fired:
        boolean isDown = Keyboard.getEventKeyState();

        // same as before, chain if-else if statements to find which of your custom keys
        // was pressed and act accordingly:
        if (kb == keys[CUSTOM_INV].getKeyCode()) {
            EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
            // before you could close the screen from here, but that no longer seems to be
            // possible instead, you need to do so from within the GUI itself
            // so we will just send a packet to open the GUI:
            player.openGui(LOTRRings.instance, UIHandler.PLAYERINVENTORY_UI_1, player.getEntityWorld(), player.chunkCoordX, player.chunkCoordY, player.chunkCoordZ);
        }
    }
}
项目:DynamicCraft    文件:KeyInputHandler.java   
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
    KeyBindings key = getPressedKey();
    if (key != null) {
        switch (key) {
            case MODE:
                if (Minecraft.getMinecraft().thePlayer.getHeldItem() == null || Minecraft.getMinecraft().thePlayer.
                        getHeldItem().getItem() != ItemHandler.fireWand)
                    return;

                ItemStack w = Minecraft.getMinecraft().thePlayer.getHeldItem();

                if (ItemHelper.getString(w, "mode", "PROJECTILE").equals("PROJECTILE")) {
                    NetworkHandler.sendToServer(new MessageModeWand("mode", "FIRE"));
                    Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GRAY +
                            "Fire Mode enabled!"));
                } else if (ItemHelper.getString(w, "mode", "PROJECTILE").equals("FIRE")) {
                    NetworkHandler.sendToServer(new MessageModeWand("mode", "PROJECTILE"));
                    Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GRAY +
                            "Projectile Mode enabled!"));
                }
                break;
        }
    }
}
项目:TFC-Additions    文件:KeyBindingHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    PlayerInfo pi = PlayerManagerTFC.getInstance().getClientPlayer();
    EntityClientPlayerMP player = FMLClientHandler.instance().getClient().thePlayer;

    if (FMLClientHandler.instance().getClient().inGameHasFocus &&
            FMLClientHandler.instance().getClient().thePlayer.getCurrentEquippedItem() != null &&
            FMLClientHandler.instance().getClient().currentScreen == null) {
        if (Key_PrevChiselMode.isPressed()) {
            if (player.getCurrentEquippedItem().getItem() instanceof ItemChisel) {
                pi.setChiselMode(prevChiselMode(pi));
                //Let's send the actual ChiselMode so the server/client does not
                //come out of sync.
                AbstractPacket pkt = new KeyPressPacket(pi.chiselMode);
                TerraFirmaCraft.PACKET_PIPELINE.sendToServer(pkt);

            }
        }
    }
}
项目:MacroMaker    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    if (Keybindings.openGui.isPressed())
        Minecraft.getMinecraft().thePlayer.openGui(MacroMaker.instance, Reference.Guis.WAYPOINT.ordinal(), Minecraft.getMinecraft().thePlayer.worldObj, (int)Minecraft.getMinecraft().thePlayer.posX, (int)Minecraft.getMinecraft().thePlayer.posY, (int)Minecraft.getMinecraft().thePlayer.posZ);
    else if (Keybindings.macro.isPressed())
        Minecraft.getMinecraft().thePlayer.openGui(MacroMaker.instance, Reference.Guis.MACRO.ordinal(), Minecraft.getMinecraft().thePlayer.worldObj, (int)Minecraft.getMinecraft().thePlayer.posX, (int)Minecraft.getMinecraft().thePlayer.posY, (int)Minecraft.getMinecraft().thePlayer.posZ);
    else if (Keybindings.activateMacros.isPressed())
        TickHandler.isMacroInUse = !TickHandler.isMacroInUse;
    if (Config.showKeysOnHUD) {
        if (Keyboard.getEventKeyState())
            try {
                KeyOverlay.keys.offer(new Object[]{Keyboard.getKeyName(Keyboard.getEventKey()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
            } catch (Exception e) {
                e.printStackTrace();
            }
    }
}
项目:TheDarkEra    文件:KeyHandler.java   
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
    if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
        Minecraft mc = Minecraft.getMinecraft();
        EntityPlayer thePlayer = mc.getMinecraft().thePlayer;
        ItemStack hand = thePlayer.getCurrentEquippedItem();
        ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) thePlayer);
        int x = mc.objectMouseOver.blockX;
        int y = mc.objectMouseOver.blockY;
        int z = mc.objectMouseOver.blockZ;
        if (Mouse.isButtonDown(1) && hand == null)
            props.useMana(10);
        // TheDarkEra.packetPipeline.sendToServer(new PacketUseShout(x, y,
        // z));
    }
}
项目:TectoCraft    文件:KeyInputHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {

    /**if(KeyBindings.fly.isPressed()){
        Jetpack.canFly = true;
        Minecraft.getMinecraft().thePlayer.setJumping(true);
    }else{
        Jetpack.canFly = false;
    }

    */
    if(KeyBindings.refuel.isPressed()){
        Jetpack.refuel = true;
        }
        else{
            Jetpack.refuel = false;
        }
}
项目:mcpvp-mod    文件:HandleKey.java   
public static void onKey(@SuppressWarnings("unused") InputEvent.KeyInputEvent event) {

        // Support for dropping stacks of items on a Mac.
        if (Main.mc.gameSettings.keyBindDrop.isPressed())
            Main.mc.thePlayer.dropOneItem(lastKeyIsCMD);
        lastKeyIsCMD = Main.cmdMac.isPressed();

        if(Main.openConfig.isPressed())
            openConfigScreen();

        if (Main.moveBlocks.isPressed())
            Main.mc.displayGuiScreen(new GuiEditHUD(Main.mc.currentScreen));

        if (Main.showHelp.isPressed())
            Tutorial.build();

    }
项目:MateriaMuto    文件:KeyInputEventHandler.java   
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
    LibKey keyPress = getPressedKey();

    if (keyPress == LibKey.UNKNOWN) {
        return;
    }

    if (FMLClientHandler.instance().getClient().inGameHasFocus) {
        if (FMLClientHandler.instance().getClientPlayerEntity() != null) {
            EntityPlayer entityPlayer = FMLClientHandler.instance().getClientPlayerEntity();
            if (entityPlayer.getCurrentEquippedItem() != null) {
                ItemStack currentEquppedItem = entityPlayer.getCurrentEquippedItem();
                if (currentEquppedItem.getItem() instanceof IKeyBound) {
                    if (entityPlayer.worldObj.isRemote) {
                        PacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(keyPress));
                    }
                }
            }
        }
    }
}
项目:Quantum-Energistics-2    文件:KeyInputEventHandler.java   
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
    if (FMLClientHandler.instance().getClient().inGameHasFocus) {

        if (FMLClientHandler.instance().getClientPlayerEntity() != null) {
            EntityPlayer entityPlayer = FMLClientHandler.instance().getClientPlayerEntity();

            if (entityPlayer.getCurrentEquippedItem() != null) {
                ItemStack currentlyEquippedItemStack = entityPlayer.getCurrentEquippedItem();

                if (currentlyEquippedItemStack.getItem() instanceof IKeyBound) {
                    if (entityPlayer.worldObj.isRemote) {
                        PacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(getPressedKeybinding()));
                    } else {
                        ((IKeyBound) currentlyEquippedItemStack.getItem()).doKeyBindingAction(entityPlayer, currentlyEquippedItemStack, getPressedKeybinding());
                    }
                }
            }
        }
    }
}
项目:The-Derpy-Shiz-Mod    文件:DerpyKeys.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onKeyPressed(InputEvent.KeyInputEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
        return;
    if (mode.isPressed()) {
        Main.derpnet.sendToServer(new ItemModeMessage());
    }
    if (action.isPressed()) {
        Main.derpnet.sendToServer(new SpecialActionMessage());
        if (!MinecraftForge.EVENT_BUS.post(new SpecialActionEvent(player))) {
            ItemStack stack = player.getHeldItem();
            if (stack != null && stack.getItem() instanceof ISpecialActionItem) {
                ((ISpecialActionItem) stack.getItem()).specialAction(stack, player, true);
            }
        }
    }
}
项目:projectzulu1.7.10    文件:KeyHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
     if(Minecraft.getMinecraft().inGameHasFocus) {
           if(Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed())
  {
          message = new PZPacketKeyBind().setPacketData("jump", 90);
          ProjectZulu_Core.packetHandler.sendToServer(message);
      }
           if(Minecraft.getMinecraft().gameSettings.keyBindInventory.getIsKeyPressed()){
                message = new PZPacketKeyBind().setPacketData("inventory", 0); 
                ProjectZulu_Core.packetHandler.sendToServer(message);
            }
           if(Minecraft.getMinecraft().gameSettings.keyBindSneak.getIsKeyPressed()){
            message = new PZPacketKeyBind().setPacketData("dismount", 0); 
            ProjectZulu_Core.packetHandler.sendToServer(message);
        }

 }
}
项目:ClockworkPhase    文件:KeyHandler.java   
@SubscribeEvent
public void handleKeyPress(InputEvent.KeyInputEvent event)
{
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    KeyLib.Keys keyPressed = getKeyPressed();
    if(keyPressed.equals(KeyLib.Keys.MULTITOOL))
    {
        if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemTemporalMultitool)
        {
            ((IKeybindAbility)player.inventory.getCurrentItem().getItem()).useTemporalAbility();
        }

        if(player.inventory.getCurrentItem() != null && NBTHelper.hasTag(player.inventory.getCurrentItem(), NBTTags.TEMPORAL_ITEMS))
        {
            handleMultitoolAbility();
        }
    }
    else if(keyPressed.equals(KeyLib.Keys.TEMPORAL_ABILITY))
    {
        if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof IKeybindAbility)
        {
            ((IKeybindAbility)player.inventory.getCurrentItem().getItem()).useTemporalAbility();
        }
    }
}
项目:CreeperHostGui    文件:EventHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
    if (Config.getInstance().isServerListEnabled() && ((Client) CreeperHost.proxy).openGuiKey.isPressed())
    {
        if (CreeperHost.instance.handledInvite != null)
        {
            CreeperHost.instance.clearToast(false);
            mc.displayGuiScreen(new GuiInvited(CreeperHost.instance.handledInvite, mc.currentScreen));
            CreeperHost.instance.handledInvite = null;
        }
        else
            CreeperHost.proxy.openFriendsGui();
    }
}
项目:bit-client    文件:KeypressEventDispatcher.java   
@Override
public void invoke(Event e) {
    InputEvent.KeyInputEvent event = (InputEvent.KeyInputEvent) e;
    if (!Keyboard.getEventKeyState()) return;
    if (Keyboard.getEventKey() == Keyboard.KEY_NONE) return;
    new KeypressEvent(Keyboard.getEventKey()).call();
}
项目:Age-of-Kingdom    文件:KeyManager.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority= EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(InputEvent.KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    World world = mc.theWorld;
    EntityPlayer player = mc.thePlayer;
    if(keys[0].isPressed()) {
        NetworkManager.sendToServer(new GuiAokMessage());
    }
    if(mc.gameSettings.keyBindChat.isPressed()) {
        player.closeScreen();
        player.openGui(AgeOfKingdom.INSTANCE, AgeOfKingdom.serverProxy.GUI_CHAT, world, (int) player.posX, (int) player.posY, (int) player.posZ);
    }
}
项目:RFUtilities    文件:KeyInputHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
    if (KeyBindings.dialerModeChange.isPressed())
    {
        RFUtilities.RFU_NET_WRAPPER.sendToServer(new PacketDialerChangeMode());
    }
}
项目:CollectiveFramework    文件:GuiBook.java   
@SubscribeEvent
public void onKeyboardInput(InputEvent.KeyInputEvent event) {
    char eventChar = Keyboard.getEventCharacter();
    boolean isDown = Keyboard.getEventKeyState();
    Page page = book.getPages()[book.getCurrentPage()];
    for (Entry entry : page.getEntries())
        if (entry instanceof InteractiveEntry) {
            ((InteractiveEntry) entry).onKeyboardEvent(eventChar, isDown);
        }
}
项目:CollectiveFramework    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    if (Config.keyOverlay) {
        if (Keyboard.getEventKeyState())
            try {
                KeyOverlay.keys.offer(new Object[]{Keyboard.getKeyName(Keyboard.getEventKey()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
            } catch (Exception e) {
                e.printStackTrace();
            }
    }
}
项目:CollectiveFramework    文件:KeyHandler.java   
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
    if (Config.keyOverlay) {
        if (Mouse.getEventButtonState())
            try {
                KeyOverlay.keys.offer(new Object[]{Mouse.getButtonName(Mouse.getEventButton()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
            } catch (Exception e) {
                e.printStackTrace();
            }
    }
}
项目:DartCraft2    文件:KeyInputHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    if (KeyBindings.openForceBelt.isPressed()) {
        ItemStack forceBelt = DartCraftUtils.getCorrectForceBelt(mc.thePlayer);
        if (forceBelt != null) {
            DartCraft2.NETWORK.sendToServer(new OpenGuiContainerPacket(Reference.GUIs.FORCE_BELT.ordinal()));
        }
    }
}
项目:MacroMaker    文件:KeyHandler.java   
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
    if (Config.showKeysOnHUD) {
        if (Mouse.getEventButtonState())
            try {
                KeyOverlay.keys.offer(new Object[]{Mouse.getButtonName(Mouse.getEventButton()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
            } catch (Exception e) {
                e.printStackTrace();
            }
    }
}
项目:MyTown2-Client    文件:InputHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void keyInput(InputEvent.KeyInputEvent ev) {
    // DEBUG
    KeyBinding[] keyBindings = ClientProxy.keyBindings;
    if (keyBindings[0].isPressed()) {
        MyTownClient.log.info("Key binding = " + keyBindings[0].getKeyDescription());
        Minecraft.getMinecraft().thePlayer.openGui(MyTownClient.instance, 0, Minecraft.getMinecraft().thePlayer.worldObj, (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX), (int) Math.floor(Minecraft.getMinecraft().thePlayer.posY), (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ));
    }
}
项目:ProjectPlanner    文件:ClientEventHandler.java   
@SubscribeEvent
public void onKeyPressed(InputEvent.KeyInputEvent event)
{
    if (!FMLClientHandler.instance().isGUIOpen(GuiProjectPlanner.class) && KeyBindings.openGui.isPressed())
    {
        FMLClientHandler.instance().showGuiScreen(new GuiProjectPlanner());
    }
}
项目:PlayerInterfaceMod    文件:KeyEventHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    if (Keybindings.openInventory.isPressed()) {
        PacketHandler.INSTANCE.sendToServer(new MessageOpenGui(Minecraft.getMinecraft().thePlayer.getUniqueID(), GuiTrashInventory.GUI_ID));
        //Minecraft.getMinecraft().thePlayer.openGui(Reference.MOD_ID, GuiTrashInventory.GUI_ID, Minecraft.getMinecraft().theWorld, 0, 0, 0);
    }
}
项目:ComponentEquipment    文件:JukeboxOpener.java   
@SubscribeEvent
public void keyDown( InputEvent.KeyInputEvent event )
{
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.thePlayer;
    if ( player == null || mc.currentScreen != null || !mc.inGameHasFocus || !key.isPressed() )
    {
        return;
    }

    ComponentEquipment.network.sendToServer( new OpenGuiPacket( ComponentEquipment.JUKEBOX_GUI_ID ) );
}
项目:ComponentEquipment    文件:ReorderOpener.java   
@SubscribeEvent
public void keyDown( InputEvent.KeyInputEvent event )
{
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.thePlayer;
    if ( player == null || mc.currentScreen != null || !mc.inGameHasFocus || !key.isPressed() )
    {
        return;
    }

    ComponentEquipment.network.sendToServer( new OpenGuiPacket( ComponentEquipment.REORDER_MODIFIERS_GUI_ID ) );
}
项目:ComponentEquipment    文件:ArrowSlotSelector.java   
@SubscribeEvent
public void keyDown( InputEvent.KeyInputEvent event )
{
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.thePlayer;
    if ( player == null || mc.currentScreen != null || !mc.inGameHasFocus )
    {
        return;
    }
    else if ( player.getCurrentEquippedItem() == null || !( player.getCurrentEquippedItem().getItem() instanceof BowItem ) )
    {
        return;
    }

    int selected = QuiverItem.getSelected( player );

    for ( KeyBinding kb : keys )
    {
    if ( kb.getKeyDescription().equals( "key.ce_quiverUp" ) && kb.isPressed() )
    {
        ++selected;
    }
    else if ( kb.getKeyDescription().equals( "key.ce_quiverDown" ) && kb.isPressed() )
    {
        --selected;
    }
    }

    for ( ; selected < 0; selected += QuiverItem.SELECTION_SIZE );
    for ( ; selected >= QuiverItem.SELECTION_SIZE; selected -= QuiverItem.SELECTION_SIZE );

    ComponentEquipment.network.sendToServer( new SelectedArrowPacket( selected ) );
}
项目:ComponentEquipment    文件:BackpackOpener.java   
@SubscribeEvent
public void keyDown( InputEvent.KeyInputEvent event )
{
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.thePlayer;
    if ( player == null || mc.currentScreen != null || !mc.inGameHasFocus || !key.isPressed() )
    {
        return;
    }

    ComponentEquipment.network.sendToServer( new OpenGuiPacket( ComponentEquipment.BACKPACK_GUI_ID ) );
}
项目:Guide-Legacy    文件:ClientProxy.java   
@SubscribeEvent
public void onKeyPress(InputEvent.KeyInputEvent event) {
    if (Minecraft.getMinecraft().currentScreen == null) {
        if (getPermissions().hasPermission("mod.guide.open") && Keyboard.isKeyDown(BINDING_OPEN_GUIDE.getKeyCode())) {
            new ViewPagesGui().display();
        }
    }
}
项目:TheDarkEra    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
        int key = Keyboard.getEventKey();
        boolean isDown = Keyboard.getEventKeyState();

        if (isDown) {
            switch (key) {
            case Keyboard.KEY_Y:
                Minecraft mc = Minecraft.getMinecraft();
                int x = mc.objectMouseOver.blockX;
                int y = mc.objectMouseOver.blockY;
                int z = mc.objectMouseOver.blockZ;
                ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) Minecraft.getMinecraft().thePlayer);
                int a = props.getMaxMana();
                TheDarkEra.packetPipeline.sendToServer(new PacketGetMana(a + 10));
                break;
            case Keyboard.KEY_O:
                ShoutList.PreviousShout();
                break;
            case Keyboard.KEY_P:
                ShoutList.NextShout();
                break;
            default:
                break;
            }

        }
    }
}
项目:UniversalInputFixTest    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc.thePlayer != null && !InputWindow.isFrameDisplayable()) {
        if (inputKey.isPressed()) {
            InputWindow.showGUI("");
            FMLClientHandler.instance().displayGuiScreen(FMLClientHandler.instance().getClient().thePlayer, new GuiChat());
        }
        if (commandKey.isPressed()) {
            InputWindow.showGUI("/");
            FMLClientHandler.instance().displayGuiScreen(FMLClientHandler.instance().getClient().thePlayer, new GuiChat());
        }
    }
}
项目:SecureCraftProtect    文件:SCPInputHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onKeyPressed(InputEvent.KeyInputEvent event)
{
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    if (player != null)
    {
        DataWatcher data = player.getDataWatcher();
        if (keys[KEY_BLINK].isPressed())
        {
            data.updateObject(BLINK, 5);
            //SCP.pipe.sendTo(new SyncPlayerPropertiesPacket(player), player);
        }
        if (keys[KEY_BLINKING].isPressed())
        {
            if (data.getWatchableObjectInt(BLINKING) == FALSE)
            {
                data.updateObject(BLINKING, TRUE);
                player.addChatMessage(new ChatComponentText("Blinking enabled"));
            }
            else
            {
                data.updateObject(BLINKING, FALSE);
                data.updateObject(BLINK, MAX_BLINK);
                player.addChatMessage(new ChatComponentText("Blinking disabled"));
            }
        }
    }
}
项目:Minote    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyPress(InputEvent.KeyInputEvent event)
{
    if (openGui.getIsKeyPressed())
    {
        System.out.println("Key Pressed");
    }
}
项目:MiscUtils    文件:ModKeybind.java   
@SubscribeEvent
public void ButtonClickedEvent(InputEvent.KeyInputEvent event){

    if(GameSettings.isKeyDown(this) && Minecraft.getMinecraft().currentScreen == null){
        if(Minecraft.getMinecraft().thePlayer != null){
            EntityPlayer pl = Minecraft.getMinecraft().thePlayer;
            OnActivated(pl);
        }

    }

}
项目:AdvancedMod    文件:KeyInputHandler.java   
@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;
        }
    }
}
项目:StellarForge    文件:KeyBindingHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
    EntityClientPlayerMP player = FMLClientHandler.instance().getClient().thePlayer;

    if(FMLClientHandler.instance().getClient().inGameHasFocus &&
            FMLClientHandler.instance().getClient().currentScreen == null)
    {
        if(Key_Tablet.isPressed())
        {
            player.openGui(StellarForge.instance, 0, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ);
        }
    }
}
项目:NearbyMobFinder    文件:KeyInputHandler.java   
@SubscribeEvent
public void onKeyInputEvent(InputEvent.KeyInputEvent event)
{
    if(Keys.findMobs.isPressed())
    {
        EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
        List<EntityMob> list = NearbyMobLocator.findNearbyMobs(player, player.posX, player.posY, player.posZ);
        //If enabled in config
        if (Settings.checkAllTime)
        {
            ChatComponentText preMessage = new ChatComponentText("Nearby Mobs:");
            player.addChatComponentMessage(preMessage);
            if (list.size() != 0)
            {
                for (EntityMob mobFound : list)
                {
                    String MOB_LOCATION = mobFound.getCommandSenderName() + " x: " + (int) mobFound.posX + ", z: " + (int) mobFound.posZ + " (y: " + (int) mobFound.posY + ")";
                    ChatComponentText mobLocation = new ChatComponentText(MOB_LOCATION);
                    player.addChatComponentMessage(mobLocation);
                }
            }
            else
            {
                ChatComponentText message = new ChatComponentText("No Mobs Found Nearby");
                player.addChatComponentMessage(message);
            }
        }
    }
}
项目:HeadPhones-Radio    文件:KeyInputEventHandler.java   
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event){

    if(getPressedKeyBinding() == Key.PLAY){

        linkGui = new LinkGui();
        playing = linkGui.isPlaying();

    //  Main.log.info("Is Playing: " + linkGui.isPlaying());

    //  Main.log.info("Is Playing(Link): " + linkGui.isPlaying);
        try{
            if(playing){
                linkGui.setPlaying(false);
                Main.log.info("Stopped Playing");
                setPlaying(false);

                Main.log.info("Playing: " + playing);

                linkGui.urlConnection.disconnect();
                linkGui.urlConnection.kill();
            }else{
                linkGui.setPlaying(true);
                Main.log.info("Started Playing");
                setPlaying(true);

                Main.log.info("Playing: " + playing);

            //  linkGui.urlConnection.start();
                linkGui.urlConnection.kill();
                linkGui.urlConnection.init();
                linkGui.urlConnection.pc.unpause();
            }
        }catch(Exception e){
            e.printStackTrace();
        }

    }

}
项目:Quantum-Anomalies    文件:KeyBindHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onKeyPressed(InputEvent.KeyInputEvent event) throws IllegalAccessException {
    Minecraft mc = Minecraft.getMinecraft();
    ItemStack currentItem = mc.thePlayer.getCurrentEquippedItem();
    if (changeFocusKeybind.getIsKeyPressed())
        if (currentItem != null && currentItem.getItem() == QAItems.SCEPTRE.getItem())
            NetworkHandler.wrapper.sendToServer(new MessageChangeFocus());
}
项目:text-operator    文件:KeyHandler.java   
@SubscribeEvent
  public void onKeyInput(InputEvent.KeyInputEvent event){
    if (openMenu.isPressed()) {
    if (menu == null) {
        menu = new MainMenu(Minecraft.getMinecraft().currentScreen);
    }
    if (Minecraft.getMinecraft().currentScreen instanceof GuiScreen) {
        return;
    }
    Minecraft.getMinecraft().displayGuiScreen(menu);
}
  }