Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

wernon

Members
  • Joined

  • Last visited

Everything posted by wernon

  1. I ended but with extremly bad solution, but it's better, that something, that does not work. @SubscribeEvent public void onKeyPress(InputEvent.KeyInputEvent event) { KeyBinding te1 = TEST; int t1 = te1.getKey().getKeyCode(); if(event.getKey() == t1 && event.getAction() == 1){ if(TEST.isPressed()){ Minecraft.getInstance().player.sendChatMessage("lol"); } } I still trying to figure out how to make thing with TickEvent work and if I manage to find better solution, I'll post code here.
  2. This method is private, so I cant call it w/o class rewrite. I tried #setPressed(false) and executing my event only once per tick, not twice, but there were no results.
  3. Huge thanks! That solves my problem, but in my case i dont want command to keep spamming while button is pressed. If I use InputEvent.KeyInputEvent, I can use #getAction, but I found no way to do this on ClientTickEvent (I looked through KeyBinding source code but found no method that can help me). Docs says that isPressed should work only once, but it is not working that way. @SubscribeEvent public void onKeyPress(TickEvent.ClientTickEvent event) { if(TEST.isPressed()){ Minecraft.getInstance().player.sendChatMessage("looool"); } } I initialise TEST as public static final KeyBinding TEST = new KeyBinding("key.test", KeyConflictContext.IN_GAME, InputMappings.Type.KEYSYM, GLFW.GLFW_KEY_Z, "test"); I feel like I am doing something stupid and sorry if that really is so, but I tried as much, as I could and this still does not work. Maybe should I write custom KeyConflictContest?
  4. Hello, guys! I'm trying to do some simple mod, which will be an addition to my vanilla spigot server, so this mod should be client-side only. The feature I've tried to implement is executing commands on keypress. I came up with this solution: @SubscribeEvent public void onKeyPress(InputEvent.KeyInputEvent event) { KeyBinding te1 = KEYBIND; //was ofk initialised before int t1 = te1.getKey().getKeyCode(); if(event.getKey() == t1 && event.getAction() == 1){ Minecraft.getInstance().player.sendChatMessage("/command"); } This works fine, but it also toggles when player is in menu or in chat. How can I make behavior of these buttons similar to vanilla WASD?

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.