tutorial:colorprovider
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
tutorial:colorprovider [2019/10/25 17:43] – created draylar | tutorial:colorprovider [2019/10/25 17:47] – draylar | ||
---|---|---|---|
Line 19: | Line 19: | ||
==== Registering a Block Color Provider ==== | ==== Registering a Block Color Provider ==== | ||
To register a block to the block color provider, you'll need to use Fabric' | To register a block to the block color provider, you'll need to use Fabric' | ||
- | <code java [enable_line_numbers=" | + | <code java [enable_line_numbers=" |
ColorProviderRegistry.BLOCK.register(new BlockColorProvider() { | ColorProviderRegistry.BLOCK.register(new BlockColorProvider() { | ||
@Override | @Override | ||
Line 31: | Line 31: | ||
The model is also important: the main note here is that you are // | The model is also important: the main note here is that you are // | ||
- | <code json [enable_line_numbers=" | + | <code json [enable_line_numbers=" |
{ | { | ||
" | " | ||
Line 57: | Line 57: | ||
Here's the final result-- note that the original model used the '' | Here's the final result-- note that the original model used the '' | ||
{{https:// | {{https:// | ||
+ | |||
+ | ==== Registering an Item Color Provider ==== | ||
+ | Items are similar; the difference is the context provided. Instead of having a state, world, or position, you have access to the '' | ||
+ | <code java [enable_line_numbers=" | ||
+ | ColorProviderRegistry.ITEM.register((itemStack, | ||
+ | return 0x3495eb; | ||
+ | }, COLORED_ITEM); | ||
+ | </ | ||
+ | This would hue the item in our inventory in the same fashion as the block. | ||
+ | |||
+ | === Limitations === | ||
+ | One key issue with using the color provider is the lack of context in the item provider. This is why vanilla grass doesn' |
tutorial/colorprovider.txt · Last modified: 2023/11/18 08:37 by solidblock