Conversation
|
This sounds very similar to the extension models we tried to implement before, e.g., in AlterationEffects. I think we can find a general model of best practices to encourage a specific way of coding things like this. One thing that becomes apparent here is that the system is limited to a single group, and I'm wondering whether we can just go down this way, or whether we actually want a more free/generic model: contracts.register(new ShapeRecipe("module:recp1"), Tags.of("Basic", "Magic"));Second aspect I'd like to point it is that it would help to have a common library of sorts, which defines a (basic) set of known groups or tags, or at least a common practice on how to make these names available to other modules - using plain strings is (a) quite error prone, and (b) hard to extent/change later on. Referencing constant value from some dependency would definitely help here. |
What I'm thinking about doing is having a ContractSystem and a list of contracts that drive the types of recipes that a contract can fulfill. A contract will have a representative component that defines the type of crafting with some given inputs and outputs that can be used by other systems to plot out crafting relationships or something of the sort. I'm thinking of basing this on an kind of recursive event model where a contract is registered emits an event and other systems can then react and register their own contracts in response or remove a contract. Contracts are grouped by tags and each group with have a incrementing counter when the group has changed.
A crafting station can subscribe to a group change and update any kind of lookup in response. the contracts only serve of facilitate the recipes and a crafting table will fulfill the request and provide the items. Some basic crafting tables should be offered at a minimum. we can rely on other modules to provide the recipe or setup completely separate contracts. other contracts can be configured by other modules for more extravagant recipes not offered by this module. minigame for like smelting would have a different contract from a shape recipe used in a table.
events