User Tools

Site Tools


tutorial:datagen_buckets

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:datagen_buckets [2023/06/21 10:21] – [Overview] tinypandastutorial:datagen_buckets [2023/06/21 17:30] (current) – [Client registration] tinypandas
Line 4: Line 4:
 Version: 1.20+ Version: 1.20+
  
-This section will cover the process around creating bucket textures for your fluids utilizing ''FabricModelProvider''. This is useful if you plan to have many fluids that can use the **Water Bucket** texture.+This section will cover the process around creating bucket textures for your fluids utilizing ''FabricModelProvider''. This is useful if you plan to have many fluids whose texture will be similar to the **Water Bucket** texture.
  
 While this guide is specifically tailored towards buckets, it can be applied to anything with enough creativity. While this guide is specifically tailored towards buckets, it can be applied to anything with enough creativity.
Line 49: Line 49:
 </code> </code>
  
 +
 +Here our ''getColor(int tintIndex)'' will return the defined ''fluidColor'' value when our ''tintIndex'' is ''1'' (this can be associated with the number of the texture layer). By returning ''-1'', we are saying that the color should remain as is in the image (which in this case is our base bucket image).
 ===== Create our bucket item ===== ===== Create our bucket item =====
  
Line 106: Line 108:
  @Override  @Override
  public void onInitializeClient() {  public void onInitializeClient() {
- ColorProviderRegistry.ITEM.register((stack, tintIndex) -> ((CustomBucket) ExampleMod.RED_WATER_BUCKET).getColor(tintIndex), ExampleMod.RED_WATER_BUCKET); + ColorProviderRegistry.ITEM.register((stack, tintIndex) -> ((CustomBucket) stack.getItem()).getColor(tintIndex), 
- ColorProviderRegistry.ITEM.register((stacktintIndex) -> ((CustomBucket) ExampleMod.GREEN_WATER_BUCKET).getColor(tintIndex), ExampleMod.GREEN_WATER_BUCKET); + ExampleMod.RED_WATER_BUCKET, ExampleMod.GREEN_WATER_BUCKET, ExampleMod.BLUE_WATER_BUCKET);
- ColorProviderRegistry.ITEM.register((stack, tintIndex) -> ((CustomBucket) ExampleMod.BLUE_WATER_BUCKET).getColor(tintIndex), ExampleMod.BLUE_WATER_BUCKET);+
  }  }
 </code> </code>
Line 114: Line 115:
 ===== Final Result ===== ===== Final Result =====
  
-Now that we have reached the end, upon starting up minecraft and joining a world, we should be able to `/give @a examplemod:red_water_bucketand see we now have a red water bucket! (I'll leave adding translations and item grouping to you! 8-) )+{{:tutorial:buckets.png?400|}} 
 + 
 +Now that we have reached the end, upon starting up minecraft and joining a world, we should be able to ''/give @a examplemod:red_water_bucket'' and see we now have a red water bucket! (I'll leave adding translations and item grouping to you! 8-) )
  
 ''[[https://github.com/TinyPandas/DataGenBucketsTutorial|Source Code]]'' ''[[https://github.com/TinyPandas/DataGenBucketsTutorial|Source Code]]''
tutorial/datagen_buckets.1687342891.txt.gz · Last modified: 2023/06/21 10:21 by tinypandas