Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, pretty noob to minecarft modding here, i alredy know how to program with java, and i was testing a bit with forge in the last weeks.

 

My question is, if i add a wood planks to the ore directory, in theory i should be able to use it in every minecraft recipe that require wood planks, right? Like to craft sticks.

I have done this with my custom block.

OreDictionary.registerOre("plankWood", ModBlocks.MY_PLANKS);

I have put this in the preInit event just after have instantiated the block in my ModBlock class.

Have i done something wrong? Or i have to make the recipe for every object that require wood planks with my wood by hand?

Thanks.

Block/item registration happens after preInit, and before init. So oredict registration should happen in init (i.e. in response to a FMLInitializationEvent).

 

You haven't posted your block registration code, but I sincerely hope you're doing it in a RegistryEvent.Register<Block> event handler?

  • Author
39 minutes ago, desht said:

You haven't posted your block registration code, but I sincerely hope you're doing it in a RegistryEvent.Register<Block> event handler?

Sure.

 

39 minutes ago, desht said:

Block/item registration happens after preInit, and before init. So oredict registration should happen in init (i.e. in response to a FMLInitializationEvent).

Ok....but why the documentation tell me to put it in preInit?

https://mcforge.readthedocs.io/en/latest/utilities/oredictionary/

Quote

Add entries to the OreDictionary during the FMLPreInitializationEvent phase, after initializing the blocks and items that you will register.

 

7 minutes ago, Simsure said:

Ok....but why the documentation tell me to put it in preInit?

https://mcforge.readthedocs.io/en/latest/utilities/oredictionary/

 

Good question. I suspect that section of the docs is outdated.  It used to be the case that blocks & items were explicitly registered from preInit, but that's since been superseded by the registry events.  My guess is that part of the docs was written before that.  In any case, moving your ore dict registration from preInit to init should solve your problem (you can verify this with your IDE debugger - if you breakpoint your current code, you should see that ModBlocks.MY_PLANKS is null). 

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.