ColorableLib

模组

· 作者 NotPancerny

SuperbWarfare 库,用于轻松为载具上色。

0 本站下载 0 关注 更新于 6 个月前

需要前置:Superb Warfare

最新 1.0.0 · 26.1.2 · Forge

一键开服(送7天)

用于轻松实现 SuperbWarfare 载具着色的库。

ColorableLib 是一个专为 SuperbWarfare 插件设计的轻量级库。ColorableLib 基于 Capability 机制,实现了管理引擎和自动的服务端-客户端同步功能,并修改了 SuperbWarfare 的载具渲染器。

import colorable.capability.EntityColorCapability;
import net.minecraft.world.entity.Entity;

/**
 * ColorableLib API 的使用示例。
 */
public class ColorableExample {

    /**
     * 演示如何操作实体的颜色层。
     * 
     * @param targetEntity 要被着色的实体(必须支持该 capability)。
     * @param color        十进制或十六进制格式的颜色值(例如,0xFF0000 代表红色)。
     */
    public void exampleMethod(Entity targetEntity, int color) {
        // 访问目标实体的颜色 capability
        targetEntity.getCapability(EntityColorCapability.CAPABILITY).ifPresent(cap -> {
            if (!targetEntity.level().isClientSide) {
                
                // 添加或更新特定的颜色层
                cap.setLayer(targetEntity, "example_id", color);

                // 移除指定的颜色层
                cap.removeLayer(targetEntity, "example_id");
            }
        });
    }
}

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源