ClientAsset .java

net.minecraft.core.ClientAsset (interface, 34 lines): members: DownloadedTexture, ResourceTexture, Texture. strings: "asset_id", "textures/", ".png".

net.minecraft.coreinterface34 linescommon1.2 KB

API Surface (1)

Identifier id()

String literals (3)

"asset_id"
"textures/"
".png"

Code Graph: Dependencies (2)

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

Full Source

ClientAsset.java34 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.core;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.MapCodec;
5
import io.netty.buffer.ByteBuf;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.resources.Identifier;
8
9
public interface ClientAsset {
10
	Identifier id();
11
12
	record DownloadedTexture(Identifier texturePath, String url) implements ClientAsset.Texture {
13
		@Override
14
		public Identifier id() {
15
			return this.texturePath;
16
		}
17
	}
18
19
	record ResourceTexture(Identifier id, Identifier texturePath) implements ClientAsset.Texture {
20
		public static final Codec<ClientAsset.ResourceTexture> CODEC = Identifier.CODEC.xmap(ClientAsset.ResourceTexture::new, ClientAsset.ResourceTexture::id);
21
		public static final MapCodec<ClientAsset.ResourceTexture> DEFAULT_FIELD_CODEC = CODEC.fieldOf("asset_id");
22
		public static final StreamCodec<ByteBuf, ClientAsset.ResourceTexture> STREAM_CODEC = Identifier.STREAM_CODEC
23
			.map(ClientAsset.ResourceTexture::new, ClientAsset.ResourceTexture::id);
24
25
		public ResourceTexture(final Identifier texture) {
26
			this(texture, texture.withPath(path -> "textures/" + path + ".png"));
27
		}
28
	}
29
30
	interface Texture extends ClientAsset {
31
		Identifier texturePath();
32
	}
33
}
34

Decompiled Minecraft 26.3 source of ClientAsset (net/minecraft/core/ClientAsset.java) with Mojang official mappings, stored verbatim on the site.