HELP! How can I specify item damage in a recipe

Started by Arachne on Sun, 10/09/2016 - 12:57

Topic category: Advanced modding

Last seen on 22:54, 1. Dec 2016
Joined Oct 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
HELP! How can I specify item damage in a recipe
Sun, 10/09/2016 - 12:57

For example, I am trying to uncraft diamond sword into 2 diamonds and I want the sword to be in a certain,  or even any, damage state. 

There is no such option in the recipe creating GUI, so I looked into code and found this. 

    public void load(FMLInitializationEvent event) {
        ItemStack recStack = new ItemStack(Items.DIAMOND, 2);

        GameRegistry.addShapelessRecipe(recStack, new Object[]{Items.DIAMOND_SWORD,});
    }

I haved tried some editing ( e.g. {(Items.DIAMOND_SWORD, 1),} ), but then the mod cannot be recompiled.  

Please HELP! 

 

Last seen on 05:14, 22. Jul 2019
Joined Aug 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
That is not how that works
Sun, 10/09/2016 - 20:19

That is not how that works lol. However, tinkering with code is an easy way to figure out what works and what doesnt. Damage is stored as metadata I do believe

Last seen on 21:37, 14. Apr 2017
Joined Oct 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
 
Sat, 10/29/2016 - 15:44

 

I better just do uncraft the diamond sword

Last seen on 22:50, 23. Aug 2019
Joined Dec 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
To try this I would use
Sat, 10/29/2016 - 23:42

To try this I would use "Events" (Note: wont work with in game items, ie: diamond sword) but this could work with new mod wepaons. then choose "When recipe created" use the damage item event and choose how much.