Jump to content

Recommended Posts

Posted

Hello, I've recently decided to clean up my mod because it was a huge mess, so one thing I did was move all of the registration out of the one "registration" god class and divide the registration tasks into categories of block and item. Somewhere during this process, I must have gone wrong because my mod either fails to load or inevitably crashes when loading a world. I've played around with adding listeners and registering classes to the forge and mod busses, and gotten different errors. One thing I noticed is that they all lead to null pointers to items whose fields should have been injected from registries using the @ObjectHolder tag, so this is where I focused my research. I'm struggling to find anything about object holders, and beyond the idea that I didn't update the resource locations to match my new modid I'm stumped.

Latest Log and crash report (which correspond to the version on my repo) are attached.

Repo: https://github.com/eddie1101/PortalTest

Can someone tell me what I'm doing wrong?

latest.log crash-2021-02-01_20.37.37-client.txt

Posted

All of these methods are pointless, just call setRegistryName instead of calling a wrapper function that calls one line of code.

https://github.com/eddie1101/PortalTest/blob/c26623c062770115212536c540219f7abda1091f/src/main/java/erg/voidcraft/common/util/Util.java#L12

 

All of the declared types of these can just be Block

https://github.com/eddie1101/PortalTest/blob/c26623c062770115212536c540219f7abda1091f/src/main/java/erg/voidcraft/common/block/VoidcraftBlocks.java#L10-L14

Also, you haven't @ObjectHolder'd them, so you're not even using the thing you said you are in your thread title.

 

You aren't registering any blocks or items, because you haven't registered your classes with the event bus:

https://github.com/eddie1101/PortalTest/blob/c26623c062770115212536c540219f7abda1091f/src/main/java/erg/voidcraft/common/Voidcraft.java#L40

(You also aren't using the @EventBusSubscriber annotation)

 

Or the @SubscribeEvent annotation:

https://github.com/eddie1101/PortalTest/blob/master/src/main/java/erg/voidcraft/common/block/VoidcraftBlocks.java#L16

  • Thanks 1

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.

Posted

If you use @Object holder, the field needs to be final and null, so you can't assign a value to it like you are.

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.

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.