Esmerald1no Posted November 24, 2019 Posted November 24, 2019 Beforehand, I would like to mention that I am a first-time modder and the mistake that I am committing is probably a rookie one, and I promise to improve from now on. Okay now to the crash, I discovered the issue when I tried to give myself the item, depending on how I interacted with the item I would either get a null.pointer exception: Unexpected Error (when scrolling over/holding), or null.pointer exception: Render screen(moused over the item in inventory). Initially, I believed the problem was in the BlockItem conversion, as the block possessed all the attributes that I had envisioned, minus the item, so I placed a logger event on the bus subscriber and this came up right after the event fired: [Client thread/DEBUG] [ne.mi.re.ObjectHolderRef/]: Unable to lookup technomagical_advancements:firstblock for public static com.Esmerald1no.technomagical_advancements.Blocks.FirstBlock com.Esmerald1no.technomagical_advancements.Blocks.ModBlocks.FIRSTBLOCK. This means the object wasn't registered. It's likely just mod options. I believe it is most likely a problem with the naming conventions, but I have been staring at my code for so long I can't see any difference. I have attached the event bus subscriber class; a class to ensure that the name of the block will be assigned to the instance and the class that contains the information of the block itself. I have reviewed the post about the FAQ, on the section about the registering of classes onto the bus, but it was not helpful for me at least, so I would appreciate if the responses were not just a link to that page. Quote
imacatlolol Posted November 24, 2019 Posted November 24, 2019 @ObjectHolder objects must be public static final, not just public static. You can just initialize the object as null, and it will be replaced properly when the block is registered. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Esmerald1no Posted November 24, 2019 Author Posted November 24, 2019 thank you so much! do appreciate it Quote
Cadiboo Posted November 24, 2019 Posted November 24, 2019 You can also put the object holder annotation on your class with your modid, remove the annotation from your field and make the field’s name match the path of the objects registry name. Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.