KnownPack .java

net.minecraft.server.packs.repository.KnownPack (record, 27 lines): members: namespace, version, VANILLA_NAMESPACE, isVanilla, vanilla, STREAM_CODEC.

net.minecraft.server.packs.repositoryrecord27 linesserver924 B

API Surface (4)

record KnownPack(String namespace, String id, String version)
KnownPack vanilla(final String id)
boolean isVanilla()
String toString()

Fields & Constants (2)

STREAM_CODEC
VANILLA_NAMESPACE

String literals (1)

"minecraft"

Code Graph: Dependencies (3)

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

Full Source

KnownPack.java27 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.packs.repository;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.SharedConstants;
5
import net.minecraft.network.codec.ByteBufCodecs;
6
import net.minecraft.network.codec.StreamCodec;
7
8
public record KnownPack(String namespace, String id, String version) {
9
	public static final StreamCodec<ByteBuf, KnownPack> STREAM_CODEC = StreamCodec.composite(
10
		ByteBufCodecs.STRING_UTF8, KnownPack::namespace, ByteBufCodecs.STRING_UTF8, KnownPack::id, ByteBufCodecs.STRING_UTF8, KnownPack::version, KnownPack::new
11
	);
12
	public static final String VANILLA_NAMESPACE = "minecraft";
13
14
	public static KnownPack vanilla(final String id) {
15
		return new KnownPack("minecraft", id, SharedConstants.getCurrentVersion().id());
16
	}
17
18
	public boolean isVanilla() {
19
		return this.namespace.equals("minecraft");
20
	}
21
22
	@Override
23
	public String toString() {
24
		return this.namespace + ":" + this.id + ":" + this.version;
25
	}
26
}
27

Decompiled Minecraft 26.3 source of KnownPack (net/minecraft/server/packs/repository/KnownPack.java) with Mojang official mappings, stored verbatim on the site.