API Surface (2) record PackLocationInfo(String id, Component title, PackSource source, Optional<KnownPack> knownPackInfo)
Component createChatLink(final boolean enabled, final Component description)
Code Graph: Dependencies (6) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
PackLocationInfo.java 22 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.server.packs;
2
3 import com.mojang.brigadier.arguments.StringArgumentType;
4 import java.util.Optional;
5 import net.minecraft.ChatFormatting;
6 import net.minecraft.network.chat.Component;
7 import net.minecraft.network.chat.ComponentUtils;
8 import net.minecraft.network.chat.HoverEvent;
9 import net.minecraft.server.packs.repository.KnownPack;
10 import net.minecraft.server.packs.repository.PackSource;
11
12 public record PackLocationInfo(String id, Component title, PackSource source, Optional<KnownPack> knownPackInfo) {
13 public Component createChatLink(final boolean enabled, final Component description) {
14 return ComponentUtils.wrapInSquareBrackets(this.source.decorate(Component.literal(this.id)))
15 .withStyle(
16 s -> s.withColor(enabled ? ChatFormatting.GREEN : ChatFormatting.RED)
17 .withInsertion(StringArgumentType.escapeIfRequired(this.id))
18 .withHoverEvent(new HoverEvent.ShowText(Component.empty().append(this.title).append("\n").append(description)))
19 );
20 }
21 }
22
Decompiled Minecraft 26.3 source of PackLocationInfo (net/minecraft/server/packs/PackLocationInfo.java) with Mojang official mappings, stored verbatim on the site.