2025-11-24 22:52:51 +03:00

24 lines
1.1 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.brigadier.arguments.StringArgumentType
*/
package net.minecraft.server.packs;
import com.mojang.brigadier.arguments.StringArgumentType;
import java.util.Optional;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.server.packs.repository.KnownPack;
import net.minecraft.server.packs.repository.PackSource;
public record PackLocationInfo(String id, Component title, PackSource source, Optional<KnownPack> knownPackInfo) {
public Component createChatLink(boolean enabled, Component description) {
return ComponentUtils.wrapInSquareBrackets(this.source.decorate(Component.literal(this.id))).withStyle(s -> s.withColor(enabled ? ChatFormatting.GREEN : ChatFormatting.RED).withInsertion(StringArgumentType.escapeIfRequired((String)this.id)).withHoverEvent(new HoverEvent.ShowText(Component.empty().append(this.title).append("\n").append(description))));
}
}