Hey folks!
I am currently working on a "concept" item, and I need just a little help with one aspect of it.
Here's what I'm doing in a "nutshell": I've created a "magic staff", which has custom, "insertable" charge-orbs;
each orb gives the staff a single "magical use", before the ORB ONLY is destroyed. You craft the staff from three pieces, and then each orb has its own recipe as well. Now, for example, one of the ORB CHARGES makes the staff a "teleportation staff" when it's INSERTED into it (added to it using the crafting table, pretty basic...). When the teleportation staff as such is [shift]-right-clicked, I store the location of the block that the staff was pointing to in the staff's NBT compound. This is the location later used to teleport the player. Pretty straight-forward, so far...
Now, I want to be able to REMOVE the ORB from the staff (also in the crafting table) once it has been "charged", for storage, and later use (by once again re-inserting it into the staff...). BUT, I need to somehow "copy" the NBT data from the complete teleportation staff to the "charged" teleporation ORB because it will of course be a new, seperate item (got me?). Thus, the ORB, while seperated from the staff, still contains the selected location for the teleport. When the ORB is later re-attached (re-inserted) into the magic staff, the staff once again becomes a "teleporation" staff, and the NBT data saved within the ORB now once again gets copied to the teleporation staff's NBT compound.
So, what I need to do (sorry if this was long-winded) is somehow "intercept" the crafting table "handler", and a) Check if the contents of the crafting grid is a teleporation staff, and then b) if it is, then c) reate the ORB, with the staffs NBT data "copied" to it as the crafting result, whilst leaving the "normal", empty staff in the crafting grid.
As a secondary stage, I will also need to be able to re-attach the "charged" ORB to the normal staff, with the resulting teleporation staff having the NBT data from the charged orb.
But, to do any of this, I must somehow "intercept" the crafting table code, and I have looked long and hard at all of the vanilla code which pertains to crafting in any way. I know that , in later versions of Minecraft (later than 1.8, that is) there is something called ICraftingHandler, which would probably make this a lot easier; sadly, I don't think this will actually be that simple (but I could be wrong!).
ANY pointers on how to begin here will be much appreciated. With every passing day, with the help of various tutorials, reading the vanilla source, and with help from you folks, I am getting better at this. Soon, I hope to be able to help someone who is much like me today!
Thanks in advance,
ZTagre.