BlockEntityBannerColorFix.java

net.minecraft.util.datafix.fixes.BlockEntityBannerColorFix

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public BlockEntityBannerColorFix(Schema outputSchema, boolean changesType) @ L10

  • 构造器名:BlockEntityBannerColorFix
  • 源码定位:L10
  • 修饰符:public

参数:

  • outputSchema: Schema
  • changesType: boolean

说明:

TODO

方法

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

public Dynamic<?> fixTag(Dynamic<?> input) @ L14

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

参数:

  • input: Dynamic<?>

说明:

TODO

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

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

参数:

  • entity: Typed<?>

说明:

TODO

代码

public class BlockEntityBannerColorFix extends NamedEntityFix {
    public BlockEntityBannerColorFix(Schema outputSchema, boolean changesType) {
        super(outputSchema, changesType, "BlockEntityBannerColorFix", References.BLOCK_ENTITY, "minecraft:banner");
    }
 
    public Dynamic<?> fixTag(Dynamic<?> input) {
        input = input.update("Base", base -> base.createInt(15 - base.asInt(0)));
        return input.update(
            "Patterns",
            list -> DataFixUtils.orElse(
                list.asStreamOpt()
                    .map(stream -> stream.map(pattern -> pattern.update("Color", color -> color.createInt(15 - color.asInt(0)))))
                    .map(list::createList)
                    .result(),
                list
            )
        );
    }
 
    @Override
    protected Typed<?> fix(Typed<?> entity) {
        return entity.update(DSL.remainderFinder(), this::fixTag);
    }
}

引用的其他类