Java Code Examples for net.minecraft.client.settings.GameSettings#isKeyDown()
The following examples show how to use
net.minecraft.client.settings.GameSettings#isKeyDown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Scaffold.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
/** * Disable scaffold module */ @Override public void onDisable() { if (mc.thePlayer == null) return; if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) { mc.gameSettings.keyBindSneak.pressed = false; if (eagleSneaking) mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); } if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight)) mc.gameSettings.keyBindRight.pressed = false; if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft)) mc.gameSettings.keyBindLeft.pressed = false; lockRotation = null; mc.timer.timerSpeed = 1F; shouldGoDown = false; if (slot != mc.thePlayer.inventory.currentItem) mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)); }
Example 2
Source File: Sneak.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
@Override public void onDisable() { if(mc.thePlayer == null) return; switch(modeValue.get().toLowerCase()) { case "legit": if(!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) mc.gameSettings.keyBindSneak.pressed = false; break; case "vanilla": case "switch": case "minesecure": mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); break; } super.onDisable(); }
Example 3
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void onEntityPlayerJump(WEntityPlayerJumpEvent event) { if(!preventJumping.isChecked()) return; EntityPlayer player = event.getPlayer(); if(player != WMinecraft.getPlayer()) return; // Allow jump when pressing the sneak key but not actually sneaking. // This enables a glitch that allows the player to jump on water by // pressing the jump and sneak keys at the exact same time or by // pressing the sneak key while using BunnyHop. if(GameSettings.isKeyDown(mc.gameSettings.keyBindSneak) && !player.isSneaking()) return; if(!isStandingOnLiquid(player)) return; event.setCanceled(true); }
Example 4
Source File: AutoSwimHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { EntityPlayerSP player = event.getPlayer(); if(player.isInWater() && !player.isSneaking() && !GameSettings.isKeyDown(mc.gameSettings.keyBindJump)) player.motionY += mode.getSelected().upwardsMotion; }
Example 5
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { EntityPlayerSP player = event.getPlayer(); // check if sneaking if(player.isSneaking() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) return; // move up in water if(player.isInWater()) { player.motionY = 0.11; tickTimer = 0; return; } // simulate jumping out of water if(tickTimer == 0) player.motionY = 0.30; else if(tickTimer == 1) player.motionY = 0; // update timer tickTimer++; }
Example 6
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
private boolean isLiquidCollisionEnabled(EntityPlayer player) { if(player == null) return false; if(player.isSneaking() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) return false; if(player.isInWater() || player.fallDistance > 3) return false; return true; }
Example 7
Source File: ItemBlueprint.java From Cyberware with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (stack.hasTagCompound()) { NBTTagCompound comp = stack.getTagCompound(); if (comp.hasKey("blueprintItem")) { GameSettings settings = Minecraft.getMinecraft().gameSettings; if (settings.isKeyDown(settings.keyBindSneak)) { ItemStack blueprintItem = ItemStack.loadItemStackFromNBT(comp.getCompoundTag("blueprintItem")); if (blueprintItem != null && CyberwareAPI.canDeconstruct(blueprintItem)) { ItemStack[] items = CyberwareAPI.getComponents(blueprintItem).clone(); tooltip.add(I18n.format("cyberware.tooltip.blueprint", blueprintItem.getDisplayName())); for (ItemStack item : items) { if (item != null) { tooltip.add(item.stackSize + " x " + item.getDisplayName()); } } return; } } else { tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.shiftPrompt", Minecraft.getMinecraft().gameSettings.keyBindSneak.getDisplayName())); return; } } } tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.craftBlueprint")); }
Example 8
Source File: SneakModule.java From seppuku with GNU General Public License v3.0 | 4 votes |
private boolean isMoving() { return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindForward) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindLeft) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindRight) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindBack); }
Example 9
Source File: Scaffold.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * Update event * * @param event */ @EventTarget public void onUpdate(final UpdateEvent event) { mc.timer.timerSpeed = timerValue.get(); shouldGoDown = downValue.get() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak) && getBlocksAmount() > 1; if (shouldGoDown) mc.gameSettings.keyBindSneak.pressed = false; if (mc.thePlayer.onGround) { final String mode = modeValue.get(); // Rewinside scaffold mode if (mode.equalsIgnoreCase("Rewinside")) { MovementUtils.strafe(0.2F); mc.thePlayer.motionY = 0D; } // Smooth Zitter if (zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("smooth")) { if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight)) mc.gameSettings.keyBindRight.pressed = false; if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft)) mc.gameSettings.keyBindLeft.pressed = false; if (zitterTimer.hasTimePassed(100)) { zitterDirection = !zitterDirection; zitterTimer.reset(); } if (zitterDirection) { mc.gameSettings.keyBindRight.pressed = true; mc.gameSettings.keyBindLeft.pressed = false; } else { mc.gameSettings.keyBindRight.pressed = false; mc.gameSettings.keyBindLeft.pressed = true; } } // Eagle if (eagleValue.get() && !shouldGoDown) { if (placedBlocksWithoutEagle >= blocksToEagleValue.get()) { final boolean shouldEagle = mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ)).getBlock() == Blocks.air; if (eagleSilentValue.get()) { if (eagleSneaking != shouldEagle) { mc.getNetHandler().addToSendQueue( new C0BPacketEntityAction(mc.thePlayer, shouldEagle ? C0BPacketEntityAction.Action.START_SNEAKING : C0BPacketEntityAction.Action.STOP_SNEAKING) ); } eagleSneaking = shouldEagle; } else mc.gameSettings.keyBindSneak.pressed = shouldEagle; placedBlocksWithoutEagle = 0; } else placedBlocksWithoutEagle++; } // Zitter if (zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("teleport")) { MovementUtils.strafe(zitterSpeed.get()); final double yaw = Math.toRadians(mc.thePlayer.rotationYaw + (zitterDirection ? 90D : -90D)); mc.thePlayer.motionX -= Math.sin(yaw) * zitterStrength.get(); mc.thePlayer.motionZ += Math.cos(yaw) * zitterStrength.get(); zitterDirection = !zitterDirection; } } }
Example 10
Source File: TNTBlock.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@EventTarget public void onMotionUpdate(MotionEvent event) { for(final Entity entity : mc.theWorld.loadedEntityList) { if(entity instanceof EntityTNTPrimed && mc.thePlayer.getDistanceToEntity(entity) <= rangeValue.get()) { final EntityTNTPrimed tntPrimed = (EntityTNTPrimed) entity; if(tntPrimed.fuse <= fuseValue.get()) { if(autoSwordValue.get()) { int slot = -1; float bestDamage = 1F; for(int i = 0; i < 9; i++) { final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i); if(itemStack != null && itemStack.getItem() instanceof ItemSword) { final float itemDamage = ((ItemSword) itemStack.getItem()).getDamageVsEntity() + 4F; if(itemDamage > bestDamage) { bestDamage = itemDamage; slot = i; } } } if(slot != -1 && slot != mc.thePlayer.inventory.currentItem) { mc.thePlayer.inventory.currentItem = slot; mc.playerController.updateController(); } } if(mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) { mc.gameSettings.keyBindUseItem.pressed = true; blocked = true; } return; } } } if(blocked && !GameSettings.isKeyDown(mc.gameSettings.keyBindUseItem)) { mc.gameSettings.keyBindUseItem.pressed = false; blocked = false; } }
Example 11
Source File: MiscHandler.java From Cyberware with MIT License | 4 votes |
@SubscribeEvent(priority = EventPriority.LOWEST) @SideOnly(Side.CLIENT) public void handleCyberwareTooltip(ItemTooltipEvent event) { ItemStack stack = event.getItemStack(); if (CyberwareAPI.isCyberware(stack)) { ICyberware ware = CyberwareAPI.getCyberware(stack); Quality quality = ware.getQuality(stack); GameSettings settings = Minecraft.getMinecraft().gameSettings; if (settings.isKeyDown(settings.keyBindSneak)) { List<String> info = ware.getInfo(stack); if (info != null) { event.getToolTip().addAll(info); } ItemStack[][] reqs = ware.required(stack); if (reqs.length > 0) { String joined = ""; for (int i = 0; i < reqs.length; i++) { String toAdd = ""; for (int j = 0; j < reqs[i].length; j++) { if (j != 0) { toAdd += " " + I18n.format("cyberware.tooltip.joinerOr") + " "; } toAdd += I18n.format(reqs[i][j].getUnlocalizedName() + ".name"); } if (i != 0) { joined += I18n.format("cyberware.tooltip.joiner") + " "; } joined += toAdd; } event.getToolTip().add(ChatFormatting.AQUA + I18n.format("cyberware.tooltip.requires") + " " + joined); } event.getToolTip().add(ChatFormatting.RED + I18n.format("cyberware.slot." + ware.getSlot(stack).getName())); if (quality != null) { event.getToolTip().add(I18n.format(quality.getUnlocalizedName())); } } else { event.getToolTip().add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.shiftPrompt", Minecraft.getMinecraft().gameSettings.keyBindSneak.getDisplayName())); } } else if (stack.getItem() instanceof IDeconstructable) { if (event.getToolTip().size() > 1) { event.getToolTip().add(1, ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.canDeconstruct")); } else { event.getToolTip().add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.canDeconstruct")); } } }
Example 12
Source File: ClientProxy.java From Signals with GNU General Public License v3.0 | 4 votes |
@Override public boolean isSneakingInGui(){ return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak); }
Example 13
Source File: ClientProxy.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isSneakingInGui(){ return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak); }