
Forging & Welding allowing accidental item deletion if specific recipes are added
Closed this issue ยท 0 comments
If recipes that output an itemstack with count > 1 are added along with recipes that consume that item, e.g. recipes of the form:
{
"__comment__": "Recipe 1",
"type": "tfc:anvil",
"input": {
"item": "example:item_a"
},
"result": {
"item": "example:item_b"
"count": 2
},
"tier": 1,
"rules": [
"punch_last",
"punch_second_last",
"punch_third_last"
]
}
{
"__comment__": "Recipe 2",
"type": "tfc:anvil",
"input": {
"item": "example:item_b"
},
"result": {
"item": "example:item_c"
},
"tier": 1,
"rules": [
"punch_last",
"punch_second_last",
"punch_third_last"
]
}
Then, if recipe 1 is completed directly followed by recipe 2, item_c
will replace the stack of 2 item_b
, even though only 1 item_b
should get consumed, effectively deleting one item_b
. The same effect can be observed when it is a welding, rather than forging, recipe.
This stems from the logic in the AnvilBlockEntity
class, as it simply assumes the input stacks to always have count 1. While this happens to be true in TFC itself (as no recipe akin to recipe 2 from the example exists), this is not guaranteed for addons. Therefore, the logic of that class needs to be adapted to properly address these edge cases