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