SDV-Mods icon indicating copy to clipboard operation
SDV-Mods copied to clipboard

CJB Item Spawner API

Open LeFauxMatt opened this issue 1 year ago • 6 comments

This is intended to be a draft of a possible api for CJB Item Spawner. I wanted to submit to facilitate the discussion. Currently all it does is allow the menu to be launched.

LeFauxMatt avatar Dec 18 '24 02:12 LeFauxMatt

I think it would be useful to be able to register Item providers, but I'm not sure the best way to handle that, since the internals are heavily reliant on SearchableItem.

Maybe SearchableItem could be replaced with regular Items by converting the utility methods it has to extensions and just using GetOne() to produce copies.

tlitookilakin avatar Jan 11 '25 01:01 tlitookilakin

Updated the proposal to add an api method for mods adding custom item repositories for returning additional searchable items.

LeFauxMatt avatar Jan 14 '25 18:01 LeFauxMatt

Added #236 as an alternative approach

LeFauxMatt avatar Jan 14 '25 18:01 LeFauxMatt

Hi! ItemRepository is shared across multiple repos (e.g. SMAPI and Lookup Anything have a copy for their own features). The item spawner ideally shouldn't customize its version, since (a) that would make it harder to keep up-to-date with the other repos and (b) the other repos won't benefit from the changes.

It already supports custom item type definitions automatically, so other mods should add custom items that way instead of integrating with mods like CJB Item Spawner one-by-one.

Pathoschild avatar Jan 14 '25 18:01 Pathoschild

I think @tlitookilakin had an example of a usecase that this would serve related to Profession Books, but I don't know the specific details so I'll let them explain if it would be needed for that.

LeFauxMatt avatar Jan 14 '25 19:01 LeFauxMatt

Profession Books and Better Beehouses both- the main issue is not an inability to add plain items, but an inability to define a specific range of variants of an item.

Better Beehouses, for example, has options to allow making honey from non-flower produce, and previously had to use harmony hacks to inject the new variants. Currently, it simply does not support Item Spawner or Lookup Anything.

Profession Books again adds specific variants of a single object through item queries.

Another thing worth considering in this general vein, though it does not affect me personally, is that many mods do add custom flavor/preserve items.

tlitookilakin avatar Jan 15 '25 02:01 tlitookilakin