Posted February 15, 20214 yr I want the program to write to the console if I press the "O" button and when I press it again it will write another text. How to do that? Edited February 15, 20214 yr by WaromiV
February 15, 20214 yr Author ? private static final KeyBinding toggle = new KeyBinding("encrypt.key.toggle", 79, "key.categories.encrypt");
February 15, 20214 yr Author private static final KeyBinding toggle = new KeyBinding("encrypt.key.toggle", 79, "key.categories.encrypt"); private static final Logger LOGGER = LogManager.getLogger(); private static Boolean toggled = false; private void setup(final FMLCommonSetupEvent event) { ClientRegistry.registerKeyBinding(toggle); } @SubscribeEvent public static void onClientTickEvent(final TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.END) return; if (toggle.isPressed()) { if (toggled) { toggled = false; LOGGER.info("off"); } else{ toggled = true; LOGGER.info("on"); } } } this is not working
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.