Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Dye Entries (Blocks and Items)

Blodhgarm edited this page Sep 3, 2022 · 2 revisions

Dyeable Variants

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!

Item Models and Blockstates

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.

Grayscaling Block Textures

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

DyeBlockTool Interface

Todo

Clone this wiki locally