ComponentPath.java
net.minecraft.client.gui.ComponentPath
信息
- 全限定名:net.minecraft.client.gui.ComponentPath
- 类型:public interface
- 包:net.minecraft.client.gui
- 源码路径:src/main/java/net/minecraft/client/gui/ComponentPath.java
- 起始行号:L10
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.gui.ComponentPath.Leaf- 类型:
record - 修饰符:
public - 源码定位:
L34 - 说明:
TODO
- 类型:
-
net.minecraft.client.gui.ComponentPath.Path- 类型:
record - 修饰符:
public - 源码定位:
L42 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
static ComponentPath leaf(GuiEventListener component) @ L11
- 方法名:leaf
- 源码定位:L11
- 返回类型:ComponentPath
- 修饰符:static
参数:
- component: GuiEventListener
说明:
TODO
static ComponentPath path(ContainerEventHandler container, ComponentPath childPath) @ L15
- 方法名:path
- 源码定位:L15
- 返回类型:ComponentPath
- 修饰符:static
参数:
- container: ContainerEventHandler
- childPath: ComponentPath
说明:
TODO
static ComponentPath path(GuiEventListener target, ContainerEventHandler... containerPath) @ L19
- 方法名:path
- 源码定位:L19
- 返回类型:ComponentPath
- 修饰符:static
参数:
- target: GuiEventListener
- containerPath: ContainerEventHandler…
说明:
TODO
GuiEventListener component() @ L29
- 方法名:component
- 源码定位:L29
- 返回类型:GuiEventListener
- 修饰符:package-private
参数:
- 无
说明:
TODO
void applyFocus(boolean focused) @ L31
- 方法名:applyFocus
- 源码定位:L31
- 返回类型:void
- 修饰符:package-private
参数:
- focused: boolean
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public interface ComponentPath {
static ComponentPath leaf(GuiEventListener component) {
return new ComponentPath.Leaf(component);
}
static @Nullable ComponentPath path(ContainerEventHandler container, @Nullable ComponentPath childPath) {
return childPath == null ? null : new ComponentPath.Path(container, childPath);
}
static ComponentPath path(GuiEventListener target, ContainerEventHandler... containerPath) {
ComponentPath path = leaf(target);
for (ContainerEventHandler container : containerPath) {
path = path(container, path);
}
return path;
}
GuiEventListener component();
void applyFocus(boolean focused);
@OnlyIn(Dist.CLIENT)
public record Leaf(GuiEventListener component) implements ComponentPath {
@Override
public void applyFocus(boolean focused) {
this.component.setFocused(focused);
}
}
@OnlyIn(Dist.CLIENT)
public record Path(ContainerEventHandler component, ComponentPath childPath) implements ComponentPath {
@Override
public void applyFocus(boolean focused) {
if (!focused) {
this.component.setFocused(null);
} else {
this.component.setFocused(this.childPath.component());
}
this.childPath.applyFocus(focused);
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置: