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

项目:ExternalInputUI    文件:ExternalInputUI.java   
@SubscribeEvent
public void onKey(KeyInputEvent.KeyInputEvent event){
    if(keyBinding.isPressed() && minecraft.thePlayer != null){
        synchronized(state){
            if(state)
                return;
            state = true;
        }
        minecraft.displayGuiScreen(new GuiIngameMenu());
        executor.submit(new Runnable() {
            @Override
            public void run() {
                openInputUI();
                state = false;
            }
        });
    }
}
项目:EasyLogin    文件:JoinEvent.java   
@SubscribeEvent
public void keyListener(KeyInputEvent event) throws IOException {
    if (EasyLogin.logingui.isPressed()) {
        Minecraft mc = Minecraft.getMinecraft();
        mc.displayGuiScreen(new MainGui(mc.currentScreen));
        // 密码读取
        InputStream in = new BufferedInputStream(new FileInputStream("config/easylogin.properties"));
        prop.load(in);
        // 解密密码
        byte[] passwordByte = prop.getProperty("PassWord").getBytes();
        byte key = 124;
        for (int i = 0; i < passwordByte.length; i++) {
            passwordByte[i] ^= key;
        }
        MainGui.settext(new String(passwordByte));
        System.out.println(new String(passwordByte));
    }
}
项目:rpginventory    文件:RPGKeyHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void keys(KeyInputEvent evt) {

    Minecraft mc = Minecraft.getMinecraft();
    GuiScreen guiscreen = mc.currentScreen;
    if (keySpecial.isPressed()) {
        ItemStack item = mc.thePlayer.getCurrentEquippedItem();
        if ((guiscreen == null) && item != null) {
            for(Item i : abilityMap) {
                if(item.getItem().equals(i)){
                    if(RpgUtility.canSpecial(mc.thePlayer, i));{
                        ((ISpecialAbility)RpgUtility.allAbilities.get(i)).specialAbility(item);
                        break;//ability should only be called once.
                    }
                }
            }
        }
    } 
    if(keyInventory.isPressed())
        RpgInventoryMod.SNW.sendToServer(new PacketOpenRpgInventory());

}
项目:MyMod    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {

    if (Minecraft.getMinecraft().currentScreen == null) {

        for (int i = 0; i < desc.length; i++) {

            if (keys[i].isPressed()) {
                if (!RenderClockHUD.isShowing())
                    Minecraft.getMinecraft().thePlayer.openGui(
                            MyMod.instance, LibGUI.CLOCK_CONFIG_GUI,
                            Minecraft.getMinecraft().theWorld,
                            (int) Minecraft.getMinecraft().thePlayer.posX,
                            (int) Minecraft.getMinecraft().thePlayer.posY,
                            (int) Minecraft.getMinecraft().thePlayer.posZ);
                else
                    RenderClockHUD.nextAlarm();
            }

        }

    }
}
项目:Blockbender    文件:KeyBind.java   
@SubscribeEvent
public void KeyInputEvent(KeyInputEvent event) {
    if(toggleHelp.getIsKeyPressed()){
        helpKeyPressed();
        return;
    }

    int keyInt = -1;
    if(scrollOne.getIsKeyPressed()) keyInt = 0;
    if(scrollTwo.getIsKeyPressed()) keyInt = 1;
    if(scrollThree.getIsKeyPressed()) keyInt = 2;
    if(scrollFour.getIsKeyPressed()) keyInt = 3;
    if(scrollFive.getIsKeyPressed()) keyInt = 4;
    if(scrollSix.getIsKeyPressed()) keyInt = 5;
    if(scrollSeven.getIsKeyPressed()) keyInt = 6;
    if(scrollEight.getIsKeyPressed()) keyInt = 7;
    if(scrollNine.getIsKeyPressed()) keyInt = 8;
    if(openSatchel.getIsKeyPressed()) keyInt = 10;

    if(!FMLClientHandler.instance().getClient().inGameHasFocus || keyInt == -1){
        return;
    }

    sendPacket(keyInt);
}
项目:CodeLyokoMod    文件:KeyBindingHandler.java   
@SubscribeEvent
public void keyDown(KeyInputEvent event)
{
    if (Keyboard.getEventKeyState()) {
        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        GameSettings settings = Minecraft.getMinecraft().gameSettings;
        if (player != null && player.isRiding() && player.ridingEntity instanceof EntityVehicle) {
            EntityVehicle vehicle = (EntityVehicle) player.ridingEntity;
            if (Keyboard.getEventKey() == settings.keyBindJump.getKeyCode())
                vehicle.motionY = 1.0D;
            else if (Keyboard.getEventKey() == settings.keyBindSneak.getKeyCode())
                vehicle.motionY = -1.0D;
            else
                vehicle.motionY = 0.0D;
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            DataOutputStream data = new DataOutputStream(bos);

            try {
                data.writeInt(vehicle.getEntityId());
                data.writeDouble(vehicle.motionY);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
项目:BetterHUD    文件:KeyListener.java   
@SubscribeEvent
public void keyListener(KeyInputEvent event) {
    if (openGUI.isPressed()) { // ��Ҵ�GUI��
        Minecraft mc = Minecraft.getMinecraft();
        mc.displayGuiScreen(new GUIBetterHUD(mc.currentScreen));
    }
}
项目:LambdaLib    文件:LIFMLGameEventDispatcher.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (!addKeyInput.isEmpty()) {
        hKeyInput.addAll(addKeyInput);
        addKeyInput.clear();
    }
    for (Iterator<LIHandler> it = hKeyInput.iterator(); it.hasNext(); ) {
        LIHandler handler = it.next();
        if (handler.isDead())
            it.remove();
        else
            handler.trigger(event);
    }
}
项目:KeyCraft    文件:SubscribeKeyListener.java   
@SubscribeEvent
public void keyListener(KeyInputEvent event) {
    if (key_Rewrite.isPressed()) { // ��Ҵ�Rewrite��GUI��
        Minecraft mc = Minecraft.getMinecraft();
        mc.displayGuiScreen(new GUIRewrite(mc.currentScreen));
    } else if (key_Interact.isPressed()) {
        EntityPlayer player = MainHelper.getPlayerCl();
        RewriteHelper.useSkill(player);
    }
}
项目:WikiLink    文件:WLEventHandlerClient.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if(WikiLink.keyBinding.isPressed()) {
        Minecraft mc = Minecraft.getMinecraft();
        Object topic = null;
        if(mc.inGameHasFocus) {
            if(mc.pointedEntity != null) {
                if(mc.pointedEntity instanceof EntityItem) {
                    topic = ((EntityItem) mc.pointedEntity).getEntityItem().copy();
                    ((ItemStack) topic).stackSize = 1;
                } else {
                    topic = mc.pointedEntity;
                }
            } else if(mc.objectMouseOver != null) {
                MovingObjectPosition mop = mc.objectMouseOver;
                if(mop.typeOfHit == MovingObjectType.BLOCK) {
                    Block block = mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ);
                    topic = block.getPickBlock(mop, mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
                    ((ItemStack) topic).stackSize = 1;
                } else if(mop.typeOfHit == MovingObjectType.ENTITY) {
                    if(mop.entityHit instanceof EntityItem) {
                        topic = ((EntityItem) mop.entityHit).getEntityItem().copy();
                        ((ItemStack) topic).stackSize = 1;
                    } else {
                        topic = mop.entityHit;
                    }
                }
            }
        }
        if(topic != null) {
            mc.displayGuiScreen(new GuiWikiLinkMenu(topic));
        }
    }
}
项目:rpginventory    文件:RpgKeyHandlerRB.java   
@Override
public void keys(KeyInputEvent evt) {
    try {
        Minecraft mc = Minecraft.getMinecraft();
        GuiScreen guiscreen = mc.currentScreen;
        if (keySpecial.isPressed()) {
            ItemStack item = mc.thePlayer.getCurrentEquippedItem();
            if ((guiscreen == null) && !(item == null)) {
                specialAbility(item);
            }
        }
    } catch (Throwable e) {
    }
}
项目:Farrago    文件:ClientProxy.java   
@SubscribeEvent
public void onKeyboardInput(KeyInputEvent e) {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.thePlayer != null) {
        if (mc.thePlayer.isSneaking()) {
            if (mc.thePlayer.getHeldItem() != null) {
                ItemStack held = mc.thePlayer.getHeldItem();
                if (held.getItem() == FarragoMod.RIFLE) {
                    // on Linux, Shift+2 and Shift+6 do not work. This is an LWJGL bug.
                    // This is a QWERTY-only workaround.
                    if (SystemUtils.IS_OS_LINUX) {
                        if (linuxNag) {
                            FarragoMod.log.warn("We are running on Linux. Due to a bug in LWJGL, Shift+2 and Shift+6 do not work "+
                                        "properly. Activating workaround. This may cause strange issues and is only "+
                                        "confirmed to work with QWERTY keyboards. This message is only shown once.");
                            linuxNag = false;
                        }
                        if (Keyboard.getEventCharacter() == '@') {
                            while (mc.gameSettings.keyBindsHotbar[1].isPressed()) {}
                            FarragoMod.CHANNEL.sendToServer(new ModifyRifleModeMessage(true, 1));
                            return;
                        }
                        if (Keyboard.getEventCharacter() == '^') {
                            while (mc.gameSettings.keyBindsHotbar[5].isPressed()) {}
                            FarragoMod.CHANNEL.sendToServer(new ModifyRifleModeMessage(true, 5));
                            return;
                        }
                    }
                    for (int i = 0; i < 9; i++) {
                        if (mc.gameSettings.keyBindsHotbar[i].isPressed()) {
                            while (mc.gameSettings.keyBindsHotbar[i].isPressed()) {} // drain pressTicks to zero to suppress vanilla behavior
                            FarragoMod.CHANNEL.sendToServer(new ModifyRifleModeMessage(true, i));
                        }
                    }
                    return;
                }
            }
        }
    }
}
项目:CubesEdge    文件:MovementTurnClient.java   
@SubscribeEvent
public void key(KeyInputEvent event) {
    if (turn.isPressed()
            && !((EntityPlayerCustom)Minecraft.getMinecraft().thePlayer.getExtendedProperties("Cube's Edge Player")).isTurning) {
        ((EntityPlayerCustom)Minecraft.getMinecraft().thePlayer.getExtendedProperties("Cube's Edge Player")).isTurning = true;
    }
}
项目:CubesEdge    文件:MovementSlowClient.java   
@SubscribeEvent
public void key(KeyInputEvent event) {
    keyPressedSlow = ralenti.isPressed();
    if (keyPressedSlow) {
        Minecraft.getMinecraft().gameSettings.mouseSensitivity = 0.1F;
    }
}
项目:Realms-of-Chaos    文件:KeyPress.java   
@SubscribeEvent
public void onKeyPressed(KeyInputEvent evt){
    if(ROCKeyBindings.freeze.isPressed()){
        freeze = true;
    }else{
        freeze = false;
    }
}
项目:Open-Exchange    文件:OEKeyBindHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void keyPress(KeyInputEvent keyInput) {
  for (OEKeyBinding k : bindings) {
    if (Keyboard.isKeyDown(k.key())) {
      k.keyDown();
    }
  }
}
项目:MeteorsMod    文件:HandlerKey.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (toggleMagnetism.isPressed()) {
        IInventory inv = BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer);
        ItemStack stack = inv.getStackInSlot(3);
        if (stack != null) {
            if (stack.getItem() == Baubles.MagnetismController) {
                MeteorsMod.network.sendToServer(new PacketToggleMagnetism());
            }
        }
    }
}
项目:PneumaticCraft    文件:KeyHandler.java   
/**
 * This will only subscribe when NotEnoughKeys is not installed.
 * @param event
 */
@SubscribeEvent
public void onKey(KeyInputEvent event){
    if(!nekLoaded()) {
        for(KeyBinding key : keys) {
            if(key.isPressed()) {
                onKey(key);
            }
        }
    }
}
项目:AgeCraft-Old    文件:ACKeyHandler.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if(mc.currentScreen == null) {
        if(techTree.isPressed()) {
            mc.displayGuiScreen(new GuiTechTree());
        }
    } else {
        if(changeGuiScale.isPressed()) {
            ACUtilClient.changeGuiScale(mc);
        }
    }

}
项目:AdvancedHUD    文件:KeyRegister.java   
@SubscribeEvent
public void KeyInputEvent(KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (config.isPressed() && mc.currentScreen == null) {
        mc.displayGuiScreen(new GuiAdvancedHUDConfiguration());
    }
}
项目:MobSpawnControls2    文件:KeyListener.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class))
        if (spawnGUI.isPressed()) 
            MobSpawnControls.DISPATCHER.sendToServer(MSCPacket.getPacket(PacketType.HANDSHAKE));

}
项目:GimmeTime    文件:KeyHandler.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    onInput();
}
项目:bUpload    文件:KeyBindingHandler.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (onUploadHistory.isPressed()) {
        Minecraft.getMinecraft().displayGuiScreen(new UploadHistoryGUI(null));
    }
}
项目:ModJam-4    文件:ClientProxy.java   
@SubscribeEvent
public void keyPress(KeyInputEvent event)
{
    boolean oldState = keyState; 
    keyState = GameSettings.isKeyDown(STAIN_KEY);

    if (!keyState && oldState)
    {
        // KEY UP!

        EntityPlayer player = Minecraft.getMinecraft().thePlayer;

        // find nearest stain
        BloodStain nearest = null;
        double distance = 5;
        for (BloodStain stain : StainManager.getStains())
        {
            if (stain.dimId != player.dimension)
            {
                continue;
            }
            double stainDist = player.getDistance(stain.x, stain.y, stain.z);
            if (distance > stainDist)
            {
                distance = stainDist;
                nearest = stain;
            }
        }

        if (nearest == null)
        {
            // uh.. error?
            // TODO: spit localized chat message
            return;
        }

        // trigger on the found stain.
        PlaybackPlayer playBack = new PlaybackPlayer(nearest);
        playBack.worldObj.spawnEntityInWorld(playBack); // to handle ticking ONLY
        players.add(playBack);
    }
}
项目:playblock    文件:KeyHandler.java   
@SubscribeEvent
public void onKey(KeyInputEvent evt) {
    if (keyOptions.isPressed() && mc.thePlayer != null && mc.currentScreen == null) {
        mc.thePlayer.openGui(PlayBlock.instance, GuiHandler.OPTIONS, mc.theWorld, 0, 0, 0);
    }
}
项目:MinecraftScripting    文件:KeyListener.java   
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (Minecraft.getMinecraft().currentScreen == null && scriptGUI.isPressed())
        Minecraft.getMinecraft().displayGuiScreen(new MainScreen());
}
项目:RankCapes    文件:GuiCapeSelect.java   
@Override
public void keyTyped(char keyChar, int key)
{
    KeyEventHandler.INSTANCE.key(new KeyInputEvent());
    super.keyTyped(keyChar, key);
}
项目:FissionWarfare    文件:KeyInputHandler.java   
@SubscribeEvent 
public void onKeyInput(KeyInputEvent event) {

    if (KeyBindings.teamGuiButton.isPressed()) {        

        EntityPlayer player = Minecraft.getMinecraft().thePlayer;

        FMLClientHandler.instance().displayGuiScreen(player, new GuiTeamManager(player));
    }
}
项目:FusionWarfare    文件:KeyInputHandler.java   
@SubscribeEvent 
public void onKeyInput(KeyInputEvent event) {

    if (KeyBindings.teamGuiButton.isPressed()) {        

        EntityPlayer player = Minecraft.getMinecraft().thePlayer;

        FMLClientHandler.instance().displayGuiScreen(player, new GuiTeamSystem(player));
    }
}
项目:NightfallMod    文件:MookKeyHandler.java   
/**
 * KeyInputEvent is in the FML package, so we must register to the FML event bus
 */
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (FMLClientHandler.instance().getClient().inGameHasFocus && !FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
        player = Minecraft.getMinecraft().thePlayer;

        if (keys[rKey].isPressed()) rightKey = true;

        if (keys[lKey].isPressed()) leftKey = true;

        if (keys[uKey].isPressed()) upKey = true;

        if (keys[dKey].isPressed()) downKey = true;

        if (keys[invkey].isPressed())
            //  FMLNetworkHandler.openGui(player, Main.instance, Main.nausicaaTabGuiId, Minecraft.getMinecraft().theWorld, (int) player.posX, (int) player.posY, (int) player.posZ);

            if (keys[noclipKey].isPressed()) {
                gliderOn = true;
            }
        if (keys[noclipoffKey].isPressed()) {
            gliderOn = false;
        }


    }

}
项目:NausicaaMod    文件:MookKeyHandler.java   
/**
 * KeyInputEvent is in the FML package, so we must register to the FML event bus
 */
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
    if (FMLClientHandler.instance().getClient().inGameHasFocus && !FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
        player = Minecraft.getMinecraft().thePlayer;

        if (keys[rKey].isPressed()) rightKey = true;

        if (keys[lKey].isPressed()) leftKey = true;

        if (keys[uKey].isPressed()) upKey = true;

        if (keys[dKey].isPressed()) downKey = true;

        if (keys[invkey].isPressed())
        FMLNetworkHandler.openGui(player, Main.instance, Main.nausicaaTabGuiId, Minecraft.getMinecraft().theWorld, (int) player.posX, (int) player.posY, (int) player.posZ);

        if (keys[noclipKey].isPressed()) {
            gliderOn = true;
        }
        if (keys[noclipoffKey].isPressed()) {
            gliderOn = false;
        }


    }

}