User Tools

Site Tools


tutorial:colorprovider

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:colorprovider [2019/10/25 17:47]
draylar
tutorial:colorprovider [2019/10/25 17:48] (current)
draylar
Line 17: Line 17:
 Remember that the color provider is a client-side mechanic. Make sure to put any code related to it inside a client initializer. Remember that the color provider is a client-side mechanic. Make sure to put any code related to it inside a client initializer.
  
-==== 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'​s ''​ColorProviderRegistry''​. There is an instance of the ''​BLOCK''​ and ''​ITEM''​ provider inside this class, which you can call register on. The register method takes an instance of your color provider and a varargs of every block you want to color with the provider. ​ To register a block to the block color provider, you'll need to use Fabric'​s ''​ColorProviderRegistry''​. There is an instance of the ''​BLOCK''​ and ''​ITEM''​ provider inside this class, which you can call register on. The register method takes an instance of your color provider and a varargs of every block you want to color with the provider. ​
 <code java [enable_line_numbers="​false"​]>​ <code java [enable_line_numbers="​false"​]>​
Line 58: Line 58:
 {{https://​i.imgur.com/​fZLS10g.png}} {{https://​i.imgur.com/​fZLS10g.png}}
  
-==== Registering an Item Color Provider ====+===== 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 ''​ItemStack''​. Items are similar; the difference is the context provided. Instead of having a state, world, or position, you have access to the ''​ItemStack''​.
 <code java [enable_line_numbers="​false"​]>​ <code java [enable_line_numbers="​false"​]>​
tutorial/colorprovider.txt ยท Last modified: 2019/10/25 17:48 by draylar