VillagerFollowRangeFix.java
net.minecraft.util.datafix.fixes.VillagerFollowRangeFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.VillagerFollowRangeFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/VillagerFollowRangeFix.java
- 起始行号:L8
- 继承:NamedEntityFix
- 职责:
TODO
字段/常量
-
ORIGINAL_VALUE- 类型:
double - 修饰符:
private static final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
NEW_BASE_VALUE- 类型:
double - 修饰符:
private static final - 源码定位:
L10 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public VillagerFollowRangeFix(Schema outputSchema) @ L12
- 构造器名:VillagerFollowRangeFix
- 源码定位:L12
- 修饰符:public
参数:
- outputSchema: Schema
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected Typed<?> fix(Typed<?> entity) @ L16
- 方法名:fix
- 源码定位:L16
- 返回类型:Typed<?>
- 修饰符:protected
参数:
- entity: Typed<?>
说明:
TODO
private static Dynamic<?> fixValue(Dynamic<?> tag) @ L21
- 方法名:fixValue
- 源码定位:L21
- 返回类型:Dynamic<?>
- 修饰符:private static
参数:
- tag: Dynamic<?>
说明:
TODO
代码
public class VillagerFollowRangeFix extends NamedEntityFix {
private static final double ORIGINAL_VALUE = 16.0;
private static final double NEW_BASE_VALUE = 48.0;
public VillagerFollowRangeFix(Schema outputSchema) {
super(outputSchema, false, "Villager Follow Range Fix", References.ENTITY, "minecraft:villager");
}
@Override
protected Typed<?> fix(Typed<?> entity) {
return entity.update(DSL.remainderFinder(), VillagerFollowRangeFix::fixValue);
}
private static Dynamic<?> fixValue(Dynamic<?> tag) {
return tag.update(
"Attributes",
attributes -> tag.createList(
attributes.asStream()
.map(
attribute -> attribute.get("Name").asString("").equals("generic.follow_range") && attribute.get("Base").asDouble(0.0) == 16.0
? attribute.set("Base", attribute.createDouble(48.0))
: attribute
)
)
);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置: