Nbt Crafting (Fabric)

Nbt Crafting (Fabric)

630k Downloads

[bug] Ingredients that share the same item ID causes dollar references i1+ to act as if they were i0.

Mario0051 opened this issue ยท 1 comments

commented

Version
20w46a , version 2.0.2+20w46a
Describe the bug
Trying to reference i1+ in a recipe where two ingredients have the same item ID only results in them acting as if they were i0.

To Reproduce

  1. Use this and craft two iron axes with mismatched durability together.
{
  "type": "minecraft:crafting_shapeless",
  "ingredients": {
      "item": "minecraft:iron_axe"
    },
    {
      "item": "minecraft:iron_axe"
    }
  },
  "result": {
    "item": "minecraft:iron_axe",
    "data": {
    "Damage": "$ (i0.Damage + i1.Damage) - 262",
      "Enchantments": [
        {
          "id": "minecraft:efficiency",
          "lvl": 3
        },
        {
          "id": "minecraft:unbreaking",
          "lvl": 1
        }
      ]
    }
    }
  }
}
  1. Result is 2 times the Damage tag value of i0 and 262 subtracted, not the Damage tag values of i0 and i1 added together and taking away 262.

Expected behavior
It was expected that the resulting damage to be the Damage tag values of i0 and i1 added together and taking away 262 instead of i1 acting the same as i0.

Log
Valid JSON, there should not be a need for a log as no error occurs.

Additional context
No additional context.

commented

That's from the backend a duplicate of #47.

It's basically me being lazy with the implementation of the resolution of dollar references. The problem is that at the point where the result is created there's no more evidence of which stacks were matched with which ingredient.
As I didn't want to make it even more complicated at the time I wrote the code I decided to let the mod just "guess" which ingredients match with which stacks.
I probably should at least respect the counts so each ingredient only takes one stack.