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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm using Modrinth as a launcher for a forge modpack on 1.20.1, and can't diagnose the issue on the crash log myself. Have tried repairing the Minecraft instillation as well as removing a few mods that have been problematic for me in the past to no avail. Crash log is below, if any further information is necessary let me know. Thank you! https://paste.ee/p/k6xnS
    • Hey folks. I am working on a custom "Mecha" entity (extended from LivingEntity) that the player builds up from blocks that should get modular stats depending on the used blocks. e.g. depending on what will be used for the legs, the entity will have a different jump strength. However, something unexpected is happening when trying to override a few of LivingEntity's functions and using my new own "Mecha" specific fields: instead of their actual instance-specific value, the default value is used (0f for a float, null for an object...) This is especially strange as when executing with the same entity from a point in the code specific to the mecha entity, the correct value is used. Here are some code snippets to better illustrate what I mean: /* The main Mecha class, cut down for brevity */ public class Mecha extends LivingEntity { protected float jumpMultiplier; //somewhere later during the code when spawning the entity, jumpMultiplier is set to something like 1.5f //changing the access to public didn't help @Override //Overridden from LivingEntity, this function is only used in the jumpFromGround() function, used in the aiStep() function, used in the LivingEntity tick() function protected float getJumpPower() { //something is wrong with this function //for some reason I can't correctly access the fields and methods from the instanciated entity when I am in one of those overridden protected functions. this is very annoying LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 0f return this.jumpMultiplier * super.getJumpPower(); } //The code above does not operate properly. Written as is, the entity will not jump, and adding debug logs shows that when executing the code, the value of this.jumpMultiplier is 0f //in contrast, it will be the correct value when done here: @Override public void tick() { super.tick(); //inherited LivingEntity logic //Custom logic LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 1.5f } } My actual code is slightly different, as the jumpMuliplier is stored in another object (so I am calling "this.legModule.getJumpPower()" instead of the float), but even using a simple float exactly like in the code above didn't help. When running my usual code, the object I try to use is found to be null instead, leading to a crash from a nullPointerException. Here is the stacktrace of said crash: The full code can be viewed here. I have found a workaround in the case of jump strength, but have already found the same problem for another parameter I want to do, and I do not understand why the code is behaving as such, and I would very much like to be able to override those methods as intended - they seemed to work just fine like that for vanilla mobs... Any clues as to what may be happening here?
    • Please delete post. Had not noticed the newest edition for 1.20.6 which resolves the issue.
    • https://paste.ee/p/GTgAV Here's my debug log, I'm on 1.18.2 with forge 40.2.4 and I just want to get it to work!! I cant find any mod names in the error part and I would like some help from the pros!! I have 203 mods at the moment.
  • Topics

×
×
  • Create New...

Important Information

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