Posted December 31, 201212 yr In my attempt to make a mod for configuring the CraftingManager's recipe list from the convenience of a configuration file, I've repeatedly worked around less than ideal circumstances. However, I find myself stuck on an especially cantankerous problem. Parsing data from the Configuration file to fill a recipe list is trivial compared to putting information there representing the initial state. Attempts at crawling through the recipe list, with the intent to build a string encoding the recipe instance's field values in a way that allows me to construct them, is hacky, but worse I have been unable to make it work. If one could magically get the argument values for the constructors, that would be perfect. In lieu of that ideal scenario, I figured getting the field values from instances would make a fine alternative, given that most of the IRecipe-implementing classes plop their constructor arguments into their field members. Ugly, but doable; even the OreRecipes comply. Fields can't be relied upon to be public, constructors aren't magic, so I'm left with reflection. And here, I plant my face into a wall. Making a class field crawler both generic and useful has worn on my patience. I seek suggestions on how I might solve the problem; perhaps I've overlooked a more elegant solution, or maybe someone can elucidate on how I might crawl the class fields. If not, I'll be forced to resort to a less savory approach like not dumping the initial recipe list to the configuration file.
January 5, 201312 yr If you only want the user to add recipes I would suggest using XML or JSON rather than an configuration file, as deleting recipes would be more work. No 5 row long documentation = account on the help forums
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.