How do I make it so that if an item is crafted with different items than another recipe, it has a different nbt tag?

Started by Matt The Banana on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make it so that if an item is crafted with different items than another recipe, it has a different nbt tag?

How do I make it so that if an item is crafted with different items than another recipe, it has a different nbt tag? I want to make an item that has feature that when it is crafted with a different flower, it gives a different potion effect. Like 1.14's suspicious stew.

https://imgur.com/gallery/foo0bEn

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Currently, Mcreator doesn't…
Wed, 05/15/2019 - 16:32

Currently, Mcreator doesn't really seem to support nbt very much (without custom code). Instead, just make a bunch of different items that give different effects.

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh. I already found out how…
Thu, 05/16/2019 - 19:21

Oh. I already found out how to do this with code. Thanks for the help though.

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can you give me the code…
Sat, 05/01/2021 - 09:19

can you give me the code please?

 

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Matt The Banana can you make…
Sat, 08/03/2024 - 02:57

Matt The Banana can you make the code open source please? I've spent around 2 days trying to figure this out.

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh my god. I just figured…
Sun, 08/04/2024 - 06:38

Oh my god. I just figured out how to do this. I know I may be a few years late, but to anybody who wants to do this too, here you go:
So, basically, to make a suspicious stew-like crafting recipe, you have to add NBT tags to the crafted item.
To do that, you have to first make a recipe, and lock the code.
After that, scroll down until you find the "result" part of the code.
Then under the "count: 1," add another line, which says "nbt":
Then you have to type "{\"CustomTag\":\"tag name here\"}". This will apply a NBT tag to the item that is crafted.

In the end, it should look something like this:

{
  "type": "minecraft:crafting_shapeless",
  "category": "misc",
  "ingredients": [
    {
      "item": "minecraft:cooked_beef"
    },
    {
      "item": "minecraft:glowstone_dust"
    }
  ],
  "result": {
    "item": "minecraft:cooked_beef",
    "count": 1,
    "nbt": "{\"CustomTag\":\"regen\"}"
  }
}

After that, make a procedure for "Player finishes using item", and make it check for the itemstack's NBT tag, if the NBT tag is the custom tag, it will apply an effect to the player.

I hope this helped.