Java Code Examples for net.minecraft.client.util.InputUtil#isKeyPressed()
The following examples show how to use
net.minecraft.client.util.InputUtil#isKeyPressed() .
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: ExcavatorHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void handlePositionSelection() { // continue with next step if(step.pos != null && InputUtil .isKeyPressed(MC.getWindow().getHandle(), GLFW.GLFW_KEY_ENTER)) { step = Step.values()[step.ordinal() + 1]; // delete posLookingAt if(!step.selectPos) posLookingAt = null; return; } if(MC.crosshairTarget != null && MC.crosshairTarget instanceof BlockHitResult) { // set posLookingAt posLookingAt = ((BlockHitResult)MC.crosshairTarget).getBlockPos(); // offset if sneaking if(MC.options.keySneak.isPressed()) posLookingAt = posLookingAt .offset(((BlockHitResult)MC.crosshairTarget).getSide()); }else posLookingAt = null; // set selected position if(posLookingAt != null && MC.options.keyUse.isPressed()) step.pos = posLookingAt; }
Example 2
Source File: KeyBindingMixin.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public boolean isActallyPressed() { long handle = WurstClient.MC.getWindow().getHandle(); int code = boundKey.getCode(); return InputUtil.isKeyPressed(handle, code); }
Example 3
Source File: MixinKeyboard.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
@Redirect(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/ScreenshotUtils;saveScreenshot(Ljava/io/File;IILnet/minecraft/client/gl/Framebuffer;Ljava/util/function/Consumer;)V")) public void takeScreenshot(File file_1, int int_1, int int_2, Framebuffer glFramebuffer_1, Consumer<Text> consumer_1) { if (InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_P)) { PanoramaHandler.takeScreenshot(consumer_1); } else { ScreenshotUtils.saveScreenshot(file_1, int_1, int_2, glFramebuffer_1, consumer_1); } }