Dye.java
net.minecraft.client.color.item.Dye
信息
- 全限定名:net.minecraft.client.color.item.Dye
- 类型:public record
- 包:net.minecraft.client.color.item
- 源码路径:src/main/java/net/minecraft/client/color/item/Dye.java
- 起始行号:L15
- 实现:ItemTintSource
- 职责:
TODO
字段/常量
MAP_CODEC- 类型:
MapCodec<Dye> - 修饰符:
public static final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public int calculate(ItemStack itemStack, ClientLevel level, LivingEntity owner) @ L20
- 方法名:calculate
- 源码定位:L20
- 返回类型:int
- 修饰符:public
参数:
- itemStack: ItemStack
- level: ClientLevel
- owner: LivingEntity
说明:
TODO
public MapCodec<Dye> type() @ L25
- 方法名:type
- 源码定位:L25
- 返回类型:MapCodec
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record Dye(int defaultColor) implements ItemTintSource {
public static final MapCodec<Dye> MAP_CODEC = RecordCodecBuilder.mapCodec(
i -> i.group(ExtraCodecs.RGB_COLOR_CODEC.fieldOf("default").forGetter(Dye::defaultColor)).apply(i, Dye::new)
);
@Override
public int calculate(ItemStack itemStack, @Nullable ClientLevel level, @Nullable LivingEntity owner) {
return DyedItemColor.getOrDefault(itemStack, this.defaultColor);
}
@Override
public MapCodec<Dye> type() {
return MAP_CODEC;
}
}引用的其他类
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
DyedItemColor.getOrDefault()
- 引用位置: