JigsawPropertiesFix.java

net.minecraft.util.datafix.fixes.JigsawPropertiesFix

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public JigsawPropertiesFix(Schema schema, boolean changesType) @ L9

  • 构造器名:JigsawPropertiesFix
  • 源码定位:L9
  • 修饰符:public

参数:

  • schema: Schema
  • changesType: boolean

说明:

TODO

方法

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

private static Dynamic<?> fixTag(Dynamic<?> tag) @ L13

  • 方法名:fixTag
  • 源码定位:L13
  • 返回类型:Dynamic<?>
  • 修饰符:private static

参数:

  • tag: Dynamic<?>

说明:

TODO

protected Typed<?> fix(Typed<?> entity) @ L23

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

参数:

  • entity: Typed<?>

说明:

TODO

代码

public class JigsawPropertiesFix extends NamedEntityFix {
    public JigsawPropertiesFix(Schema schema, boolean changesType) {
        super(schema, changesType, "JigsawPropertiesFix", References.BLOCK_ENTITY, "minecraft:jigsaw");
    }
 
    private static Dynamic<?> fixTag(Dynamic<?> tag) {
        String oldName = tag.get("attachement_type").asString("minecraft:empty");
        String oldPool = tag.get("target_pool").asString("minecraft:empty");
        return tag.set("name", tag.createString(oldName))
            .set("target", tag.createString(oldName))
            .remove("attachement_type")
            .set("pool", tag.createString(oldPool))
            .remove("target_pool");
    }
 
    @Override
    protected Typed<?> fix(Typed<?> entity) {
        return entity.update(DSL.remainderFinder(), JigsawPropertiesFix::fixTag);
    }
}

引用的其他类