Jump to content

Recommended Posts

Posted

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.

Bus subscriber.jpg

Mod Blocks.jpg

First Block.jpg

Posted

@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.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted

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.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

  • Esmerald1no changed the title to (SOLVED) [1.14.4] Unable to register custom block.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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