@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; } }); } }
@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)); } }
@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()); }
@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(); } } } }
@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); }
@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(); } } } }
@SubscribeEvent public void keyListener(KeyInputEvent event) { if (openGUI.isPressed()) { // ��Ҵ�GUI�� Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(new GUIBetterHUD(mc.currentScreen)); } }
@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); } }
@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); } }
@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)); } } }
@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) { } }
@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; } } } } }
@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; } }
@SubscribeEvent public void key(KeyInputEvent event) { keyPressedSlow = ralenti.isPressed(); if (keyPressedSlow) { Minecraft.getMinecraft().gameSettings.mouseSensitivity = 0.1F; } }
@SubscribeEvent public void onKeyPressed(KeyInputEvent evt){ if(ROCKeyBindings.freeze.isPressed()){ freeze = true; }else{ freeze = false; } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void keyPress(KeyInputEvent keyInput) { for (OEKeyBinding k : bindings) { if (Keyboard.isKeyDown(k.key())) { k.keyDown(); } } }
@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()); } } } }
/** * 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); } } } }
@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); } } }
@SubscribeEvent public void KeyInputEvent(KeyInputEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (config.isPressed() && mc.currentScreen == null) { mc.displayGuiScreen(new GuiAdvancedHUDConfiguration()); } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) if (spawnGUI.isPressed()) MobSpawnControls.DISPATCHER.sendToServer(MSCPacket.getPacket(PacketType.HANDSHAKE)); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { onInput(); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (onUploadHistory.isPressed()) { Minecraft.getMinecraft().displayGuiScreen(new UploadHistoryGUI(null)); } }
@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); } }
@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); } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (Minecraft.getMinecraft().currentScreen == null && scriptGUI.isPressed()) Minecraft.getMinecraft().displayGuiScreen(new MainScreen()); }
@Override public void keyTyped(char keyChar, int key) { KeyEventHandler.INSTANCE.key(new KeyInputEvent()); super.keyTyped(keyChar, key); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (KeyBindings.teamGuiButton.isPressed()) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; FMLClientHandler.instance().displayGuiScreen(player, new GuiTeamManager(player)); } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (KeyBindings.teamGuiButton.isPressed()) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; FMLClientHandler.instance().displayGuiScreen(player, new GuiTeamSystem(player)); } }
/** * 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; } } }
/** * 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; } } }