Java Code Examples for net.minecraft.client.util.InputUtil#getKeycodeName()

The following examples show how to use net.minecraft.client.util.InputUtil#getKeycodeName() . 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: ModuleWindowDark.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xcfc3cf : 0xcfe0cf);
}
 
Example 2
Source File: ModuleWindowFuture.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y, x+len, y+14, mouseOver(x, y, x+len, y+14) ? 0x70303030 : 0x70000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+14)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind ยง7" + name + (mouseOver(x, y, x+len, y+14) ? "..." : "")
			, x+2, y+3, -1);
}
 
Example 3
Source File: ModuleWindowLight.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xffc3ff : 0xffe0ff);
}
 
Example 4
Source File: MixinKeyboard.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "onKey", at = @At(value = "INVOKE", target = "net/minecraft/client/util/InputUtil.isKeyPressed(JI)Z", ordinal = 5), cancellable = true)
private void onKeyEvent(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo callbackInfo) {
	if (InputUtil.getKeycodeName(InputUtil.getKeyCode(key, scanCode).getKeyCode()) != null && InputUtil.getKeycodeName(InputUtil.getKeyCode(key, scanCode).getKeyCode()).equals(CommandManager.prefix)) {
        MinecraftClient.getInstance().openScreen(new ChatScreen(CommandManager.prefix));
    }
	
    EventKeyPress event = new EventKeyPress(key, scanCode);
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) callbackInfo.cancel();
}
 
Example 5
Source File: ClickGuiScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y+11, x+len-2, y+12, 0x90b0b0b0);
	Screen.fill(x+len - 2, y, x+len-1, y+12, 0x90b0b0b0);
	Screen.fill(x, y - 1, x + 1, y+11, 0x90000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xcfc3cf : 0xcfe0cf);
}
 
Example 6
Source File: MixinKeyboard.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "onKey", at = @At(value = "INVOKE", target = "net/minecraft/client/util/InputUtil.isKeyPressed(JI)Z", ordinal = 5), cancellable = true)
private void onKeyEvent(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo callbackInfo) {
	if (InputUtil.getKeycodeName(InputUtil.getKeyCode(key, scanCode).getKeyCode()) != null && InputUtil.getKeycodeName(InputUtil.getKeyCode(key, scanCode).getKeyCode()).equals(CommandManager.prefix)) {
        MinecraftClient.getInstance().openScreen(new ChatScreen(CommandManager.prefix));
    }
	
    EventKeyPress event = new EventKeyPress(key, scanCode);
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) callbackInfo.cancel();
}