Interface BlockTintsFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
If this factory provides any tints in the tintValues collections of its collect(BlockState, BlockAndTintGetter, BlockPos, IntList)
method then the default vanilla behaviour of iterating the registered block tint sources
is skipped.
This factory is only invoked if no tint source has been registered for the block state.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcollect(net.minecraft.world.level.block.state.BlockState state, net.minecraft.client.renderer.block.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, it.unimi.dsi.fastutil.ints.IntList tintValues) Invoked to collect the dynamic tint values for the given block state.
-
Method Details
-
collect
void collect(net.minecraft.world.level.block.state.BlockState state, net.minecraft.client.renderer.block.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, it.unimi.dsi.fastutil.ints.IntList tintValues) Invoked to collect the dynamic tint values for the given block state.The tint applied to a given
quadis then determined based on the index stored inBakedQuad.MaterialInfo.tintIndex()by looking them up in the tint values list after this collect method is called.The resulting tints might be cached for this state, level and position, while the given position and model are rendered, but may not be stored beyond that time window, especially not beyond any given frame being rendered.
The given tint list is guaranteed to be empty. It is recommended to call the
sizemethod if you at the start of the method, ahead of time, how many tints your system will eventually register as this will pre-allocate enough memory to hold your ints. If you use this mechanic, remember to usesetinstead ofaddto put the tint into the list, because add will always append to the end, even if pre-sized.This method will be invoked from multiple threads simultaneously, primarily from the chunk meshing threads, as such it is of the up most importance that you consider that while implementing this method. In particular use the block entity render data system to access custom data, instead of directly accessing the underlying block entity in the given position.
- Parameters:
state- The state for which the tints are retrieved.level- The level in which they are retrieved.pos- The position inside the level for which they are retrieved.tintValues- The target collection in which to store the tint values for the given index.
-