Colouring Blocks and Items
- Colouring a block or item statically or dynamically
- When colouring a block
(IBlockColor), you have the following contexts:IBlockStateWorld(Nullable)BlockPos(Nullable)int tintIndex
- When colouring an item
(IItemColor), you have the following contexts:ItemStackint tintIndex
Timing to Register
- Any time after specified
BlockorItemis registered is suitable. - Recommend listening to
ColorHandlerEvent.BlockandColorHandlerEvent.Itemas 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 yourIBlockColorimplementation, you can return the valid colour depending on whattintIndexis in that specific call context. - For Items, each
"layer"can have an uniquetintIndex. When handling and registering yourIItemColorimplementation, you can return the valid colour depending on whattintIndexis in that specific call context.
