CottonMC / CottonResources

Reference mod for ores, ingots, tools, liquids, and all you can imagine.
MIT License
17 stars 12 forks source link

Unused Tags in Crafting Recipes Become Air Blocks #70

Closed TechnoVisionDev closed 3 years ago

TechnoVisionDev commented 3 years ago

Describe the bug Not entirely sure if this is a bug with Fabric, CottonResources, or just an error on my part? I use CottonResources tags for crafting in one of my mods, but none of my items are actually registered in these tags (meaning they are empty). If a player has my mod loaded with another mod that uses these tags (for copper ingots for example), they can craft specialty items using those materials. If they don't, the crafting recipes are meant to just be unavailable for crafting (this is how forge tags work).

It seems that currently, if a CottonResources tag is used in a crafting recipe but no mod is loaded that adds items to those tags, then the crafting recipes actually accepts air blocks instead of those tags. This means that items that specify tags in their crafting recipe can be crafted with an empty crafting table. Very strange and doesn't seem like how tags are supposed to function, though I could certainly be wrong on this.

To Reproduce Steps to reproduce the behavior:

  1. Do NOT add CottonResources as a dependency
  2. Create one of the c/tags/items jsons yourself
  3. Use this tag in one of your crafting recipes alongside a vanilla item
  4. Load the game without any other mods that add to this c/tag
  5. Attempt to craft the item with just the vanilla items
  6. You will be able to craft the item using air blocks in place of the c/tag

Expected behavior Optional Similar to forge tags, if the c/tags are never modified then the crafting recipe should simply not work and be unavailable. For some reason, these c/tags are turning into air blocks when nothing is added to them.

Version of the (please complete the following information):

Additional context Optional This is currently an issue with my fabric port of IronChests. It seems that CottonResources do not act the way forge tags act because of this bug. If you would like to check out this issue yourself, load up my mod with nothing else besides the Fabric API and throw a wooden plank in the crafting table. You will see this does not match up with the crafting recipe at all! My Mod: https://www.curseforge.com/minecraft/mc-mods/iron-chests-fabric

Juuxel commented 3 years ago

Hmm, this can't be a CR bug since it's not installed. I feel like Fabric API shouldn't touch this either, so it could be a vanilla bug with empty tags.

LemmaEOF commented 3 years ago

Checking the source, this is vanilla behavior. If an ingredient has no possible matching stacks, then it matches against an empty item stack. That's how it serializes empty ingredient stacks. I'm afraid the only real solution would be a mixin to check if the tag was empty, but that's out of scope for Cotton Resources, I'm afraid.