FieldTree.java
net.minecraft.nbt.visitors.FieldTree
信息
- 全限定名:net.minecraft.nbt.visitors.FieldTree
- 类型:public record
- 包:net.minecraft.nbt.visitors
- 源码路径:src/main/java/net/minecraft/nbt/visitors/FieldTree.java
- 起始行号:L7
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
private FieldTree(int depth) @ L8
- 构造器名:FieldTree
- 源码定位:L8
- 修饰符:private
参数:
- depth: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static FieldTree createRoot() @ L12
- 方法名:createRoot
- 源码定位:L12
- 返回类型:FieldTree
- 修饰符:public static
参数:
- 无
说明:
TODO
public void addEntry(FieldSelector field) @ L16
- 方法名:addEntry
- 源码定位:L16
- 返回类型:void
- 修饰符:public
参数:
- field: FieldSelector
说明:
TODO
public boolean isSelected(TagType<?> type, String id) @ L24
- 方法名:isSelected
- 源码定位:L24
- 返回类型:boolean
- 修饰符:public
参数:
- type: TagType<?>
- id: String
说明:
TODO
代码
public record FieldTree(int depth, Map<String, TagType<?>> selectedFields, Map<String, FieldTree> fieldsToRecurse) {
private FieldTree(int depth) {
this(depth, new HashMap<>(), new HashMap<>());
}
public static FieldTree createRoot() {
return new FieldTree(1);
}
public void addEntry(FieldSelector field) {
if (this.depth <= field.path().size()) {
this.fieldsToRecurse.computeIfAbsent(field.path().get(this.depth - 1), s -> new FieldTree(this.depth + 1)).addEntry(field);
} else {
this.selectedFields.put(field.name(), field.type());
}
}
public boolean isSelected(TagType<?> type, String id) {
return type.equals(this.selectedFields().get(id));
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: