PackSource .java

net.minecraft.server.packs.repository.PackSource (interface): members: shouldAddAutomatically, decorateWithSource, NO_DECORATION, SERVER, WORLD, BUILT_IN.

net.minecraft.server.packs.repositoryinterface38 linesserver1.3 KB

API Surface (2)

Component decorate(final Component packDescription)
boolean shouldAddAutomatically()

Fields & Constants (6)

NO_DECORATION
DEFAULT
BUILT_IN
FEATURE
WORLD
SERVER

String literals (5)

"pack.source.builtin"
"pack.source.feature"
"pack.source.world"
"pack.source.server"
"pack.nameAndSource"

Code Graph: Dependencies (2)

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

Full Source

PackSource.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.packs.repository;
2
3
import java.util.function.UnaryOperator;
4
import net.minecraft.ChatFormatting;
5
import net.minecraft.network.chat.Component;
6
7
public interface PackSource {
8
	UnaryOperator<Component> NO_DECORATION = UnaryOperator.identity();
9
	PackSource DEFAULT = create(NO_DECORATION, true);
10
	PackSource BUILT_IN = create(decorateWithSource("pack.source.builtin"), true);
11
	PackSource FEATURE = create(decorateWithSource("pack.source.feature"), false);
12
	PackSource WORLD = create(decorateWithSource("pack.source.world"), true);
13
	PackSource SERVER = create(decorateWithSource("pack.source.server"), true);
14
15
	Component decorate(final Component packDescription);
16
17
	boolean shouldAddAutomatically();
18
19
	static PackSource create(final UnaryOperator<Component> decorator, final boolean addAutomatically) {
20
		return new PackSource() {
21
			@Override
22
			public Component decorate(final Component packDescription) {
23
				return decorator.apply(packDescription);
24
			}
25
26
			@Override
27
			public boolean shouldAddAutomatically() {
28
				return addAutomatically;
29
			}
30
		};
31
	}
32
33
	private static UnaryOperator<Component> decorateWithSource(final String descriptionId) {
34
		Component description = Component.translatable(descriptionId);
35
		return packDescription -> Component.translatable("pack.nameAndSource", packDescription, description).withStyle(ChatFormatting.GRAY);
36
	}
37
}
38

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