HELP! How can I specify item damage in a recipe

Started by Arachne on

Topic category: Advanced modding

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
HELP! How can I specify item damage in a recipe

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 22:00, 11. Nov 2019
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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
Points:

User statistics:

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

 

I better just do uncraft the diamond sword

Last seen on 19:01, 30. May 2022
Joined Dec 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.