Jump to content

Modded Items with Durability can't be used as Crafting Materials [SOLVED]


Recommended Posts

Posted (edited)

Hello, I'm Moonbad.

 

I've coded a recipe that uses items that never have their durability at maximum.

How can I make Minecraft understand that I can use them for crafting, even though they aren't in this totally state?

Edited by Doctor Moonbad
Posted (edited)

You probably need your own IRecipe implementation (post 1.12).

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
19 minutes ago, diesieben07 said:

Assuming you are speaking about 1.12.2 here. Use 32767 as the metadata value for your ingredient stacks.

I see. Thank you very much.

 

37 minutes ago, Draco18s said:

You probably need your own IRecipe implementation (post 1.12).

 

32 minutes ago, diesieben07 said:

In 1.14.4 this is the default behavior (only check Item, not metadata).

Looks like 1.14 seems much easier version to work with. Thanks.

Posted (edited)
48 minutes ago, diesieben07 said:

Assuming you are speaking about 1.12.2 here. Use 32767 as the metadata value for your ingredient stacks.

Where do I change the metadata value? I tried using:

@Override
	public int getMetadata(ItemStack stack) 
	{
		return 32767;
	}

 on the item's custom class, but it did not work. There's also no method available in 1.12.2 to set it after initializing the item.

 

Edit: I know it might be a stupid question, but please understand that I a Noob at programming using the Forge API, although I know how to code in Java, Lua, C# and Python.

Edited by Doctor Moonbad
Posted
20 minutes ago, Doctor Moonbad said:

Where do I change the metadata value? I tried using:


@Override
	public int getMetadata(ItemStack stack) 
	{
		return 32767;
	}

 on the item's custom class, but it did not work.

You need to not do it there. That's wrong. Remove it.

1 hour ago, diesieben07 said:

2767 as the metadata value for your ingredient

This means in the recipe.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
51 minutes ago, Draco18s said:

You need to not do it there. That's wrong. Remove it.

This means in the recipe.

Well, I tried using the "data", "meta" and "metadata" keys but they did not work.

What is the actual metadata key?

Edited by Doctor Moonbad
Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
Just now, Draco18s said:

Can I ask a question? I understood the "data" key as an NBT data as described here: https://minecraft.gamepedia.com/NBT_format

What it does to the ingredient, exactly?

Also, I've already tried changing it's value to 32767, 2767 and 12. None of them seems to work. Let me give you a screenshot of the recipe and the code I made on the JSON file, so you can tell me what I must do in these situations.

image.png.beced433d6d5d2399cf2daba343f60b7.png

 

Code:

{ 
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "RWW",
    "O U",
    "WWR"  ],
  "key": {
    "W": [
      {
        "item": "grazodiamod:terrametal_wire",
        "data": 0
      }
    ],

    "R": [
      {
        "item": "minecraft:redstone",
        "data": 0
      }
    ],

    "U": [
      {
        "item": "grazodiamod:magisolium_crystal",
        "data": 0
      }
    ],

    "O": [
      {
        "item": "grazodiamod:magisorbio_crystal",
        "data": 0
      }
    ]

  },
  "result": {
    "item": "grazodiamod:magimagnet",
    "data": 0
  }
}

 

Posted
15 minutes ago, Doctor Moonbad said:

    "U": [
      {
        "item": "grazodiamod:magisolium_crystal",
        "data": 0
      }
    ],

This value does not appear to be 32767

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
20 hours ago, diesieben07 said:

It sets the Item metadata. Formerly known as "damage value".

 

I do not see you using the special meadata value anywhere in your JSON file.

 

20 hours ago, Draco18s said:

This value does not appear to be 32767

 

I know it isn't there now, but I've tested it multiple times to be sure, trust me.

Posted (edited)
Just now, diesieben07 said:

... Please post what you actually tried instead of something else.

I've tried to use the value 32767 for the data value on as you two said multiple times. That's what I was talking about.

Edited by Doctor Moonbad
Posted

I'm going to explain everything again, with topics:

  • I have a recipe that has 2 items with variable durability as ingredients.
  • I can't craft with them unless they have their durability values set to max.
  • Changing the data value on the recipe to 32767 does NOT solve the problem.
  • The Minecraft version I'm working with is 1.12.2.
Posted (edited)
2 hours ago, diesieben07 said:

I don't know what you are doing (and can't test it, because you still have not provided your actual recipe file, I don't know why).

I just tested it, and this works flawlessly in 1.12.2: 


{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "##",
    "##"
  ],
  "key": {
    "#": {
      "item": "minecraft:iron_pickaxe",
      "data": 32767
    }
  },
  "result": {
    "item": "minecraft:stonebrick",
    "data": 0,
    "count": 4
  }
}

Have you tried a recipe with 2 items of that type, instead of only one?

Edited by Doctor Moonbad
Posted (edited)

I thought that the code bellow was the recipe. Also the items that I'm having problems with are the crystals.

On 9/5/2019 at 4:29 PM, Doctor Moonbad said:

Code:


{ 
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "RWW",
    "O U",
    "WWR"  ],
  "key": {
    "W": [
      {
        "item": "grazodiamod:terrametal_wire",
        "data": 0
      }
    ],

    "R": [
      {
        "item": "minecraft:redstone",
        "data": 0
      }
    ],

    "U": [
      {
        "item": "grazodiamod:magisolium_crystal",
        "data": 0
      }
    ],

    "O": [
      {
        "item": "grazodiamod:magisorbio_crystal",
        "data": 0
      }
    ]

  },
  "result": {
    "item": "grazodiamod:magimagnet",
    "data": 0
  }
}
Edited by Doctor Moonbad
Posted
48 minutes ago, Doctor Moonbad said:

Have you tried a recipe with 2 items of that type, instead of only one?

What do you mean?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
29 minutes ago, Draco18s said:

What do you mean?

 

3 hours ago, diesieben07 said:

I don't know what you are doing (and can't test it, because you still have not provided your actual recipe file, I don't know why).

I just tested it, and this works flawlessly in 1.12.2:


{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "##",
    "##"
  ],
  "key": {
    "#": {
      "item": "minecraft:iron_pickaxe",
      "data": 32767
    }
  },
  "result": {
    "item": "minecraft:stonebrick",
    "data": 0,
    "count": 4
  }
}

 

So, the code you gave me works perfectly as expected. But this one I made for testing didn't:

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "#WW",
    " W ",
    "WW#"
  ],
  "key": {
    "#": {
      "item": "minecraft:iron_pickaxe",
      "data": 32767
    }
  },
  "key": {
    "W": {
      "item": "minecraft:diamond_pickaxe",
      "data": 32767
    }
  },
  "result": {
    "item": "minecraft:stonebrick",
    "data": 0,
    "count": 4
  }
}

Can you guys please test? Also, I'm sorry for taking your time with this.

Posted (edited)
36 minutes ago, diesieben07 said:

Yes, the 2nd one you posted is invalid JSON (duplicate keys). 

So, the actual issue is that I'm writing it wrong. How it should be? I thought the name of the keys were "#" or "W".

 

EDIT: I remember now.

Edited by Doctor Moonbad
Posted
1 hour ago, Doctor Moonbad said:

"key": {

//stuff

}, "key": {

//things

},

I see two "key"s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Good News: I finally fixed it.

 

I was making typos the entire time, so it was basically a streak of bad luck, which got extended because of my lack of experience with the JSON files. The final, correct code is this one:

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
  	"DCC",
  	"A B",
   	"CCD"
  ],
  "key": {
    "A": {
      "item": "grazodiamod:magisoli_crystal",
      "data": 32767
    },

    "B": {
      "item": "grazodiamod:magisorbeo_crystal",
      "data": 32767
    },

    "C": {
      "item": "grazodiamod:terrametal_wire",
      "data": 0
    },

    "D": {
      "item": "minecraft:redstone",
      "data": 0
    }
  },

  "result": {
    "item": "grazodiamod:magimagnet",
    "data": 0
  }
}

 

Thanks Draco and Diesieben, you helped me understand what the actual heck was going on. I also need to apologize for taking your time, I'm truly sorry, it was a very simple problem.

Posted

...and this is why you use an IDE plugin that can find JSON errors for you.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.