Armor Render Lib 是一个轻量级扩展库,用于 Fabric API 的 fabric-rendering-v1 ArmorRenderer。由于 Fabric API 的实现较为抽象,某些特定场景需要更具针对性的实现。这些场景出现在我的多个模组中,因此本着代码复用的精神,创建了该库。它非常稳健,仅使用少量高度聚焦的 mixin,并且与 Cosmetic Armor 和 GeckoLib 完全兼容。
构建
要将此库包含在你的项目中,请将以下内容复制到你的 build.gradle 文件中:
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>"
}
用法
Armor Render Lib 添加了盔甲渲染层。这些对象包含动态纹理位置、颜色和闪烁布尔值,用于渲染物品的盔甲(或多个物品)。它们大致相当于 Fabric API 的 ArmorRenderer#renderPart,但纹理、颜色和闪烁可以根据 ItemStack、LivingEntity 和 EquipmentSlot 动态指定。
注册方式如下:
public class ExampleMod implements ClientModInitializer {
private static ArmorRenderProvider render(ItemStack stack, LivingEntity entity, EquipmentSlot slot) {
// 动态纹理路径
String texture = "examplemod:textures/model/armor/example_chestplate.png";
// 动态颜色
int color = 0xFF00FF;
return data -> data.accept(texture, color, stack.hasGlint());
}
@Override
public void onInitializeClient() {
ArmorRenderLib.register(ExampleMod::render, Items.IRON_CHESTPLATE);
}
}
注意事项
- 一个物品可以注册多个不同的盔甲渲染层。
- 多个物品可以注册相同的盔甲渲染层。
- 将渲染层注册到原版物品(或其他盔甲物品)上会覆盖默认的盔甲渲染效果。
- 这意味着可以修改原版盔甲的纹理、颜色和/或附魔闪烁效果。
Armor Render Lib is a lightweight extension library to Fabric API's fabric-rendering-v1 ArmorRenderer. Since the Fabric API implementation is quite abstract, a more targeted implementation is needed for some specific use cases. These use cases are present across more than one of my mods, so in the spirit of code reuse this library was created. It is robust, using only a few very targeted mixins and is fully compatible with Cosmetic Armor and GeckoLib.
Build
To include this library in your project, copy the following into your build.gradle:
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>"
}
Use
Armor Render Lib adds armor render layers. These are objects containing a dynamic texture location, color and glint boolean that render armor for an item (or items). They are roughly equivalent to Fabric API's ArmorRenderer#renderPart, but the texture, color and glint can be dynamically specified based on the ItemStack, LivingEntity and EquipmentSlot.
They should be registered like so:
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);
}
}
Notes
- An item can have multiple different armor render layers registered to it.
- Multiple items can have the same armor render layer registered to them.
- Registering a render layer to a vanilla item (or other armor item) overrides the default armor rendering.
- This means that the texture, color and/or enchantment glint of vanilla armor can be modified.
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
下载 Armor Render Lib
未指定更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧