Jump to content

[1.5.2/1.6.4] Trks Recipe Doc


trakos

Recommended Posts

TrksRecipeDoc is a very simple, yet quite capable, "mod" that reads NEI items and recipes, and writes it to .xml file, plus it also renders all item icons and recipe handlers backgrounds. It also tries to calculate raw cost for each item. Sounds cool, right?

I've written a simple php page that uses this information and presents it nicely - I put up an online example: http://tekkidoc.s4.trakos.pl/ . This one is generated for tekkit.

Alternatively, it is possible to autocomplete (or autoedit further on) mediawiki - here is one I put up, it's generated for mekanism mod: http://mekawiki.s4.trakos.pl/ .

Some highlights:

Source code:

  1. minecraft mod that exports: https://github.com/trakos/trks-recipe-doc (there's a 1.5.2 branch; master is for 1.6.4)
  2. example C# code that I've used to import to mediawiki: https://github.com/trakos/trks-recipe-doc-wikisync (though I'm not sure if it's up to date with current xml structure)
  3. php page source: https://github.com/trakos/trks-recipe-doc-www (which uses zend and some util classes from https://github.com/trakos/trks-zend-utils ) - you only need to put generated recipes.php in data/, and upload images to public/images/

Overall, it sounds too good, right?

Yeah, there's a catch. Right now to calculate raw costs and make id - damage pair unique (some mods store data in NBT tags, and item with the same id and damage can be something entirely different) I have to write a bit of mod-specific stuff. See example: https://github.com/trakos/trks-recipe-doc/blob/MC1.5.2/common/trks/recipedoc/modsupport/mods/CCTurtleSupport.java . For raw costs, too many alternative ways to craft an item will cause omitting the item cost entirely, so sometimes the mod-specific code has to disable some recipes (for instance leaving only one way to craft an ingot). Also, marking items as base has to be done in mod support (i.e. allowing to use them in raw cost).

Still, it's a lot less work than doing these kind of stuff manually.

The code right now is still quite messy:

  1. It's my first MC mod, so "I have no idea what I'm doing"
  2. I should rewrite raw cost calculation, to make it a bit more universal
  3. It requires NEI and Mekanism to compile (only NEI to run) - though you can easily remove Mekanism dependency by removing MekanismSupport class.
  4. There's a hardcoded output path (C:/test/) - change that if you'll use it, especially on non-windows
  5. After the game starts with the mod loaded, it will automatically load the world named TrksRecipeDoc (creating it if not exists), export everything, and then shutdown the game - it made testing easier; it's designed for single run, remove the mod to actually play the game later ;)
  6. if you'll want to skip item rendering, you'd have to comment it out
  7. The coordinates for items on the recipe backgrounds aren't in px, you'll have to scale it properly (see, for example, recipe.phtml in php page)
  8. Scaling the images is done by trial and errors, so it may not be working flawlessly with different mc versions and stuff; I had to change a bit in 1.5.2 branch
  9. I've saw Kobata version of item rendering - he's making it properly by usage of FBO and stuff. I am using a bit simpler approach - I'm clearing the screen with bright green, rendering the icon, and then calling the MC screenshot function (which, I think, uses FBO internally). Later, I just resize it and change the bright green to transparency.

As you can see, there are some quirks here and then, but hey - it's open source, so you can fix it :).

Hope that's useful for somebody's mod or modpack documenting!

Cheers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...