EntityTypePredicate.java

net.minecraft.advancements.criterion.EntityTypePredicate

信息

  • 全限定名:net.minecraft.advancements.criterion.EntityTypePredicate
  • 类型:public record
  • 包:net.minecraft.advancements.criterion
  • 源码路径:src/main/java/net/minecraft/advancements/criterion/EntityTypePredicate.java
  • 起始行号:L12
  • 职责:

    TODO

字段/常量

  • CODEC
    • 类型: Codec<EntityTypePredicate>
    • 修饰符: public static final
    • 源码定位: L13
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public static EntityTypePredicate of(HolderGetter<EntityType<?>> lookup, EntityType<?> type) @ L16

  • 方法名:of
  • 源码定位:L16
  • 返回类型:EntityTypePredicate
  • 修饰符:public static

参数:

  • lookup: HolderGetter<EntityType<?>>
  • type: EntityType<?>

说明:

TODO

public static EntityTypePredicate of(HolderGetter<EntityType<?>> lookup, TagKey<EntityType<?>> type) @ L20

  • 方法名:of
  • 源码定位:L20
  • 返回类型:EntityTypePredicate
  • 修饰符:public static

参数:

  • lookup: HolderGetter<EntityType<?>>
  • type: TagKey<EntityType<?>>

说明:

TODO

public boolean matches(Holder<EntityType<?>> type) @ L24

  • 方法名:matches
  • 源码定位:L24
  • 返回类型:boolean
  • 修饰符:public

参数:

  • type: Holder<EntityType<?>>

说明:

TODO

代码

public record EntityTypePredicate(HolderSet<EntityType<?>> types) {
    public static final Codec<EntityTypePredicate> CODEC = RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE)
        .xmap(EntityTypePredicate::new, EntityTypePredicate::types);
 
    public static EntityTypePredicate of(HolderGetter<EntityType<?>> lookup, EntityType<?> type) {
        return new EntityTypePredicate(HolderSet.direct(type.builtInRegistryHolder()));
    }
 
    public static EntityTypePredicate of(HolderGetter<EntityType<?>> lookup, TagKey<EntityType<?>> type) {
        return new EntityTypePredicate(lookup.getOrThrow(type));
    }
 
    public boolean matches(Holder<EntityType<?>> type) {
        return this.types.contains(type);
    }
}

引用的其他类