IconSet .java

com.mojang.blaze3d.platform.IconSet (enum, 44 lines): members: RELEASE, SNAPSHOT, getStandardIcons, getFile, path. strings: "icon_128x128.png", "icons".

com.mojang.blaze3d.platformenum44 linesclient1.3 KB

API Surface (1)

List<IoSupplier<InputStream>> getStandardIcons(final PackMetadataResources resources)

Fields & Constants (1)

path

String literals (7)

"icons"
"snapshot"
"icon_256x256.png"
"icon_128x128.png"
"icon_48x48.png"
"icon_32x32.png"
"icon_16x16.png"

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

IconSet.java44 lines · Minecraft 26.3 · verbatim
1
package com.mojang.blaze3d.platform;
2
3
import java.io.FileNotFoundException;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.util.List;
7
import net.fabricmc.api.EnvType;
8
import net.fabricmc.api.Environment;
9
import net.minecraft.server.packs.PackMetadataResources;
10
import net.minecraft.server.packs.resources.IoSupplier;
11
import org.apache.commons.lang3.ArrayUtils;
12
13
@Environment(EnvType.CLIENT)
14
public enum IconSet {
15
	RELEASE("icons"),
16
	SNAPSHOT("icons", "snapshot");
17
18
	private final String[] path;
19
20
	IconSet(final String... path) {
21
		this.path = path;
22
	}
23
24
	public List<IoSupplier<InputStream>> getStandardIcons(final PackMetadataResources resources) throws IOException {
25
		return List.of(
26
			this.getFile(resources, "icon_256x256.png"),
27
			this.getFile(resources, "icon_128x128.png"),
28
			this.getFile(resources, "icon_48x48.png"),
29
			this.getFile(resources, "icon_32x32.png"),
30
			this.getFile(resources, "icon_16x16.png")
31
		);
32
	}
33
34
	private IoSupplier<InputStream> getFile(final PackMetadataResources resources, final String fileName) throws IOException {
35
		String[] fullPath = ArrayUtils.add(this.path, fileName);
36
		IoSupplier<InputStream> resource = resources.getRootResource(fullPath);
37
		if (resource == null) {
38
			throw new FileNotFoundException(String.join("/", fullPath));
39
		} else {
40
			return resource;
41
		}
42
	}
43
}
44

Decompiled Minecraft 26.3 source of IconSet (com/mojang/blaze3d/platform/IconSet.java) with Mojang official mappings, stored verbatim on the site.