Colouring Blocks and Items
- Colouring a block or item statically or dynamically
- When colouring a block
(IBlockColor)
, you have the following contexts:IBlockState
World
(Nullable)BlockPos
(Nullable)int tintIndex
- When colouring an item
(IItemColor)
, you have the following contexts:ItemStack
int tintIndex
Timing to Register
- Any time after specified
Block
orItem
is registered is suitable. - Recommend listening to
ColorHandlerEvent.Block
andColorHandlerEvent.Item
as that gives a general timing of where all the mods would be registering their colouring handlers.
Usage Explanation
- For Blocks, each
BlockPartFace
(seen as the elements of a"facing"
JsonArray
) can have an uniquetintIndex
. When handling and registering yourIBlockColor
implementation, you can return the valid colour depending on whattintIndex
is in that specific call context. - For Items, each
"layer"
can have an uniquetintIndex
. When handling and registering yourIItemColor
implementation, you can return the valid colour depending on whattintIndex
is in that specific call context.