Jump to content

[1.19.4] How to properly add a custom trimming material?


JimiIT92

Recommended Posts

I'm trying to add a custom trimming material using one of my mod items.
However when I load a world I get this error

[23:06:47] [Render thread/ERROR] [minecraft/ArmorTrim]: Failed to get element ResourceKey[minecraft:trim_material / mineworld:ruby]

So far I've registered my new material like this
 

public static final ResourceKey<TrimMaterial> RUBY = ResourceKey.create(Registries.TRIM_MATERIAL, new ResourceLocation("mineworld", "ruby"));

public static void bootstrap(BootstapContext<TrimMaterial> context) {
  TrimMaterial trimmaterial = TrimMaterial.create(
                RUBY.location().getPath(),
                MWItems.RUBY.get(),
                0.85F,
                Component.translatable(Util.makeDescriptionId("trim_material", RUBY.location())).withStyle(Style.EMPTY.withColor(0x9F3535)),
                Map.of());
        context.register(resourceKey, trimmaterial);
}

I've then created the file `data/mineworld/trim_material/ruby.json` like so
 

{
  "asset_name": "ruby",
  "description": {
    "color": "#9F3535",
    "translate": "trim_material.mineworld.ruby"
  },
  "ingredient": "mineworld:ruby",
  "item_model_index": 0.85
}

And referenced the new trim in `data/minecraft/tags/items/trim_materials.json`
 

{
  "replace": false,
  "values": [
    "mineworld:ruby"
  ]
}

I've also added the color palette texture inside `assets/mineworld/textures/trims/color_palettes/ruby.png`

Do I need to specify something else in order for this to work? 

EDIT: 

The item texture uses an incorrect color (it should be red), while the model texture shows the black/purple texture
Qp8QnHf.png

Edited by JimiIT92
The error was caused by the trim_material file being in the wrong location. I moved it under the data folder and the error is gone. However the rendering is broken.

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

I know virually nothing about trim materials.

But I do know;

* They are 1.20 feature (experimental in 1.19.4)

* Trim materials are in the datapack not the resource pack so they should be in data/ not assets/

https://github.com/misode/mcmeta/tree/data/data/minecraft/trim_material

 

Also, if you just post snippets of code and error messages out of context like the above, you will likely just get ignored unless the error is immediately obvious.

Post full logs and code on github so we can see everything in context.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Yeah, I've just edited the post since I found out that the trim_material json file was in the wrong location. All I got now is a rendering issue, but looking through the vanilla files I have no clue what it also missing.
As for the code you can find it here: https://github.com/JimiIT92/MineWorld

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Looks like it is using the purple/black missingno texture (i.e. not found). I bet you have a warning in the log?

I guess you need to configure the atlases to load your textures.

https://github.com/misode/mcmeta/blob/assets/assets/minecraft/atlases/armor_trims.json

https://github.com/misode/mcmeta/blob/assets/assets/minecraft/atlases/blocks.json

 

I would recommend reading the release notes: https://www.minecraft.net/da-dk/article/minecraft-java-edition-1-19-4 to see how Mojang intend this to work.

At least until they change it again for 1.20 🙂

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Surprisingly I don't have any warning in the log, nor when I apply the material or wear the armor with the trim material (i looked for "ruby" inside the log and found nothing. The console also shows no warning/error while running and applying the trim).

Anyway, adding the two files under assets/minecraft/atlases make the trim shows up inside the armor model. It still doesn't show inside the item, but I think is because I need an item model file too for that if I understand correctly.

Now, while this works, I don't like this approach, since you have to rewrite mostly of the atlas file. Specifically you need to specify all the different textures, which lead to the mod's trim being incompatible with other mods that may be adding custom trim patterns.

I guess I'll wait the full release of 1.20 to see what changes this feature gets and whether a proper implementation will be supplied by Forge, unless there's a way to "attach" values to the existing atlas without partially rewrite it.

The two files I ended up with are the followings

assets/minecraft/atlases/armor_trims.json

{
    "sources": [
        {
            "type": "paletted_permutations",
            "textures": [
                "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/wayfinder",
                "trims/models/armor/wayfinder_leggings",
                "trims/models/armor/shaper",
                "trims/models/armor/shaper_leggings",
                "trims/models/armor/silence",
                "trims/models/armor/silence_leggings",
                "trims/models/armor/raiser",
                "trims/models/armor/raiser_leggings",
                "trims/models/armor/host",
                "trims/models/armor/host_leggings"
            ],
            "palette_key": "trims/color_palettes/trim_palette",
            "permutations": {
                "ruby": "mineworld:trims/color_palettes/ruby"
            }
        }
    ]
}

 

assets/minecraft/atlases/blocks.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": {
                "ruby": "mineworld:trims/color_palettes/ruby"
            }
        }
    ]
}

 

For the Item I've also added the model override files, but it falls back to the diamond trim. I found this guide also explaining how to add those trims (https://misode.github.io/guides/custom-armor-trims/#adding-a-custom-trim-material), and even there it mentions this fallback, so it may be that it still doesn't work properly? I guess 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.