NamedEntityFix.java

net.minecraft.util.datafix.fixes.NamedEntityFix

信息

  • 全限定名:net.minecraft.util.datafix.fixes.NamedEntityFix
  • 类型:public abstract class
  • 包:net.minecraft.util.datafix.fixes
  • 源码路径:src/main/java/net/minecraft/util/datafix/fixes/NamedEntityFix.java
  • 起始行号:L11
  • 继承:DataFix
  • 职责:

    TODO

字段/常量

  • name

    • 类型: String
    • 修饰符: private final
    • 源码定位: L12
    • 说明:

      TODO

  • entityName

    • 类型: String
    • 修饰符: protected final
    • 源码定位: L13
    • 说明:

      TODO

  • type

    • 类型: TypeReference
    • 修饰符: protected final
    • 源码定位: L14
    • 说明:

      TODO

内部类/嵌套类型

构造器

public NamedEntityFix(Schema outputSchema, boolean changesType, String name, TypeReference type, String entityName) @ L16

  • 构造器名:NamedEntityFix
  • 源码定位:L16
  • 修饰符:public

参数:

  • outputSchema: Schema
  • changesType: boolean
  • name: String
  • type: TypeReference
  • entityName: String

说明:

TODO

方法

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

public TypeRewriteRule makeRule() @ L23

  • 方法名:makeRule
  • 源码定位:L23
  • 返回类型:TypeRewriteRule
  • 修饰符:public

参数:

说明:

TODO

protected abstract Typed<?> fix(Typed<?> entity) @ L34

  • 方法名:fix
  • 源码定位:L34
  • 返回类型:Typed<?>
  • 修饰符:protected abstract

参数:

  • entity: Typed<?>

说明:

TODO

代码

public abstract class NamedEntityFix extends DataFix {
    private final String name;
    protected final String entityName;
    protected final TypeReference type;
 
    public NamedEntityFix(Schema outputSchema, boolean changesType, String name, TypeReference type, String entityName) {
        super(outputSchema, changesType);
        this.name = name;
        this.type = type;
        this.entityName = entityName;
    }
 
    @Override
    public TypeRewriteRule makeRule() {
        OpticFinder<?> entityF = DSL.namedChoice(this.entityName, this.getInputSchema().getChoiceType(this.type, this.entityName));
        return this.fixTypeEverywhereTyped(
            this.name,
            this.getInputSchema().getType(this.type),
            this.getOutputSchema().getType(this.type),
            input -> input.updateTyped(entityF, this.getOutputSchema().getChoiceType(this.type, this.entityName), this::fix)
        );
    }
 
    protected abstract Typed<?> fix(final Typed<?> entity);
}

引用的其他类