IvanSteklow Posted July 7, 2017 Posted July 7, 2017 (edited) Hi everyone, I started new mod, but got a problem: Crash-report: Spoiler Unreported exception thrown! java.lang.NullPointerException at ivansteklow.fmhammers.tools.ItemHammer.onBlockStartBreak(ItemHammer.java:35) ~[ItemHammer.class:?] at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:146) ~[PlayerControllerMP.class:?] at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDamageBlock(PlayerControllerMP.java:339) ~[PlayerControllerMP.class:?] at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1504) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2290) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2053) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1841) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1119) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] So, you can view this file at my GitHub: https://github.com/IvanSteklow/FMHammers/blob/master/src/main/java/ivansteklow/fmhammers/tools/ItemHammer.java HELP ME PLS!!! & excuse me for my broken english Edited July 9, 2017 by IvanSteklow Solved 1 Quote
IceMetalPunk Posted July 7, 2017 Posted July 7, 2017 (edited) A Null Pointer Exception means you're treating a variable like an object, but it actually holds null (or "nothing") in it, so it doesn't have the methods you're trying to use. This error tells you the problem is in your ItemHammer.java file on line 35. So check there and see what variables you're trying to access, and then you can start thinking about why they might not have an actual object like you're expecting. Hint: Look at how many different constructors RayTraceResult has, and look at which one you're using. (Also, take V0idW1k3r's advice in general; but for the NPE, look at the constructors.) Edited July 7, 2017 by IceMetalPunk Quote Whatever Minecraft needs, it is most likely not yet another tool tier.
V0idWa1k3r Posted July 7, 2017 Posted July 7, 2017 This is not how you raytrace anything. Items already have a built-in raytrace method conviniently called Item::rayTrace. Quote
IvanSteklow Posted July 8, 2017 Author Posted July 8, 2017 15 hours ago, IceMetalPunk said: A Null Pointer Exception means you're treating a variable like an object, but it actually holds null (or "nothing") in it, so it doesn't have the methods you're trying to use. This error tells you the problem is in your ItemHammer.java file on line 35. So check there and see what variables you're trying to access, and then you can start thinking about why they might not have an actual object like you're expecting. Hint: Look at how many different constructors RayTraceResult has, and look at which one you're using. (Also, take V0idW1k3r's advice in general; but for the NPE, look at the constructors.) 15 hours ago, V0idWa1k3r said: This is not how you raytrace anything. Items already have a built-in raytrace method conviniently called Item::rayTrace. Thank you, I fixed it! 1 Quote
Recommended Posts
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.