EntityFallDistanceFloatToDoubleFix.java
net.minecraft.util.datafix.fixes.EntityFallDistanceFloatToDoubleFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.EntityFallDistanceFloatToDoubleFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/EntityFallDistanceFloatToDoubleFix.java
- 起始行号:L10
- 继承:DataFix
- 职责:
TODO
字段/常量
type- 类型:
TypeReference - 修饰符:
private final - 源码定位:
L11 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public EntityFallDistanceFloatToDoubleFix(Schema outputSchema, TypeReference type) @ L13
- 构造器名:EntityFallDistanceFloatToDoubleFix
- 源码定位:L13
- 修饰符:public
参数:
- outputSchema: Schema
- type: TypeReference
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected TypeRewriteRule makeRule() @ L18
- 方法名:makeRule
- 源码定位:L18
- 返回类型:TypeRewriteRule
- 修饰符:protected
参数:
- 无
说明:
TODO
private static Typed<?> fixEntity(Typed<?> entity) @ L27
- 方法名:fixEntity
- 源码定位:L27
- 返回类型:Typed<?>
- 修饰符:private static
参数:
- entity: Typed<?>
说明:
TODO
代码
public class EntityFallDistanceFloatToDoubleFix extends DataFix {
private final TypeReference type;
public EntityFallDistanceFloatToDoubleFix(Schema outputSchema, TypeReference type) {
super(outputSchema, false);
this.type = type;
}
@Override
protected TypeRewriteRule makeRule() {
return this.fixTypeEverywhereTyped(
"EntityFallDistanceFloatToDoubleFixFor" + this.type.typeName(),
this.getOutputSchema().getType(this.type),
EntityFallDistanceFloatToDoubleFix::fixEntity
);
}
private static Typed<?> fixEntity(Typed<?> entity) {
return entity.update(
DSL.remainderFinder(),
remainder -> remainder.renameAndFixField("FallDistance", "fall_distance", fallDistance -> fallDistance.createDouble(fallDistance.asFloat(0.0F)))
);
}
}引用的其他类
- Schema
- 引用位置:
参数
- 引用位置: