Future feature: Grouped Chanced Ingredients
DilithiumThoride opened this issue ยท 0 comments
Cross-mod Integration
No response
Minecraft Version
None
Feature Description
[This is a feature that I'm working on but is not ready yet. I'm putting it here for tracking purposes.]
This is an idea that Ghosti had
A wish i had for here was like, grouped XOR
where you either get the 90% OR both of the 5%'s
but only one or the other
Proposal for how to do it:
- Content holds an additional value, Chance Group. probably a long, manipulated functionally as a hex string. This allows 16 different ingredient (/groups) to have 16 different chances. Our current highest ingredient count recipe map is the Assembly Line, which takes up to 16 items and 4 fluids, which is why I chose hex string over decimal number.
- GTRecipe's four ChanceLogics maps of
<RecipeCapability<?>, ChanceLogic>get replaced by two maps of<Long , ChanceLogic>(one for all chanced ingredient groups, one for all chanced tick ingredient groups) - All Contents with the same highest-order numbered group are passed into a chance logic function together
- Each hex digit represents another tier in the logic
- Logic tiers are processed recursively for each tier that rolls a success
- Ingredient chances are all rolled at recipe start, rather than per-handler. This is actually also a requirement for making Linked Ingredients (#4089) work correctly, and this is on my mind because I'm already rethinking how recipe logic has to flow for that.
- Rather than being deleted, any content item which fails its roll has its count set to 0. The reason for this is that if chanced contents are simply deleted from the current list, the Assembly Line's ordered inputs will break for chanced ingredients (because chance rolls are handled upfront rather than per-handler)
- For backwards compatibility, any recipes defined/created using the existing logic will have their existing handler groups be parsed into numbers
So the way this would look is
If you wanted to create the case Ghosti was proposing here (90% chance first item XOR 10% chance second two items together) it would look like
First item group 11, chance 100%. This sets it to group 1 with chance 100%, but associates it into group level 11
Second item group 12, chance 100%. This sets it to group 2 with chance 100%, but associates it into group level 12.
Third item group 12, chance 100%. This sets it to group 2 with chance 100%, but associates it into group level 12.
Recipe then also contains the following:
Group 10 chance logic XOR
Group 11 chance 90%
Group 12 chance 10%
Chance logic parser reads group 10 as XOR
Rolls for group 11 90%, group 12 10%
If it rolls 90%, it drops the first digit and processes group 1. Sees one item with 100%, returns it.
If it rolls 10%, it drops the first digit and processes group 2. Sees two items both with 100%, returns both of them.
Jurre proposed using an ArrayList rather than hex strings for clarity and to remove the limit of 16 distinct ingredients. I'm not sure if I like this or not because I feel like it would make it harder to establish clarity in the links.