public boolean isInitialized() { return Keyboard.isCreated(); }
public boolean isKeyPressed (int key) { if (!Keyboard.isCreated()) return false; if (key == Input.Keys.ANY_KEY) return pressedKeys > 0; else return Keyboard.isKeyDown(getLwjglKeyCode(key)); }
public boolean isKeyPressed (int key) { if (!Keyboard.isCreated()) return false; if (key == Input.Keys.ANY_KEY) return pressedKeys > 0; else return Keyboard.isKeyDown(getLwjglKeyCode(key)); }
private void pauseCanvas(){ if (Mouse.isCreated()){ if (Mouse.isGrabbed()){ Mouse.setGrabbed(false); mouseWasGrabbed = true; } mouseWasCreated = true; Mouse.destroy(); } if (Keyboard.isCreated()){ keyboardWasCreated = true; Keyboard.destroy(); } renderable.set(false); destroyContext(); }
if (Keyboard.isCreated()) { while (Keyboard.next()) { int keyCode = getGdxKeyCode(Keyboard.getEventKey());
if (Keyboard.isCreated()) { while (Keyboard.next()) { int keyCode = getGdxKeyCode(Keyboard.getEventKey());
if (Keyboard.isCreated()){
if (Keyboard.isCreated()){ Keyboard.destroy();
public boolean isInitialized() { return Keyboard.isCreated(); }
public void init() { if (!Keyboard.isCreated()) { try { Keyboard.create(); } catch (final LWJGLException e) { throw new RuntimeException(e); } } }
public boolean isKeyPressed (int key) { if (!Keyboard.isCreated()) return false; if (key == Input.Keys.ANY_KEY) return pressedKeys > 0; else return Keyboard.isKeyDown(getLwjglKeyCode(key)); }
public synchronized void pollDevice() throws IOException { if (!org.lwjgl.input.Keyboard.isCreated()) return; org.lwjgl.input.Keyboard.poll(); for ( Component component : getComponents() ) { Key key = (Key)component; key.update(); } }
private void pauseCanvas(){ if (Mouse.isCreated()){ if (Mouse.isGrabbed()){ Mouse.setGrabbed(false); mouseWasGrabbed = true; } mouseWasCreated = true; Mouse.destroy(); } if (Keyboard.isCreated()){ keyboardWasCreated = true; Keyboard.destroy(); } renderable.set(false); destroyContext(); }
@Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, net.minecraft.client.util.ITooltipFlag advanced) { ISpell spell = SpellRegistry.getSpellFromID(Spells.getSpellIDCurrent(stack)); if (Keyboard.isCreated() && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) { tooltip.add(TextFormatting.GREEN + spell.getName() + " " + "[" + UtilChat.lang(BuildType.getName(stack)) + "] "); tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.cyclic_wand.tooltiprange") + BaseSpellRange.maxRange); tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.cyclic_wand.shifting")); } else { tooltip.add(TextFormatting.DARK_GRAY + UtilChat.lang("item.shift")); } super.addInformation(stack, playerIn, tooltip, advanced); }
protected synchronized boolean getNextDeviceEvent(Event event) throws IOException { if (!org.lwjgl.input.Keyboard.isCreated()) return false; if (!org.lwjgl.input.Keyboard.next()) return false; int lwjgl_key = org.lwjgl.input.Keyboard.getEventKey(); if (lwjgl_key == org.lwjgl.input.Keyboard.KEY_NONE) return false; Component.Identifier.Key key_id = KeyMap.map(lwjgl_key); if (key_id == null) return false; Component key = getComponent(key_id); if (key == null) return false; float value = org.lwjgl.input.Keyboard.getEventKeyState() ? 1 : 0; event.set(key, value, org.lwjgl.input.Keyboard.getEventNanoseconds()); return true; }
@SuppressWarnings("deprecation") @SideOnly(Side.CLIENT) private boolean isGuiKeyDown(KeyBinding keybinding) { if (keybinding == null) { return false; } //i think this fixes the bug? : // https://github.com/PrinceOfAmber/Cyclic/issues/198 // inside a GUI , we have to check the keyboard directly // thanks to Inventory tweaks, reminding me of alternate way to check // keydown while in config // https://github.com/Inventory-Tweaks/inventory-tweaks/blob/develop/src/main/java/invtweaks/InvTweaks.java try { //but just to be careful, add the trycatch also boolean bindingPressed = keybinding.isPressed(); boolean isKeyDown = Keyboard.isCreated() && Keyboard.isKeyDown(keybinding.getKeyCode()); boolean validKeyModifier = (keybinding.getKeyModifier() == null || keybinding.getKeyModifier().isActive()); return bindingPressed || //either keybinding object knows its presed, ir the keyboard knows its pressed with the mod (isKeyDown && validKeyModifier); } catch (Exception e) { //java.lang.IndexOutOfBoundsException from org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407) return false; } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onItemTooltipEvent(ItemTooltipEvent event) { if (Keyboard.isCreated() && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) { // https://www.reddit.com/r/minecraftsuggestions/comments/3brh7v/when_hovering_over_a_food_it_shows_how_many_food/ ItemStack itemStack = event.getItemStack(); if (itemStack.getItem() == null) { return; } if (foodDetails && itemStack.getItem() instanceof ItemFood) { ItemFood food = (ItemFood) itemStack.getItem(); int hunger = food.getHealAmount(itemStack); float satur = food.getSaturationModifier(itemStack); if (hunger > 0 || satur > 0) { event.getToolTip().add(hunger + " (" + satur + ")"); } } if (fuelDetails) { int burnTime = TileEntityFurnace.getItemBurnTime(itemStack); if (burnTime > 0) { event.getToolTip().add(UtilChat.lang("tooltip.burntime") + burnTime); } } } }
if (Keyboard.isCreated()){
if (Keyboard.isCreated()){ Keyboard.destroy();
if (player == null) return; if (Keyboard.isCreated() && event.getDwheel() != 0 && player.isSneaking()) {