IconSet.java
com.mojang.blaze3d.platform.IconSet
信息
- 全限定名:com.mojang.blaze3d.platform.IconSet
- 类型:public enum
- 包:com.mojang.blaze3d.platform
- 源码路径:src/main/java/com/mojang/blaze3d/platform/IconSet.java
- 起始行号:L14
- 职责:
TODO
字段/常量
-
RELEASE, SNAPSHOT- 类型:
IconSet - 修饰符:
package-private - 源码定位:
L15 - 说明:
TODO
- 类型:
-
path- 类型:
String[] - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private IconSet(String... path) @ L20
- 构造器名:IconSet
- 源码定位:L20
- 修饰符:private
参数:
- path: String…
说明:
TODO
方法
下面的方法块按源码顺序生成。
public List<IoSupplier<InputStream>> getStandardIcons(PackResources resources) @ L24
- 方法名:getStandardIcons
- 源码定位:L24
- 返回类型:List<IoSupplier
> - 修饰符:public
参数:
- resources: PackResources
说明:
TODO
public IoSupplier<InputStream> getMacIcon(PackResources resources) @ L34
- 方法名:getMacIcon
- 源码定位:L34
- 返回类型:IoSupplier
- 修饰符:public
参数:
- resources: PackResources
说明:
TODO
private IoSupplier<InputStream> getFile(PackResources resources, String fileName) @ L38
- 方法名:getFile
- 源码定位:L38
- 返回类型:IoSupplier
- 修饰符:private
参数:
- resources: PackResources
- fileName: String
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public enum IconSet {
RELEASE("icons"),
SNAPSHOT("icons", "snapshot");
private final String[] path;
private IconSet(String... path) {
this.path = path;
}
public List<IoSupplier<InputStream>> getStandardIcons(PackResources resources) throws IOException {
return List.of(
this.getFile(resources, "icon_16x16.png"),
this.getFile(resources, "icon_32x32.png"),
this.getFile(resources, "icon_48x48.png"),
this.getFile(resources, "icon_128x128.png"),
this.getFile(resources, "icon_256x256.png")
);
}
public IoSupplier<InputStream> getMacIcon(PackResources resources) throws IOException {
return this.getFile(resources, "minecraft.icns");
}
private IoSupplier<InputStream> getFile(PackResources resources, String fileName) throws IOException {
String[] fullPath = ArrayUtils.add(this.path, fileName);
IoSupplier<InputStream> resource = resources.getRootResource(fullPath);
if (resource == null) {
throw new FileNotFoundException(String.join("/", fullPath));
} else {
return resource;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
返回值
- 引用位置: