Fabricators-of-Create / Create

[Fabric Mod] Building Tools and Aesthetic Technology
MIT License
827 stars 185 forks source link

remove addStochasticTooltip bulk version #1421

Closed ypf791 closed 3 weeks ago

ypf791 commented 4 weeks ago

I made a mistake when trying to fix the problem of recipe chance in REI (#646, #902), which results in serveral REI crash issues (#1382, #1395, #1406, etc.) and leaves the chance display issue unsolved (#1393).

@TropheusJ fixed #1393 by avoid using the bulk version CreateRecipeCategory::addStochasticTooltip(List<Widget>, List<ProcessingOutput>, int), and I think it can be better not to use it at all. For all current use cases, they can alternatively just add tooltip right after any slot created, and I think it is much more straight-forward. In other words, addStochasticTooltip(Slot slot, ProcessingOutput output) is sufficient to all current usages.

@IThundxr fixed #1382 (and all those crashes) by detecting illegal indexing here, which does not fixed the root cause where slotIndex is computed incorrectly in CreateRecipeCategory::addStochasticTooltip(List<Widget>, List<ProcessingOutput>, int). It means that any recipe using the bulk version function would put output chance incorrectly to other slots.

For now, deploying, polishing and basin (including mixing and compacting) recipes are still using the bulk version function. Once a customized recipe with chance is added (via mod, datapack, KubeJS, etc.), the problem will float on the table.

In this pull request, I introduced addStochasticTooltip(Slot slot, ProcessingOutput output) and removed all other overloads.

TropheusJ commented 3 weeks ago

thanks, this is much better.