Posted April 3, 20205 yr I followed a tutorial and there was the following code: return InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), glfw); But for me the 'getMainWindow()' was underlined red. I looked through the IntelliJ-Hints and the only function whitch returns a 'MainWindow' is 'func_228018_at_()'. When I run it with MainWindow it starts minecraft but closes it again after some time saying: [16:19:41] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:109]: ---- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 03.04.20 16:19 Description: Initializing game java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMainWindow()Lnet/minecraft/client/MainWindow; at com.nkdm.emptyblock.EmptyBlock.getKey(EmptyBlock.java:68) ~[main/:?] {re:classloading} at *...* Process finished with exit code -1 When I run it with func_228018_at_ it instantly says: C:\Users\*ME1*\IdeaProjects\emptyblock\src\main\java\com\nkdm\emptyblock\EmptyBlock.java:68: error: cannot find symbol return InputMappings.isKeyDown(Minecraft.getInstance().func_228018_at_().getHandle(), glfw); ^ symbol: method func_228018_at_() location: class Minecraft I use IntelliJ and have the newest mappings. Please help! Edited April 3, 20205 yr by me1
April 3, 20205 yr 16 minutes ago, me1 said: NoSuchMethodError That method probably got renamed. You can't call it because it doesn't exist because you have the wrong name. Use your IDE to search for methods and find one that looks like it does what you want. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 3, 20205 yr Author @Draco18s That's what I did and that's how I found 'func_228018_at_()'. It's the only one witch returns a 'MainWindow'.
April 3, 20205 yr 5 minutes ago, me1 said: @Draco18s That's what I did and that's how I found 'func_228018_at_()'. It's the only one witch returns a 'MainWindow'. Try searching for .getHandle() instead, then find what that's in?
April 3, 20205 yr Just now, me1 said: @ultra_reemun There is no .getHandle in the class Minecraft. My bad, sorry
April 3, 20205 yr 57 minutes ago, me1 said: @Draco18s That's what I did and that's how I found 'func_228018_at_()'. It's the only one witch returns a 'MainWindow'. Please don't @ me. And I don't see what the problem is. If your mappings are up to date, then no one's renamed the method yet. There's no "solution" Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 8, 20205 yr I had the same problem, and here how I solved it: import org.lwjgl.glfw.GLFW; import net.minecraft.client.Minecraft; import net.minecraft.client.util.InputMappings; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class KeyboardHelper { private static final long WINDOW = Minecraft.getInstance().func_228018_at_().getHandle(); @OnlyIn(Dist.CLIENT) public static boolean isHoldingShift() { return InputMappings.isKeyDown(WINDOW, GLFW.GLFW_KEY_LEFT_SHIFT); }
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.