PlayerHeadBlockProfileFix.java
net.minecraft.util.datafix.fixes.PlayerHeadBlockProfileFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.PlayerHeadBlockProfileFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/PlayerHeadBlockProfileFix.java
- 起始行号:L9
- 继承:NamedEntityFix
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
public PlayerHeadBlockProfileFix(Schema outputSchema) @ L10
- 构造器名:PlayerHeadBlockProfileFix
- 源码定位:L10
- 修饰符:public
参数:
- outputSchema: Schema
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected Typed<?> fix(Typed<?> entity) @ L14
- 方法名:fix
- 源码定位:L14
- 返回类型:Typed<?>
- 修饰符:protected
参数:
- entity: Typed<?>
说明:
TODO
private <T> Dynamic<T> fix(Dynamic<T> entity) @ L19
- 方法名:fix
- 源码定位:L19
- 返回类型:
Dynamic - 修饰符:private
参数:
- entity: Dynamic
说明:
TODO
代码
public class PlayerHeadBlockProfileFix extends NamedEntityFix {
public PlayerHeadBlockProfileFix(Schema outputSchema) {
super(outputSchema, false, "PlayerHeadBlockProfileFix", References.BLOCK_ENTITY, "minecraft:skull");
}
@Override
protected Typed<?> fix(Typed<?> entity) {
return entity.update(DSL.remainderFinder(), this::fix);
}
private <T> Dynamic<T> fix(Dynamic<T> entity) {
Optional<Dynamic<T>> skullOwner = entity.get("SkullOwner").result();
Optional<Dynamic<T>> extraType = entity.get("ExtraType").result();
Optional<Dynamic<T>> profile = skullOwner.or(() -> extraType);
if (profile.isEmpty()) {
return entity;
} else {
entity = entity.remove("SkullOwner").remove("ExtraType");
return entity.set("profile", ItemStackComponentizationFix.fixProfile(profile.get()));
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ItemStackComponentizationFix.fixProfile()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置: