TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Bloomery recipes are only unique up to their fluid input.

alcatrazEscapee opened this issue ยท 3 comments

commented

Due to the way BloomeryRecipe#get scans for recipes in combination with BloomeryBlockEntity#addItemsFromWorld. Might be possible to improve the scan to collect all recipes matching a primary input, then narrow down again to recipes matching a catalyst as well.

Might also want to consider ratio based catalyst usage, while we're at it.

Noticed in discord by a user adding the following recipe via CT:

{
   "result":{
        "item": "create:andesite_alloy"},
        "fluid":{"ingredient":"tfc:metal/cast_iron",
        "amount": 10},
    "catalyst":{"item":"tfc:rock/loose/andesite"},
    "duration": 2000
}
commented

How about switching to bloomery recipes being like shapeless recipes, thus supporting an arbitrary number of ingredients and ratios between them, and also guaranteeing uniqueness.

Main complication (I think) would be overlapping recipes, but I'd say it's manageable if priority is given to recipes with greater number of items.

commented

No. Because the main complication is ensuring that bloomery operation is deterministic, and sensible. While I have seen use cases for recipes with non-unique fluid inputs I've seen nobody request >1 non-unique item input. It's a complication on our part that can be trivially re-expressed as a new item + catalyst recipe.

Moreover, it doesn't actually solve the complex part of scanning for a recipe. Shapeless recipes can compute a unique perfect matching given a set of inputs and set of ingredients. Bloomery recipes don't a priori have a set of inputs - they are given a set of possible inputs, and have to compute that some subset of that set exhibits a unique perfect matching with the set of ingredients.

commented

Sorry, I meant shapeless for the catalyst only. It would still be a single fluid input, but the catalyst would be a list of items.

For example:

{
  "result": {
    "item": "mymod:magic_iron_bloom"
  },
  "fluid": {
    "ingredient": "tfc:metal/cast_iron",
    "amount": 100
  },
  "catalyst": [
    {"item": "minecraft:charcoal"},
    {"item": "minecraft:diamond"},
  ]
  "duration": 15000
}

Consider we throw: an iron ingot, a piece of charcoal, a diamond, and a cobblestone. The bloomery will detect the ingot as the fluid item, and then find three recipes matching: one for tfc:raw_iron_bloom, other for mymod:magic_iron_bloom, and a third one for a different recipe also with iron. Considering the items present, it finds that it could make tfc:raw_iron_bloom and mymod:magic_iron_bloom. It selects the mymod:magic_iron_bloom because it requires the most ingredients.

You are right that a similar effect could be achieved by creating a "mymod:magic_catalyst" item crafted from charcoal and diamond, which can then be used as a bloomery catalyst.