I have tried to set up an item, when used in a crafting recipe takes 1 damage and leaves the item in the crafting table, I have it working but only with the first item that is crafted, once the item takes any damage it no longer works in the recipe.
I'm not sure which version of Forge you're programming in, but from the looks of it, you're using code that would've worked in recipes pre-1.5 (this got me too, so no worries).
In your recipe adding part, try
GameRegistry.addShapelessRecipe(new ItemStack(mod_herbsnpotions.potionMix, 1, 0), new ItemStack(mod_herbsnpotions.Grinder, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Item.sugar), new ItemStack(mod_herbsnpotions.potionIng, 1, 0)); // Damage
-1 will no longer work for the metadata value in Itemstacks. It's weird, I know, but... well, hopefully, that should solve things. Everything else looks pretty good, code-wise. Good luck with things, man.
Hey i also have this problem but i had what you said to try :/ so any other ideas?
All that happens is when I use two broken pestle and mortars together it gives me one complete pestle and mortar with no damage but taking damage form the 2 used in the crafting grid
GameRegistry.addShapelessRecipe(new ItemStack(ZulaCraft.dustMidnightBloom, 1, 0),
new ItemStack(ZulaCraft.midnightBloom, 1),
new ItemStack(ZulaCraft.mortarPestle, 1, 0));
I'm not sure which version of Forge you're programming in, but from the looks of it, you're using code that would've worked in recipes pre-1.5 (this got me too, so no worries).
In your recipe adding part, try
GameRegistry.addShapelessRecipe(new ItemStack(mod_herbsnpotions.potionMix, 1, 0), new ItemStack(mod_herbsnpotions.Grinder, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Item.sugar), new ItemStack(mod_herbsnpotions.potionIng, 1, 0)); // Damage
-1 will no longer work for the metadata value in Itemstacks. It's weird, I know, but... well, hopefully, that should solve things. Everything else looks pretty good, code-wise. Good luck with things, man.
Hey i also have this problem but i had what you said to try :/ so any other ideas?
All that happens is when I use two broken pestle and mortars together it gives me one complete pestle and mortar with no damage but taking damage form the 2 used in the crafting grid
GameRegistry.addShapelessRecipe(new ItemStack(ZulaCraft.dustMidnightBloom, 1, 0),
new ItemStack(ZulaCraft.midnightBloom, 1),
new ItemStack(ZulaCraft.mortarPestle, 1, 0));
If I'm understanding the problem right, that one is a bit trickier to do, in my experience, in spite of how simple it should be. What you COULD do is have it so that when your crafting handler detects two of the same tool (in this case, the mortar and pestle), it gets their combined durability, makes a new recipe for that specific durability and adds it to the game, but that results in a lot of unnecessary recipes. In my experience, that's something you want to avoid.
Alternatively, you could try using the onCreated() method to get a dedicated variable of the two durabilities in the crafting handler, set the tool's durability to THAT and than immediately change the variable back to a base value like 0, but that presents it own issues...
Ideally, if you could find the code that handles the vanilla tool crafting and mimic that, that should solve your problems, but coming up with an original solution is almost more trouble than it's worth... sorry I can't be more helpful than that.
Handler:
The item that should take damage:
Recipe:
I am the current developer of Hunting Traps Mod.
The way I have it should work, I think there is something wrong I just can't see and hopefully someone else can.
In your recipe adding part, try
-1 will no longer work for the metadata value in Itemstacks. It's weird, I know, but... well, hopefully, that should solve things. Everything else looks pretty good, code-wise. Good luck with things, man.
All that happens is when I use two broken pestle and mortars together it gives me one complete pestle and mortar with no damage but taking damage form the 2 used in the crafting grid
Ah, that works perfect, thank you.
Good to hear. Good luck with the new feature, man.
If I'm understanding the problem right, that one is a bit trickier to do, in my experience, in spite of how simple it should be. What you COULD do is have it so that when your crafting handler detects two of the same tool (in this case, the mortar and pestle), it gets their combined durability, makes a new recipe for that specific durability and adds it to the game, but that results in a lot of unnecessary recipes. In my experience, that's something you want to avoid.
Alternatively, you could try using the onCreated() method to get a dedicated variable of the two durabilities in the crafting handler, set the tool's durability to THAT and than immediately change the variable back to a base value like 0, but that presents it own issues...
Ideally, if you could find the code that handles the vanilla tool crafting and mimic that, that should solve your problems, but coming up with an original solution is almost more trouble than it's worth... sorry I can't be more helpful than that.