AttributeIdPrefixFix.java
net.minecraft.util.datafix.fixes.AttributeIdPrefixFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.AttributeIdPrefixFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java
- 起始行号:L7
- 继承:AttributesRenameFix
- 职责:
TODO
字段/常量
PREFIXES- 类型:
List<String> - 修饰符:
private static final - 源码定位:
L8 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public AttributeIdPrefixFix(Schema outputSchema) @ L10
- 构造器名:AttributeIdPrefixFix
- 源码定位:L10
- 修饰符:public
参数:
- outputSchema: Schema
说明:
TODO
方法
下面的方法块按源码顺序生成。
private static String replaceId(String id) @ L14
- 方法名:replaceId
- 源码定位:L14
- 返回类型:String
- 修饰符:private static
参数:
- id: String
说明:
TODO
代码
public class AttributeIdPrefixFix extends AttributesRenameFix {
private static final List<String> PREFIXES = List.of("generic.", "horse.", "player.", "zombie.");
public AttributeIdPrefixFix(Schema outputSchema) {
super(outputSchema, "AttributeIdPrefixFix", AttributeIdPrefixFix::replaceId);
}
private static String replaceId(String id) {
String namespacedId = NamespacedSchema.ensureNamespaced(id);
for (String prefix : PREFIXES) {
String namespacedPrefix = NamespacedSchema.ensureNamespaced(prefix);
if (namespacedId.startsWith(namespacedPrefix)) {
return "minecraft:" + namespacedId.substring(namespacedPrefix.length());
}
}
return id;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
NamespacedSchema.ensureNamespaced()
- 引用位置: