Custom Item Colors using Spawn Eggs

jumpsplat120

Helper
Staff member
Helper
Jun 24, 2020
59
8
8
www.jumpsplat120.com
Have you been looking for a way to get custom coloring on your items similar to mob spawn eggs, but you didn't want to manually color every custom item? Well, you can actually use the coloring of mob eggs, if you know how to format your resource pack correctly!

Step 1: Make your custom item, and give it a material based on the spawn egg you want the coloring from. For example, if you want the coloring from a chicken spawn egg, then set the material to chicken_spawn_egg. For example...
YAML:
skillable_item_chicken_essence:
    type: item
    debug: false
    material: chicken_spawn_egg
    display name: <reset>Chicken Mob Essence
    mechanisms:
        custom_model_data: 1


Step 2: Make two textures, the accent texture and the base texture. Both should be in greyscale.

Step 3: Make your own "template.json", similar to how MC does it. Your template needs to have three things; the item parent needs to be item/generated, and there need to be two layers, the base texture and the accent texture.
YAML:
{
    "parent": "item/generated",
    "textures": {
        "layer0": "item/custom/mob_essence_base",
        "layer1": "item/custom/mob_essence_accent"
    }
}

Step 3: In the models, add a custom model data override specifically in the chicken_spawn_egg.json. Point it towards the custom template you made.
YAML:
{
    "parent": "minecraft:item/template_spawn_egg",
    "overrides": [
        { "predicate": { "custom_model_data": 1 }, "model": "item/custom/spawn_egg/template_mob_essence" } ]
}
Minecraft has hardcoded the eggs to use layer0 and layer1 as "coloring" guides, and since your custom item is a spawn egg material, that same coloring system will apply the textures you created. That way, you don't need to make 67 uniquely colored items, but you can simply take advantage of how minecraft does it. What's more, when new mobs are added, you only need to add in the new mobs json, rather than needing to make wholly new textures. And if the colorings change for any of the spawn eggs, so will your custom item, so it will always match vanilla sensibilities!