Download Armor Render Lib — Minecraft Mods — MetaMods

Armor Render Lib

Active

Downloads

0

Last update

3 years ago

Versions

1.18.2 — 1.19.2
Client
Fabric
Weapons and armor
Libraries

Armor Render Lib

Armor Render Lib is a lightweight extension library for the fabric-rendering-v1 module from Fabric API. Since the standard Fabric API implementation is quite abstract, a more targeted approach is required for some specific use cases. This library was created for code reuse across various mods by the author.

Features

The library is reliable and uses a minimal number of targeted mixins. It is fully compatible with mods such as Cosmetic Armor and GeckoLib.

Project Integration

To add the library to your project, include the following lines in your build.gradle file:

repositories {
    maven {
        name = "Modrinth"
        url = "https://api.modrinth.com/maven"
        content {
            includeGroup "maven.modrinth"
        }
    }
}
dependencies {
    modImplementation "maven.modrinth:armor-render-lib:<version>"
    include "maven.modrinth:armor-render-lib:<version>"
}

Usage

Armor Render Lib adds armor render layers - objects containing dynamic texture location, color, and glow parameter that handle armor visualization for an item or multiple items. Functionally, they are similar to the ArmorRenderer#renderPart method from Fabric API, but with the ability to dynamically define texture, color, and glow effect based on ItemStack, LivingEntity, and EquipmentSlot.

Render layer registration is performed as follows:

public class ExampleMod implements ClientModInitializer {
    private static ArmorRenderProvider render(ItemStack stack, LivingEntity entity, EquipmentSlot slot) {
        // Dynamic texture path
        String texture = "examplemod:textures/model/armor/example_chestplate.png";

        // Dynamic color
        int color = 0xFF00FF;

        return data -> data.accept(texture, color, stack.hasGlint());
    }

    @Override
    public void onInitializeClient() {
        ArmorRenderLib.register(ExampleMod::render, Items.IRON_CHESTPLATE);
    }
}

Key Features

  • Multiple different armor render layers can be attached to a single item
  • The same render layer can be used for multiple different items
  • Registering a render layer for a standard armor item (or other armor item) overrides the standard armor rendering, allowing modification of texture, color, and/or enchantment effect of standard armor
Project members
clevernucleus

clevernucleus

Developer

Created: 27 Jul 2022

ID: 1664