DialogScreens.java
net.minecraft.client.gui.screens.dialog.DialogScreens
信息
- 全限定名:net.minecraft.client.gui.screens.dialog.DialogScreens
- 类型:public class
- 包:net.minecraft.client.gui.screens.dialog
- 源码路径:src/main/java/net/minecraft/client/gui/screens/dialog/DialogScreens.java
- 起始行号:L18
- 职责:
TODO
字段/常量
FACTORIES- 类型:
Map<MapCodec<?extends Dialog>,DialogScreens.Factory<?>> - 修饰符:
private static final - 源码定位:
L19 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.gui.screens.dialog.DialogScreens.Factory- 类型:
interface - 修饰符:
public - 源码定位:
L42 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
private static <T extends Dialog> void register(MapCodec<T> type, DialogScreens.Factory<?super T> factory) @ L21
- 方法名:register
- 源码定位:L21
- 返回类型:
void - 修饰符:private static
参数:
- type: MapCodec
- factory: DialogScreens.Factory<?super T>
说明:
TODO
public static <T extends Dialog> DialogScreen<T> createFromData(T dialog, Screen previousScreen, DialogConnectionAccess connectionAccess) @ L25
- 方法名:createFromData
- 源码定位:L25
- 返回类型:
DialogScreen - 修饰符:public static
参数:
- dialog: T
- previousScreen: Screen
- connectionAccess: DialogConnectionAccess
说明:
TODO
public static void bootstrap() @ L32
- 方法名:bootstrap
- 源码定位:L32
- 返回类型:void
- 修饰符:public static
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DialogScreens {
private static final Map<MapCodec<? extends Dialog>, DialogScreens.Factory<?>> FACTORIES = new HashMap<>();
private static <T extends Dialog> void register(MapCodec<T> type, DialogScreens.Factory<? super T> factory) {
FACTORIES.put(type, factory);
}
public static <T extends Dialog> @Nullable DialogScreen<T> createFromData(
T dialog, @Nullable Screen previousScreen, DialogConnectionAccess connectionAccess
) {
DialogScreens.Factory<T> factory = (DialogScreens.Factory<T>)FACTORIES.get(dialog.codec());
return factory != null ? factory.create(previousScreen, dialog, connectionAccess) : null;
}
public static void bootstrap() {
register(ConfirmationDialog.MAP_CODEC, SimpleDialogScreen::new);
register(NoticeDialog.MAP_CODEC, SimpleDialogScreen::new);
register(DialogListDialog.MAP_CODEC, DialogListDialogScreen::new);
register(MultiActionDialog.MAP_CODEC, MultiButtonDialogScreen::new);
register(ServerLinksDialog.MAP_CODEC, ServerLinksDialogScreen::new);
}
@FunctionalInterface
@OnlyIn(Dist.CLIENT)
public interface Factory<T extends Dialog> {
DialogScreen<T> create(@Nullable Screen previousScreen, T data, DialogConnectionAccess connectionAccess);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置: