Jump to content

[1.12] Strange problems with using NBT items in recipes


Wehavecookies56

Recommended Posts

So in my mod I have a bunch of materials that are all the same item but with different NBT data which means in order to use them as ingredients in recipes I need to use the type minecraft:item_nbt or make a IngredientFactory, both methods cause the same issues I that I will explain after this.

So here is my recipe json file first of all

{
	"type": "forge:ore_shapeless",
	"ingredients": [ 
		{ 
			"type": "minecraft:item_nbt",
			"item": "kk:synthesismaterial",
			"nbt": {
				"material": "sm.mythrilcrystal",
				"rank": "sm.rank.s"
			}
		}, 
		{ 
			"type": "forge:ore_dict",
			"ore": "gemDiamond"
		}
	],
	"result": {
		"item": "kk:mythrilinfuseddiamond"
	}
}

So as you can see it's a shapeless recipe that uses a diamond and the material from my mod with some NBT tags.The NBT sensitive ingredient works or at least appears to work fine.

Now the first problem is that when using the recipe book, the diamond is placed into the crafting grid but not the material from my mod however, it will not show as craft able if you don't have the material. Only really a minor problem.

A major problem I have is that the recipe will only work if my mod material is placed in the grid with a stack size of 1.

As you can see in the image below the recipe works

8byTMGG.png

However if the stack size is greater than 1 when placed in the grid it will not work

CxOEIzF.png

It will work though if I increase the stack size afterwards like so

HTExXU0.png

But after I take the result out this happens

MifeQhJ.png

And if the stack size of the diamond is greater than 1 as well as the material from my mod the same thing happens with both

X8Z6Ohk.png

If the material from my mod has a stack size of 1 but the diamonds have a stack size greater than 1 it will take 1 diamond and work as intended.

So this is quite a major issue as it allows for easy duplication. I'm have no clue what's causing this but I think it's something I need to do to fix it rather than a forge/vanilla issue as I haven't seen anyone else have this issue.

Any help is appreciated, thanks.

Link to comment
Share on other sites

This happens because IngredientNBT#apply uses ItemStack.areItemStacksEqualUsingNBTShareTag to check if the ItemStack argument matches the ingredient's ItemStack, but this also checks that the two ItemStacks have the same stack size.

 

This prevents the ingredient from matching when there's a stack of two ore more of the ingredient's item in the crafting grid.

 

I've reported this on GitHub here.

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.

Link to comment
Share on other sites

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.