@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true) public static void onEvent(KeyInputEvent event) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.player; CartCapability entityData = player.getCapability(Currency.CART_DATA, null); boolean isEmpty = true; if (entityData != null && entityData.getCart() != null) { for (ItemStack stack : entityData.getCart()) { if (!stack.isEmpty()) { isEmpty = false; } } } if (!isEmpty && openList.isPressed()) { Minecraft.getMinecraft().player.openGui(Currency.INSTANCE, 5, mc.world, (int) player.posX, (int) player.posY, (int) player.posZ); } }
@SubscribeEvent public void onKeyInputEvent(KeyInputEvent event) { if (Keyboard.getEventKeyState() == false) { return; } int keyCode = Keyboard.getEventKey(); if (PlacementPreview.keyToggleGhost.isActiveAndMatches(keyCode)) { Configs.enableRenderGhost = ! Configs.enableRenderGhost; } else if (PlacementPreview.keyToggleWire.isActiveAndMatches(keyCode)) { Configs.enableRenderWire = ! Configs.enableRenderWire; } else if (PlacementPreview.keyToggleEnabled.isActiveAndMatches(keyCode)) { RenderEventHandler.renderingEnabled = ! RenderEventHandler.renderingEnabled; } }
@SubscribeEvent public void onKeyInput(final KeyInputEvent e) { if (PathHandler.isTravelling()) { return; } if (Main.point.isPressed()) { final Position playerPos = Utils.getPosition(); PathHandler.addWaypoint(playerPos); Utils.sendInformation(Main.pathAdd.toString() + PathHandler.getWaypointSize()); } if (Main.cameraReset.isPressed()) { CameraRoll.reset(); } if (Main.fovReset.isPressed()) { DynamicFOV.reset(); } }
@SubscribeEvent public void onKeyInput( KeyInputEvent event ) { if( (!FMLClientHandler.instance().isGUIOpen( GuiChat.class )) && (mc.currentScreen == null) && (mc.world != null) ) { if( XRay.keyBind_keys[ XRay.keyIndex_toggleXray ].isPressed() ) { XRay.drawOres = !XRay.drawOres; XrayRenderer.ores.clear(); } else if( XRay.keyBind_keys[ XRay.keyIndex_showXrayMenu ].isPressed() ) { mc.displayGuiScreen( new GuiList() ); } } }
@SubscribeEvent public void onInputEvent(KeyInputEvent event) { int key = Keyboard.getEventKey(); Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; World world = mc.theWorld; int bind = mc.gameSettings.keyBindAttack.getKeyCode(); BlockPos pos = mc.objectMouseOver.getBlockPos(); EnumFacing face = mc.objectMouseOver.sideHit; if ((key == bind) && (Keyboard.isKeyDown(key))) { if (world.getBlockState(pos).getBlock() != null) { this.extinguishFire(player, pos, face, world, event, key); } } }
private void extinguishFire(EntityPlayer player, BlockPos posIn, EnumFacing face, World world, Event event, int key) { BlockPos pos = posIn.offset(face); if (world.getBlockState(pos).getBlock() == ModBlocks.nileFire) { if ((event instanceof MouseEvent) || (event instanceof PlayerInteractEvent)) { PacketHandler.sendToServer(new FireSound(player, face, pos)); event.setCanceled(true); } else if (event instanceof KeyInputEvent) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please contact the modder of Zero Quest if you are trying to put out a fire " + EnumChatFormatting.RED + "using a key on your keyboard as your attack key.")); } } else if (world.getBlockState(pos).getBlock() == ModBlocks.darkFire) { if ((event instanceof MouseEvent) || (event instanceof PlayerInteractEvent)) { PacketHandler.sendToServer(new FireSound(player, face, pos)); event.setCanceled(true); } else if (event instanceof KeyInputEvent) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please contact the modder of Zero Quest if you are trying to put out a fire " + EnumChatFormatting.RED + "using a key on your keyboard as your attack key.")); } } }
/** * This will only subscribe when NotEnoughKeys is not installed. * * @param event */ @SubscribeEvent public void onKey(KeyInputEvent event) { for (KeyBinding key : keys) { if (key.isPressed()) { onKey(key); } } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { for(KeyBinding key : ringEvents) if(key.isPressed()) sendRingEvent(ringEvents.indexOf(key)); if(openInventory.isPressed()) HarshenClientUtils.openInventory(); }
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true) public void onEvent(KeyInputEvent event) { KeyBinding[] keyBindings = ClientProxy.keyBindings; if (keyBindings[0].isPressed()) { // TODO convert this to a toggle so that it opens and closes the gui NemesisSystem.NETWORK.sendToServer(new MessageOpenNemesisGuiRequest()); } }
public void addItemKeyBinding(final Item item, String description, int keyCode, String category, final Consumer<KeyInputEvent> callback) { addKeyBinding(description, keyCode, category, keyInputEvent -> { HeldEquipment equipment = PlayerUtil.getHeldEquipment(Minecraft.getMinecraft().player, item); if (equipment != null) { callback.accept(keyInputEvent); } }); }
@SubscribeEvent public void onKeyInputEvent(InputEvent.KeyInputEvent event) { for (Entry<KeyBinding, Consumer<InputEvent.KeyInputEvent>> entry : keyBindings.entrySet()) { if (entry.getKey().isPressed()) { entry.getValue().accept(event); } } }
public void addKeyBinding(String description, int keyCode, String category, Consumer<KeyInputEvent> callback) { if (keyBindingManager == null) { keyBindingManager = new KeyBindingManager(); } keyBindingManager.addKeyBinding(description, keyCode, category, callback); }
public void addItemKeyBinding(Item item, String description, int keyCode, String category, Consumer<KeyInputEvent> callback) { if (keyBindingManager == null) { keyBindingManager = new KeyBindingManager(); } keyBindingManager.addItemKeyBinding(item, description, keyCode, category, callback); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (ClientProxy.attack2.isPressed()) { if (!attackpressed) { attackpressed = true; KeyBinding.onTick(mc.gameSettings.keyBindAttack.getKeyCode()); } } else { attackpressed = false; } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.HIGH) public static void onKeyInput(KeyInputEvent event) { if (System.currentTimeMillis() - lastTime > 500 && AlchemyEventSystem.isKeyBindingActive(key_follower)) { EntityPlayer player = Minecraft.getMinecraft().player; if (player != null) { InventoryBauble bauble = player.getCapability(AlchemyCapabilityLoader.bauble, null); ItemStack head = bauble.getStackInSlot(BaubleType.HEAD.getValidSlots()[0]); if (head != null && head.getItem() instanceof ItemHeadFollower) { SingleProjection.cutoverState(); lastTime = System.currentTimeMillis(); } } } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.TOP) public static void onKeyInput(KeyInputEvent event) { if (isHookInput()) KeyBinding.unPressAllKeys(); for (KeyBindingHandle handle : key_handle) if (isKeyHandleActive(handle)) handle.handle(); }
@SubscribeEvent public void keyPress(KeyInputEvent event) { Minecraft mc = Minecraft.getMinecraft(); if(openTodoListConfig.isPressed() && openTodoListConfig.isKeyDown()){ mc.displayGuiScreen(new GuiConfiguration()); Minecraft.getMinecraft().player.playSound(SoundEvents.UI_BUTTON_CLICK, 4F, 1F); }else if(openTodoList.isPressed() && openTodoList.isKeyDown()){ mc.displayGuiScreen(new ListSelectionGui()); Minecraft.getMinecraft().player.playSound(SoundEvents.UI_BUTTON_CLICK, 4F, 1F); TODOListMod.message.clearMessage(); } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void keyEvent(KeyInputEvent event) { if(FMLCommonHandler.instance().getSide().isClient()) { if(TaleCraft.proxy instanceof talecraft.proxy.ClientProxy) { TaleCraft.proxy.asClient().getKeyboardHandler().on_key(event); } } }
@SubscribeEvent public void keyPress(KeyInputEvent event) { if(radarOptions.isKeyDown()) { mc.displayGuiScreen(new GuiRadarOptions(mc.currentScreen)); } if(addWaypoint.isKeyDown()) { mc.displayGuiScreen(new GuiAddWaypoint(mc.currentScreen)); } }
@Override public void onEvent(KeyInputEvent event) { if (!Keyboard.isKeyDown(Keyboard.getEventKey()) || Minecraft.getMinecraft().player == null) return; ClientPlayerSettings settings = getPlayerSettings(Minecraft.getMinecraft().player); if (settings.bindings.containsKey(Keyboard.getKeyName(Keyboard.getEventKey()))) executeCommand(settings.bindings.get(Keyboard.getKeyName(Keyboard.getEventKey()))); else if (settings.bindings.containsKey(Integer.toString(Keyboard.getEventKey()))) executeCommand(settings.bindings.get(Integer.toString(Keyboard.getEventKey()))); }
@SubscribeEvent public void keyInputEvent(KeyInputEvent event) { if (KEYBINDING_GET_EFFECTS.isPressed()) { long current = System.currentTimeMillis(); if (this.lastPressTime < 0 || current - this.lastPressTime > 3000L) { this.lastPressTime = current; } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onKeyInput(KeyInputEvent event) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack feet = getFirstArmorStackWithEnchant(player); if (feet == null || feet.isEmpty() || player.isSneaking()) { return; } //sneak to not double jump if (EnchantmentHelper.getEnchantments(feet).containsKey(this) == false) { return; } if (player.getCooldownTracker().hasCooldown(feet.getItem())) { return; } if (FMLClientHandler.instance().getClient().gameSettings.keyBindJump.isKeyDown() && player.posY < player.lastTickPosY && player.isAirBorne && player.isInWater() == false) { //JUMP IS pressed and you are moving down int level = EnchantmentHelper.getEnchantments(feet).get(this); int uses = UtilNBT.getItemStackNBTVal(feet, NBT_USES); player.fallDistance = 0; float angle = (player.motionX == 0 && player.motionZ == 0) ? 90 : ROTATIONPITCH; UtilEntity.launch(player, angle, LAUNCH_POWER); UtilParticle.spawnParticle(player.getEntityWorld(), EnumParticleTypes.CRIT_MAGIC, player.getPosition()); UtilSound.playSound(player, player.getPosition(), SoundRegistry.bwoaaap, SoundCategory.PLAYERS, UtilSound.VOLUME / 8); UtilItemStack.damageItem(player, feet); uses++; if (uses >= level) { // level is maxuses //now block useage for a while if (!feet.isEmpty()) { player.getCooldownTracker().setCooldown(feet.getItem(), COOLDOWN); } uses = 0; } UtilNBT.setItemStackNBTVal(feet, NBT_USES, uses); player.fallDistance = 0; ModCyclic.network.sendToServer(new PacketPlayerFalldamage());//reset at bottom of jump } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (KEY_CAPTURE.isPressed()) { if (minema.isEnabled()) { minema.disable(); } else { minema.enable(); } } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (!minecraft.inGameHasFocus || keyBindingsList.isEmpty()) return; for (AbstractKeyBinding binding : keyBindingsList) { if (binding.isPressed()) binding.onKeyPressed(event); } }
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onKeyPressed(KeyInputEvent event){ if(ClientProxy.staff_mode.isPressed()){ ItemStack mainStack = Minecraft.getMinecraft().player.getHeldItem(EnumHand.MAIN_HAND); ItemStack offStack = Minecraft.getMinecraft().player.getHeldItem(EnumHand.OFF_HAND); int mode1 = -1, mode2 = -1; if(!mainStack.isEmpty() && mainStack.getItem() == ACItems.staff_of_the_gatekeeper){ if(mainStack.hasTagCompound()) mode1 = mainStack.getTagCompound().getInteger("Mode"); if(mode1 > -1){ if(mode1 == 0) mode1 = 1; else mode1 = 0; Minecraft.getMinecraft().player.sendMessage(new TextComponentString(I18n.format("tooltip.staff.mode.1")+": "+TextFormatting.GOLD + I18n.format(mode1 == 1 ? "item.drainstaff.normal.name" : "item.gatewaykey.name"))); } } if(!offStack.isEmpty() && offStack.getItem() == ACItems.staff_of_the_gatekeeper){ if(offStack.hasTagCompound()) mode2 = offStack.getTagCompound().getInteger("Mode"); if(mode2 > -1){ if(mode2 == 0) mode2 = 1; else mode2 = 0; Minecraft.getMinecraft().player.sendMessage(new TextComponentString(I18n.format("tooltip.staff.mode.1")+": "+TextFormatting.GOLD + I18n.format(mode2 == 1 ? "item.drainstaff.normal.name" : "item.gatewaykey.name"))); } } if(mode1 > -1 || mode2 > -1) PacketDispatcher.sendToServer(new StaffModeMessage()); } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { for(KeyBinding kb: kbList) { if (kb.isKeyDown()) onKeyInput(kb); } }
@SubscribeEvent public void onKey(KeyInputEvent event) { if (openBackpack.isPressed() && (BackpackHelper.getBackpack(ClientUtils.getPlayer()) != null) && WearableBackpacks.CONFIG.enableSelfInteraction.get()) WearableBackpacks.CHANNEL.sendToServer(MessageOpenBackpack.create()); }
@SubscribeEvent public void onKeyPressed(KeyInputEvent event) { if(ClientProxy.toggleBind.isPressed()) { PacketHandler.instance.sendToServer(new MessageKey(KeyType.TOGGLE_POWERS.code)); System.out.println("Message Sent"); } }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { for (Pair<KeyBinding, Action> keyAction : keyActions) { if (keyAction.getKey().isPressed()) { keyAction.getValue().execute(); } } if (!isSoundDetectorUpgradeEquipped(Minecraft.getMinecraft().player)) { SoundDetector.instance.setEnabled(false); } }
public void addKeyBinding(String description, int keyCode, String category, Consumer<KeyInputEvent> callback) { keyBindings.put(new KeyBinding(description, keyCode, category), callback); }
@SubscribeEvent public void onKeyInput(KeyInputEvent e) { if(Keyboard.isKeyDown(Keyboard.KEY_F3) && Keyboard.getEventKey() == Keyboard.KEY_I && Keyboard.getEventKeyState()) { config.load(); } }
/** * Method directly called from event handler. * * @param event KeyInputEvent referenced. */ public final void onKeyPressed(KeyInputEvent event) { activate(event); if (HCoreLibMain.configHandler.isDebugMode()) HCoreLibMain.logHelper.info("Pressed"); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (Keyboard.getEventKeyState()) { onKeyPressed(mc, Keyboard.getEventKey()); } }
@SubscribeEvent public void onKeyBind(KeyInputEvent event){ if(openInterfaceKey.isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) { TickHandler.openWikiGui(); } }
/** * Abstract method called on key pressed event. * * @param event KeyInputEvent referenced. */ protected abstract void activate(KeyInputEvent event);