![]() |
VOOZH | about |
This tutorial explains how to create a data pack and resource pack that adds custom trim materials or patterns. It assumes you already know how to create a data pack.
This example adds a new "Stripes" pattern that works with all the vanilla armor types and colors.
Let's start with the central file in the trim_pattern folder in the data pack.
data/example/trim_pattern/stripes.json{ "asset_id":"example:stripes", "description":{ "translate":"trim_pattern.example.stripes" } }
The next piece in the data pack is the smithing recipe. For the full JSON format, see Recipe ยง smithing_trim. The pattern field needs to be the ID of the trim pattern you added in the last step.
data/example/recipe/stripes_armor_trim.json{ "type":"minecraft:smithing_trim", "addition":"#minecraft:trim_materials", "base":"#minecraft:trimmable_armor", "template":"minecraft:stick", "pattern":"example:stripes" }
Moving on to the resource pack, the first step is to create the translation that we referenced in the trim pattern's [NBT Compound / JSON Object] description field.
assets/example/lang/en_us.json{ "trim_pattern.example.stripes":"Stripes Armor Trim" }
And now for the complicated bit: adding the texture permutations for the different colors and armor types. This is done by appending the minecraft:armor_trims atlas file.
assets/minecraft/atlases/armor_trims.json{ "sources":[ { "type":"minecraft:paletted_permutations", "textures":[ "example:trims/models/armor/stripes", "example:trims/models/armor/stripes_leggings" ], "palette_key":"trims/color_palettes/trim_palette", "permutations":{ "quartz":"trims/color_palettes/quartz", "iron":"trims/color_palettes/iron", "gold":"trims/color_palettes/gold", "diamond":"trims/color_palettes/diamond", "netherite":"trims/color_palettes/netherite", "redstone":"trims/color_palettes/redstone", "copper":"trims/color_palettes/copper", "emerald":"trims/color_palettes/emerald", "lapis":"trims/color_palettes/lapis", "amethyst":"trims/color_palettes/amethyst", "iron_darker":"trims/color_palettes/iron_darker", "gold_darker":"trims/color_palettes/gold_darker", "diamond_darker":"trims/color_palettes/diamond_darker", "netherite_darker":"trims/color_palettes/netherite_darker" } } ] }
textures to the colors in permutations.For the full JSON format, see Resource_pack ยง Atlases
The textures referenced in the atlas [NBT List / JSON Array] textures field should be grayscale images, using the same colors as the texture in [String] palette_key. The textures for this example can be downloaded here:
assets/example/textures/trims/models/armor/stripes.pngassets/example/textures/trims/models/armor/stripes_leggings.pngThis second example adds a new "Ender" material that works with all the vanilla armor types and colors.
Let's start with the trim_material.
data/example/trim_material/ender.json{ "asset_name":"ender", "description":{ "color":"#258474", "translate":"trim_material.example.ender" } }
For an item to be usable to apply a given material, it needs to be added to the #minecraft:trim_materials item tag.
data/minecraft/tags/item/trim_materials.json{ "values":[ "minecraft:ender_pearl" ] }
The item also needs to have the minecraft:provides_trim_material item component. You can for example use /give @s minecraft:ender_pearl[minecraft:provides_trim_material="example:ender"] to give yourself an ender pearl that can be used in the recipe. It is not possible to make all items of a type provide a material by default.
Moving on to the resource pack, the first step is to create the translation that we referenced in the trim material's [NBT Compound / JSON Object] description field.
assets/example/lang/en_us.json{ "trim_material.example.ender":"Ender Material" }
For trim materials, two atlas files need to be modified: one for the armor entity rendering and one for the inventory item models.
assets/minecraft/atlases/armor_trims.json{ "sources":[ { "type":"paletted_permutations", "textures":[ "trims/models/armor/bolt", "trims/models/armor/bolt_leggings", "trims/models/armor/flow", "trims/models/armor/flow_leggings", "trims/models/armor/coast", "trims/models/armor/coast_leggings", "trims/models/armor/sentry", "trims/models/armor/sentry_leggings", "trims/models/armor/dune", "trims/models/armor/dune_leggings", "trims/models/armor/wild", "trims/models/armor/wild_leggings", "trims/models/armor/ward", "trims/models/armor/ward_leggings", "trims/models/armor/eye", "trims/models/armor/eye_leggings", "trims/models/armor/vex", "trims/models/armor/vex_leggings", "trims/models/armor/tide", "trims/models/armor/tide_leggings", "trims/models/armor/snout", "trims/models/armor/snout_leggings", "trims/models/armor/rib", "trims/models/armor/rib_leggings", "trims/models/armor/spire", "trims/models/armor/spire_leggings", "trims/models/armor/silence", "trims/models/armor/silence_leggings", "trims/models/armor/wayfinder", "trims/models/armor/wayfinder_leggings", "trims/models/armor/raiser", "trims/models/armor/raiser_leggings", "trims/models/armor/shaper", "trims/models/armor/shaper_leggings", "trims/models/armor/host", "trims/models/armor/host_leggings" ], "palette_key":"trims/color_palettes/trim_palette", "permutations":{ "ender":"example:trims/color_palettes/ender" } } ] }
assets/minecraft/atlases/items.json{ "sources":[ { "type":"paletted_permutations", "textures":[ "trims/items/leggings_trim", "trims/items/chestplate_trim", "trims/items/helmet_trim", "trims/items/boots_trim" ], "palette_key":"trims/color_palettes/trim_palette", "permutations":{ "ender":"example:trims/color_palettes/ender" } } ] }
textures to the colors in permutations.ender should match the [String] asset_name from the data pack.These atlas files reference a color palette texture which needs to be created. Since the vanilla palette key is used, the image has a width of 8 and a height of 1.
The textures for this example can be downloaded here:
The most time consuming step is to add the item model predicate to all the possible items. In this example it is only added for the iron chestplate.
assets/minecraft/items/iron_chestplate.json{ "model":{ "type":"minecraft:select", "cases":[ { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_quartz_trim" }, "when":"minecraft:quartz" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_iron_trim" }, "when":"minecraft:iron" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_netherite_trim" }, "when":"minecraft:netherite" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_redstone_trim" }, "when":"minecraft:redstone" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_copper_trim" }, "when":"minecraft:copper" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_gold_trim" }, "when":"minecraft:gold" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_emerald_trim" }, "when":"minecraft:emerald" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_diamond_trim" }, "when":"minecraft:diamond" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_lapis_trim" }, "when":"minecraft:lapis" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_amethyst_trim" }, "when":"minecraft:amethyst" }, { "model":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate_resin_trim" }, "when":"minecraft:resin" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_chestplate_ender_trim" }, "when":"example:ender" } ], "fallback":{ "type":"minecraft:model", "model":"minecraft:item/iron_chestplate" }, "property":"minecraft:trim_material" } }
The majority of this file is the same as the vanilla iron_chestplate model, only the highlighted region is added.
This references another item model file, which needs to be created.
assets/example/models/item/iron_chestplate_ender_trim.json{ "parent":"minecraft:item/generated", "textures":{ "layer0":"minecraft:item/iron_chestplate", "layer1":"minecraft:trims/items/chestplate_trim_ender" } }
This item model references the trims/items/chestplate_trim_ender sprite that was generated in the blocks.json atlas.
Because the override for all the other armor types hasn't been added, they will default to not showing any trim. To prevent this, the steps in this section need to be taken for each item in the #minecraft:trimmable_armor item tag.
This example adds the iron_axe as a trimmable item. Since this is not an armor item, we only need to worry about the item model. The trim pattern used will have no effect on the texture, only the trim material can be used in the model overrides.
The only change in the data pack is adding the item to the #minecraft:trimmable_armor item tag.
data/minecraft/tags/item/trimmable_armor.json{ "values":[ "minecraft:iron_axe" ] }
Moving to the resource pack by customizing the iron axe item model. This step is similar to the items models when adding a custom material, but this time all overrides need to be added.
assets/minecraft/items/iron_axe.json{ "model":{ "type":"minecraft:select", "cases":[ { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_quartz_trim" }, "when":"minecraft:quartz" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_iron_trim" }, "when":"minecraft:iron" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_netherite_trim" }, "when":"minecraft:netherite" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_redstone_trim" }, "when":"minecraft:redstone" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_copper_trim" }, "when":"minecraft:copper" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_gold_trim" }, "when":"minecraft:gold" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_emerald_trim" }, "when":"minecraft:emerald" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_diamond_trim" }, "when":"minecraft:diamond" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_lapis_trim" }, "when":"minecraft:lapis" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_amethyst_trim" }, "when":"minecraft:amethyst" }, { "model":{ "type":"minecraft:model", "model":"example:item/iron_axe_resin_trim" }, "when":"minecraft:resin" } ], "fallback":{ "type":"minecraft:model", "model":"minecraft:item/iron_axe" }, "property":"minecraft:trim_material" } }
The above file references custom item models for each material.
assets/example/models/item/iron_axe_amethyst_trim.json{ "parent":"minecraft:item/handheld", "textures":{ "layer0":"minecraft:item/iron_axe", "layer1":"example:trims/items/axe_trim_amethyst" } }
The above model files reference an axe_trim_amethyst texture. This texture does not exist, it needs to be generated by the paletted_permutations sprite source in the blocks.json atlas.
assets/minecraft/atlases/blocks.json{ "sources":[ { "type":"paletted_permutations", "textures":[ "example:trims/items/axe_trim" ], "palette_key":"trims/color_palettes/trim_palette", "permutations":{ "quartz":"trims/color_palettes/quartz", "iron":"trims/color_palettes/iron", "gold":"trims/color_palettes/gold", "diamond":"trims/color_palettes/diamond", "netherite":"trims/color_palettes/netherite", "redstone":"trims/color_palettes/redstone", "copper":"trims/color_palettes/copper", "emerald":"trims/color_palettes/emerald", "lapis":"trims/color_palettes/lapis", "amethyst":"trims/color_palettes/amethyst", "resin":"trims/color_palettes/resin" } } ] }
The atlas references the axe_trim texture, which is a mask for which pixels to color with the color palette.
The texture for this example can be downloaded here:
| Tutorials | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||