OminousBannerBlockEntityRenameFix.java
net.minecraft.util.datafix.fixes.OminousBannerBlockEntityRenameFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.OminousBannerBlockEntityRenameFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/OminousBannerBlockEntityRenameFix.java
- 起始行号:L10
- 继承:NamedEntityFix
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
public OminousBannerBlockEntityRenameFix(Schema outputSchema, boolean changesType) @ L11
- 构造器名:OminousBannerBlockEntityRenameFix
- 源码定位:L11
- 修饰符:public
参数:
- outputSchema: Schema
- changesType: boolean
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected Typed<?> fix(Typed<?> entity) @ L15
- 方法名:fix
- 源码定位:L15
- 返回类型:Typed<?>
- 修饰符:protected
参数:
- entity: Typed<?>
说明:
TODO
代码
public class OminousBannerBlockEntityRenameFix extends NamedEntityFix {
public OminousBannerBlockEntityRenameFix(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType, "OminousBannerBlockEntityRenameFix", References.BLOCK_ENTITY, "minecraft:banner");
}
@Override
protected Typed<?> fix(Typed<?> entity) {
OpticFinder<?> customNameF = entity.getType().findField("CustomName");
OpticFinder<Pair<String, String>> textComponentF = DSL.typeFinder((Type<Pair<String, String>>)this.getInputSchema().getType(References.TEXT_COMPONENT));
return entity.updateTyped(
customNameF,
customName -> customName.update(
textComponentF,
pair -> pair.mapSecond(
name -> name.replace("\"translate\":\"block.minecraft.illager_banner\"", "\"translate\":\"block.minecraft.ominous_banner\"")
)
)
);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置: