2

I have a small question: does Minecraft JE allow NBT tags in crafting recipes? Because I'm making a map in 1.14.3 and some part of the map need custom NBT tags crafting and I need to use custom crafting chest to make it

2

Big answer to small question:

No.

You need to do one of the old styles of custom crafting, like throwing items on the ground or checking for a dispenser with certain items in it or something like that.

2
2

Here's a very good workaround I shamelessly copied from Michael P.'s answer here (side notes mine):

  1. Set the recipe's "result" to a particular item that a player is not likely to ever have in their inventory (e.g. Spawn Eggs, Bedrock, Command Blocks).
  2. Create an advancement that a player achieves either by crafting your custom recipe or by acquiring the intermediate item into their inventory.
  3. Set the reward of the advancement to trigger a custom function.
  4. Have the custom function remove the intermediate item from the player's inventory and add the actual result with the NBT data.

Side note: Consider revoking the advancement in the function, so that the result replacement can happen multiple times. Unless custom advancements can be granted multiple times, for which I see no indication on the wiki.

Another side note: Didn't test it yet, but this probably doesn't work well with stack-crafting, i.e. you fill in the materials multiple times and then shift-click out the result. Most likely, doing that will only yield one item and have the rest of the materials go to waste. (I'm lucky in that regard, because the recipes I have in mind involve unstackable items.)

UPDATE: I tried it out with a mod item (one of the trophies from Dimensional Dungeons), and it works, but it's a bit wonky. In Creative Mode, it gives you the NBT item immediately, but doesn't clear the intermediate item. In Survival Mode, the intermediate item is cleared and the NBT item is given, but only next time you click a Crafting Table (other container-ish blocks might work as well). Tested under MineCraft 1.15.2, Forge 31.2.37; things might look different in other versions.

3
  • sounds good man, i might try it soon Nov 21 '20 at 2:42
  • @ILikeFish By the way, I'm currently trying out if datapack recipes (and datapacks in general) can use items that are added by mods. If it works, I'm planning to make a mod that literally just adds 64 items that do absolutely nothing, for stuff like this.
    – Egor Hans
    Nov 26 '20 at 18:18
  • @ILikeFish In case edits don't trigger notifications, I made an update with the results of my experiments.
    – Egor Hans
    Nov 26 '20 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.