-
Notifications
You must be signed in to change notification settings - Fork 2
Dye Entries (Blocks and Items)
DyeableVariants are used to allow for less code to create Colored variants for Blocks or Items. These variants are used internally to allow for easy redyeing of items or blocks thru out other modules without being majorly hard coded. Variants will read if any of the Blocks or Items already exist from the Registry's before creating new ones.
Example Code Below:
// From Jello Example Mod:
public static final DyeableBlockVariant CONCRETE = DyeableBlockVariant.Builder.of(new Identifier("concrete"), itemSettings, () -> CONCRETE_POWDER, (dyeColorant, parentBlock) -> {
return new ColoredBlock(AbstractBlock.Settings.of(Material.STONE, MapColor.CLEAR).requiresTool().strength(1.8F), dyeColorant);
}).setBlockTags(BlockTags.PICKAXE_MINEABLE, BlockTags.NEEDS_STONE_TOOL)
.register();
Note: The block or Item class will need to implement the corresponding Block Or Item Color Provide or the Variants will not be Colored!
Internally Gelatin attempts to load models by checking for a base model to load and cache for the rest of the blocks from the mod that created the Varaiant.
All that is needed is a base gray scaled texture that will be colored by the Block or Item Color Provider and the corresponding rendering files (blockstate, model and item model) with the models require that each texture face to have a tint index (0 is fine) to allow for the Color Providers to Color the models.
Only Blockstate and Item Models must start with "colored_" combined with the given name for the variant i.e. for Concrete it would be colored_concrete.json
.
This API allows for a already existing Texture to be grayscaled and then injected into the Block atlas to allow for easy Block Coloring without creating a new Texture for Colored Blocks
Todo