SandboxPowered / SandboxDesign

0 stars 0 forks source link

Recipe API #3

Open TheCodedOne opened 4 years ago

TheCodedOne commented 4 years ago

Discussion around the recipe API.

The API should contain

Allowing items to replace other items (item/fluid/... containers for example) is not in scope (will either be added as a change to this api or as a different api).

Bluexin commented 4 years ago

One thing to also think about I think would be how to efficiently match against recipes. By generic ingredients, do you mean a system where people could add their own custom ingredient types ? (like a gas, or some special handling for containers)

TheCodedOne commented 4 years ago

Generic ingredients as in the ability to set a Fluid as an input or output, or potentially custom things if people choose

Bluexin commented 4 years ago

So I was imagining something like this for ingredients then :

etc. It should be fairly straight forward to add custom ingredient types later too. Wdyt ?

PS: I'm not 100% clear on how tags work, so I assumed similar to oreDict PS2: Idk if we have a fluid api here, but I just described something basic to show how it'd work PS3: I'm terrible at naming things

Bluexin commented 4 years ago

This would allow people to make an ingredient for their own custom /dev/null by making a custom Ingredient that would check for stacks of their item and be able to retrieve the correct info from.

Or maybe this specific use case shows we should split resolving ItemStacks to Ingredients or something. Where you could register multiple resolvers for the same input, each handling translating the input to one of the possible Ingredients it can be

For example, we wouldn't have ContainedFluidTagsIngredient, we'd only register one resolver to translate ItemStacks with a contained fluid to a FluidTagsIngredient.

TheCodedOne commented 4 years ago

Ingredients wouldn't be used for actual logic, they should be for defining the required items in the json. allowing a /dev/null to be used as an input should be a different API which allows the dev null to impersonate the required item, same should go for fluid tanks.

Bluexin commented 4 years ago
{
  "type": "minecraft:smelting",
  "ingredient": {
    "resource": "copper:ingot"
  }
}
{
  "type": "minecraft:smelting",
  "ingredient": {
    "resource": {
      "material": "copper",
      "type": "ingot"
    }
  }
}

People on discord seemed to prefer the second, although with some worry about verbosity