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