V3818_3.java

net.minecraft.util.datafix.schemas.V3818_3

信息

  • 全限定名:net.minecraft.util.datafix.schemas.V3818_3
  • 类型:public class
  • 包:net.minecraft.util.datafix.schemas
  • 源码路径:src/main/java/net/minecraft/util/datafix/schemas/V3818_3.java
  • 起始行号:L12
  • 继承:NamespacedSchema
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public V3818_3(int versionKey, Schema parent) @ L13

  • 构造器名:V3818_3
  • 源码定位:L13
  • 修饰符:public

参数:

  • versionKey: int
  • parent: Schema

说明:

TODO

方法

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

public static SequencedMap<String,Supplier<TypeTemplate>> components(Schema schema) @ L17

  • 方法名:components
  • 源码定位:L17
  • 返回类型:SequencedMap<String,Supplier>
  • 修饰符:public static

参数:

  • schema: Schema

说明:

TODO

public void registerTypes(Schema schema, Map<String,Supplier<TypeTemplate>> entityTypes, Map<String,Supplier<TypeTemplate>> blockEntityTypes) @ L57

  • 方法名:registerTypes
  • 源码定位:L57
  • 返回类型:void
  • 修饰符:public

参数:

  • schema: Schema
  • entityTypes: Map<String,Supplier>
  • blockEntityTypes: Map<String,Supplier>

说明:

TODO

代码

public class V3818_3 extends NamespacedSchema {
    public V3818_3(int versionKey, Schema parent) {
        super(versionKey, parent);
    }
 
    public static SequencedMap<String, Supplier<TypeTemplate>> components(Schema schema) {
        SequencedMap<String, Supplier<TypeTemplate>> components = new LinkedHashMap<>();
        components.put("minecraft:bees", () -> DSL.list(DSL.optionalFields("entity_data", References.ENTITY_TREE.in(schema))));
        components.put("minecraft:block_entity_data", () -> References.BLOCK_ENTITY.in(schema));
        components.put("minecraft:bundle_contents", () -> DSL.list(References.ITEM_STACK.in(schema)));
        components.put(
            "minecraft:can_break",
            () -> DSL.optionalFields(
                "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema)))))
            )
        );
        components.put(
            "minecraft:can_place_on",
            () -> DSL.optionalFields(
                "predicates", DSL.list(DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema)))))
            )
        );
        components.put("minecraft:charged_projectiles", () -> DSL.list(References.ITEM_STACK.in(schema)));
        components.put("minecraft:container", () -> DSL.list(DSL.optionalFields("item", References.ITEM_STACK.in(schema))));
        components.put("minecraft:entity_data", () -> References.ENTITY_TREE.in(schema));
        components.put("minecraft:pot_decorations", () -> DSL.list(References.ITEM_NAME.in(schema)));
        components.put("minecraft:food", () -> DSL.optionalFields("using_converts_to", References.ITEM_STACK.in(schema)));
        components.put("minecraft:custom_name", () -> References.TEXT_COMPONENT.in(schema));
        components.put("minecraft:item_name", () -> References.TEXT_COMPONENT.in(schema));
        components.put("minecraft:lore", () -> DSL.list(References.TEXT_COMPONENT.in(schema)));
        components.put(
            "minecraft:written_book_content",
            () -> DSL.optionalFields(
                "pages",
                DSL.list(
                    DSL.or(
                        DSL.optionalFields("raw", References.TEXT_COMPONENT.in(schema), "filtered", References.TEXT_COMPONENT.in(schema)),
                        References.TEXT_COMPONENT.in(schema)
                    )
                )
            )
        );
        return components;
    }
 
    @Override
    public void registerTypes(Schema schema, Map<String, Supplier<TypeTemplate>> entityTypes, Map<String, Supplier<TypeTemplate>> blockEntityTypes) {
        super.registerTypes(schema, entityTypes, blockEntityTypes);
        schema.registerType(true, References.DATA_COMPONENTS, () -> DSL.optionalFieldsLazy(components(schema)));
    }
}

引用的其他类