Skip to content

Instantly share code, notes, and snippets.

@DV8FromTheWorld
Created May 22, 2012 17:19
Show Gist options
  • Save DV8FromTheWorld/2770382 to your computer and use it in GitHub Desktop.
Save DV8FromTheWorld/2770382 to your computer and use it in GitHub Desktop.
IRC log with RichardG about the OreDictionary
Session Start: Tue May 22 12:50:59 2012
[12:50.59] ->> RichardG is [email protected] (RichardG)
[12:50.59] ->> RichardG is on: #mcportcentral +#secretrevelation #redpower #minecraftforge +#logisticspipes +#forestry #computercraft #buildcraft +#TheEnd #FTB +#Direwolf20 @#DNS-TP ##crow
[12:50.59] ->> RichardG using apocalypse.esper.net (The end of the world. (Los Angeles, CA, USA))
[12:50.59] ->> RichardG 18 secs seconds idle, signon time 11:33 PM 5/14/2012
[12:50.59] ->> RichardG is logged in as RichardG
[12:50.59] ->> RichardG :End of /WHOIS list.
[12:51.14] <DV8FromTheWorld> quick question, do you know much about the ore dictionary?
[12:52.33] <RichardG> everything?
[12:52.48] <DV8FromTheWorld> lol.
[12:52.56] <RichardG> no i do
[12:53.07] <DV8FromTheWorld> well, smbarbour and I were looking into it
[12:53.21] <DV8FromTheWorld> and its implementation in mods.....differ
[12:53.38] <DV8FromTheWorld> looking through IC2, its implementation is serverly different than that of RP
[12:53.49] <DV8FromTheWorld> havent looked into forestry yet.
[12:54.00] <RichardG> how? all of them use iorehandler
[12:54.13] <DV8FromTheWorld> yes, but the code setup is quite different
[12:54.36] <DV8FromTheWorld> ok, maybe this will help, ill give an example
[12:55.21] <DV8FromTheWorld> say i have a mod. This mod adds copper ore. I want this ore to be registered with the ore dictionary so that it can be used in IC2 recipes and IC2 copper can be used in mine
[12:55.26] <DV8FromTheWorld> how would this be done?
[12:55.55] <DV8FromTheWorld> (i only ask because i cant seem to find a proper tut, and i promised a DEV i would try to help)
[12:57.59] <RichardG> checkin
[12:58.28] <DV8FromTheWorld> k.
[12:58.32] <RichardG> MinecraftForge.registerOre should explain
[12:58.41] <DV8FromTheWorld> i found that method,
[12:58.53] <DV8FromTheWorld> but how to implement it properly is where i am stuck
[12:59.10] <RichardG> after the mod initializes copper ore/ingot
[12:59.26] <RichardG> for using stuff from the dictionary on recipes themselves, see IOreHandler/registerOreHandler
[12:59.46] <DV8FromTheWorld> ok so.. something like this?
[12:59.57] <DV8FromTheWorld> MinecraftForge.registerOre("copperOre", new ItemStack(copperOre, 1, 0));
[01:00.30] <RichardG> yeah
[01:00.39] <DV8FromTheWorld> hmm
[01:00.46] <DV8FromTheWorld> currently, i just have that line
[01:00.53] <DV8FromTheWorld> only that line, in the mod_ file
[01:01.10] <RichardG> mods should pick that up
[01:01.14] <RichardG> automatically
[01:01.14] <DV8FromTheWorld> with only that line, would IC2 be able to use the copper ore?
[01:01.18] <RichardG> yeah
[01:01.25] <RichardG> hint: do the same for ingots
[01:01.26] <DV8FromTheWorld> well, im guessing i would need to also register the ingot?
[01:01.28] <DV8FromTheWorld> :D
[01:01.34] <RichardG> yeah
[01:01.51] <RichardG> also wanna know how to pick up stuff from the oredict itself?
[01:02.24] <DV8FromTheWorld> yes, that would be smart.
[01:02.39] * DV8FromTheWorld is totally saving the logs on this convo for future use
[01:03.19] <RichardG> implement IOreHandler somewhere then pass it to MinecraftForge.registerOreHandler, you don't need to worry about loading order since upon registering the handler forge will pass all existing ores to the handler
[01:03.39] <DV8FromTheWorld> O.O just blew my mind.
[01:03.54] <RichardG> just implement IOreHandler somewhere and run MinecraftForge.registerOreHandler
[01:03.58] <DV8FromTheWorld> im "technically" not a coder.... yet. so im not quite sure what all that means
[01:04.00] <DV8FromTheWorld> ah ok
[01:04.07] <RichardG> move ALL recipes dependant on ie. copper ingots to the handler
[01:04.26] <RichardG> and adapt them, for example changing new ItemStack(copperOre) to ore (passed to registerOre)
[01:04.32] <DV8FromTheWorld> soo
[01:04.39] <DV8FromTheWorld> inecraftForge.registerOreHandler(this);
[01:04.42] <RichardG> yeah
[01:04.43] <DV8FromTheWorld> m*
[01:04.49] <RichardG> sticking a ore != null check in the start would be smart too
[01:04.57] <DV8FromTheWorld> (taken from IC2's oreRegistration setup)
[01:05.10] <DV8FromTheWorld> thats what im looking at currently.
[01:05.40] <RichardG> IC2:
[01:05.44] <RichardG> if (oreClass.equals("dyeBlue")) registerBlueDyeCraftingRecipes(ore);
[01:06.12] <RichardG> once you receive the right registerore, add away the recipes
[01:07.06] <DV8FromTheWorld> if (copperOre != null)
[01:07.06] <DV8FromTheWorld> {
[01:07.06] <DV8FromTheWorld> MinecraftForge.registerOre("copperOre", copperOre);
[01:07.06] <DV8FromTheWorld> }
[01:07.08] <DV8FromTheWorld> ?
[01:07.17] <RichardG> no, the null check is in the orehandler
[01:07.35] <DV8FromTheWorld> if (Ic2Items.uraniumOre != null)
[01:07.35] <DV8FromTheWorld> {
[01:07.35] <DV8FromTheWorld> MinecraftForge.registerOre("oreUranium", Ic2Items.uraniumOre);
[01:07.35] <DV8FromTheWorld> }
[01:07.35] <DV8FromTheWorld> ^That is what i was basing that on
[01:07.36] <RichardG> plus, it's oreCopper
[01:07.37] <RichardG> ingotCopper
[01:07.50] <RichardG> that check is for disabling uranium in the config
[01:08.14] <RichardG> practical orehandler example:
[01:08.14] <RichardG> if (ore == null) return;
[01:08.15] <RichardG> if (oreClass.equals("ingotCopper")) registerCopperIngotRecipes(ore);
[01:08.16] <DV8FromTheWorld> so if its disabled, it registers it? O.o
[01:08.26] <RichardG> no, if it's not null it registers it
[01:08.38] <DV8FromTheWorld> oh right! ! = not >.>
[01:09.16] <DV8FromTheWorld> hmm, ok. give me a sec to think
[01:09.31] <DV8FromTheWorld> sorry, im not familiar with all of this yet,
[01:09.52] <RichardG> i gave you a nice example of orehandler too
[01:10.07] <DV8FromTheWorld> i know, im rereading,
[01:11.04] <DV8FromTheWorld> ok, one thing that has been bugging me
[01:11.04] <DV8FromTheWorld> How does the oreDictionary specify what is what? Like how does it know that RP copper can be used with IC2 Copper?
[01:11.15] <DV8FromTheWorld> is it strickly based off the name?
//The log ends here. I never got an answer to this question.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment