Minecraft's item and crafting recipes are defined in code, not in data. So you'll have to decompile the .jar
files to do any useful analysis. To include mods in this analysis, you'd need to decompile them as well.
The main Minecraft server contains an Item.java
file that lists all items along with their item IDs. The format of the calls that insert items into the registry is pretty simple and amenable to extraction via grep
and some regular expressions. For example, on a not-necessarily-very-recent copy of the file, they look like:
REGISTRY.a(325, "bucket", item);
REGISTRY.a(326, "water_bucket", (new ItemBucket(Blocks.WATER)).c("bucketWater").c(item).f("bucket_water"));
REGISTRY.a(327, "lava_bucket", (new ItemBucket(Blocks.LAVA)).c("bucketLava").c(item).f("bucket_lava"));
Similarly, you can find recipes defined in CraftingManager.java
:
this.registerShapelessRecipe(new ItemStack(Items.BOOK_AND_QUILL, 1), new Object[] { Items.BOOK, new ItemStack(Items.INK_SACK, 1, 0), Items.FEATHER});
this.registerShapedRecipe(new ItemStack(Blocks.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Items.STICK});
By exploiting these patterns, you can parse out a set of items and recipes for the main Minecraft application easily enough. However, because you're relying on source code parsing this technique is subject to being trivially broken in the likely event that the code structure changes (it may already be broken, I am looking at an old copy of the decompiled code to find these examples).
Worse still, mods may not use the same patterns and you are certainly likely to see different patterns across mods. You may be able to build a system that uses a unique, slightly-modified set of parse rules for each mod (and the main application), and this may be less work in the long run than manually adding every item and recipe to your database... but it's unfortunately still subject to being trivially broken by new version of the mods or the main executable.