PotionsPredicate.java
net.minecraft.core.component.predicates.PotionsPredicate
信息
- 全限定名:net.minecraft.core.component.predicates.PotionsPredicate
- 类型:public record
- 包:net.minecraft.core.component.predicates
- 源码路径:src/main/java/net/minecraft/core/component/predicates/PotionsPredicate.java
- 起始行号:L15
- 实现:SingleComponentItemPredicate
- 职责:
TODO
字段/常量
CODEC- 类型:
Codec<PotionsPredicate> - 修饰符:
public static final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public DataComponentType<PotionContents> componentType() @ L19
- 方法名:componentType
- 源码定位:L19
- 返回类型:DataComponentType
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean matches(PotionContents potionContents) @ L24
- 方法名:matches
- 源码定位:L24
- 返回类型:boolean
- 修饰符:public
参数:
- potionContents: PotionContents
说明:
TODO
public static DataComponentPredicate potions(HolderSet<Potion> potions) @ L29
- 方法名:potions
- 源码定位:L29
- 返回类型:DataComponentPredicate
- 修饰符:public static
参数:
- potions: HolderSet
说明:
TODO
代码
public record PotionsPredicate(HolderSet<Potion> potions) implements SingleComponentItemPredicate<PotionContents> {
public static final Codec<PotionsPredicate> CODEC = RegistryCodecs.homogeneousList(Registries.POTION)
.xmap(PotionsPredicate::new, PotionsPredicate::potions);
@Override
public DataComponentType<PotionContents> componentType() {
return DataComponents.POTION_CONTENTS;
}
public boolean matches(PotionContents potionContents) {
Optional<Holder<Potion>> potion = potionContents.potion();
return !potion.isEmpty() && this.potions.contains(potion.get());
}
public static DataComponentPredicate potions(HolderSet<Potion> potions) {
return new PotionsPredicate(potions);
}
}引用的其他类
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
RegistryCodecs.homogeneousList()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置: