Implement dynamic block tinting support with BlockTintsFactory integration#5357
Implement dynamic block tinting support with BlockTintsFactory integration#5357marchermans wants to merge 4 commits intoFabricMC:26.1.2from
Conversation
PepperCode1
left a comment
There was a problem hiding this comment.
This is a solid and simple API with only a few things that should be changed, but I am concerned about two use cases that this API does not consider. Please comment on how likely you think these are to come up in the future.
- Using dynamic tints and static tints at the same time; for example, a block may register static tint sources for indices 0 and 1, and then also want to collect dynamic tints for indices past 1. It is possible to always use the static sources through the dynamic system, but that is less convenient and potentially less efficient (see next point). What would the downside be of always collecting the static sources and then appending dynamic values? Also, ignoring the factory without warning in some cases seems like a footgun; even if the use case remains unsupported, this footgun can be solved by throwing exceptions during registration so that both static sources and a dynamic factory cannot be registered on the same block simultaneously.
- Computing dynamic tints lazily, likely for performance; static tints are always computed lazily, so there may be a case where it is desirable to do so for dynamic tints to. Or, perhaps not, as the whole list of tints is computed at once instead of individually per index.
I pushed a new commit with your requested changes, and with regards to your questions and how likely you think they happen:
Greets, Marc |
PepperCode1
left a comment
There was a problem hiding this comment.
Your changes are good and your explanations make sense to me. Thanks.
|
Please add a small test to the relevant test mod, it doesnt even need its own block. |
Done, I added a new block anyway because it was easier to test and figure out. The block placed will have two sides with different random colors each. |
TLDR:
Implement a way for mods to provide dynamic tints if they can not know the amount and implementation of block tint sources at startup.
Underlying changes:
Implementation: