Jump to content

Recommended Posts

Posted

Hello guys just have a problem that I could be overseeing. My custom item is taking damage from crafting an item but it doesn't allow the crafting of the item again after it has taken damage.

 

My gist- https://gist.github.com/Bradenlawhead/494d4cb682fda0e8c97bc49c2d83c12a

 

Followed Choonster's code for a "Cutting Axe"- https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.12.2/src/main/java/choonster/testmod3/item/ItemCuttingAxe.java

 

Screenshots provided   vvvv

 

2018-07-12_00.48.29.png

2018-07-12_01.01.30.png

Posted (edited)

Think it has to do with the recipe json. Crafting will do a check on the item and if not the "same", it won't find it.  if the meta or damage are not the same, it will not think it is the same item.  Metas are small enough you can add mutliple metas into  a recipe json, but if you want damaged items to work, think you'll need to create your own IRecipe to handle the item matching. I'm working on 0 sleep, so if I'm not following your problem, sorry.

 

If you are trying to make your item repairable, then that is different solution

Edited by aw_wolfe
  • Thanks 1
Posted
  On 7/12/2018 at 6:08 AM, aw_wolfe said:

Think it has to do with the recipe json. Crafting will do a check on the item and if not the "same", it won't find it.  if the meta or damage are not the same, it will not think it is the same item.  Metas are small enough you can add mutliple metas into  a recipe json, but if you want damaged items to work, think you'll need to create your own IRecipe to handle the item matching. I'm working on 0 sleep, so if I'm not following your problem, sorry.

Expand  

That's what i'm thinking could be the json file.

Posted (edited)

Try 32767 for the input item's damage value in your crafting recipe, I hear that's the wildcard "match any" value.

That's already in the example

Edited by DaemonUmbra
  • Thanks 1

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted (edited)

This be a pain. Choonster's recipe is shapeless and it requires alot of recipe fixes. If anyone finds a easier way to do the json just post it.  (Not the json just how to do it better)

Edited by witherlord00
Posted

I think you are going to need to implement your own IRecipe. Follow choonsters example of ShapedArmourUpgradeRecipe (from your example you are looking at).  Yes, you'll need to add a couple classes, but then you can override the matches and getCraftingResult to match and damage.  Choonsters example is nice, because it still allows you to read from the json file....and he gives you all the code you need. To simplify you could hard code it in the IRecipe, but why ?

  • Thanks 1
Posted

If your item uses the container item system to damage itself (like my ItemCuttingAxe), you don't need to create your own recipe class; just use one of the existing Vanilla or Forge classes.

 

You only need to damage the item in the recipe if you're using an item from Vanilla or another mod.

  • Thanks 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.