IItemColor#getColorFromItemstack
receives two arguments: the
ItemStack
being rendered and the tint index, which specifies the model part being rendered. You can use both of these to determine which colour should be returned.
The tint index is similar to the render pass arguments of colour-related methods in previous versions.
For models that extend
builtin/generated
, each
layerN
texture has a tint index of
N
. For other models, you can specify the tint index for each face in the model file (see the wiki for a full specification of the model format).
For the singularity, you'd use the
ItemStack
's metadata to determine which index of the colour arrays to use and the tint index to determine which of the two arrays to look up the colour in (
colors2
if it's 0,
colors
if it's 1).
Look at the
IItemColor
of
Items.SPAWN_EGG
for an example of the colour being chosen based on the
ItemStack
and the tint index.