Posted January 16, 20196 yr 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.
January 16, 20196 yr 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?
January 16, 20196 yr 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.
January 16, 20196 yr 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.