PackLocationInfo.java
net.minecraft.server.packs.PackLocationInfo
信息
- 全限定名:net.minecraft.server.packs.PackLocationInfo
- 类型:public record
- 包:net.minecraft.server.packs
- 源码路径:src/main/java/net/minecraft/server/packs/PackLocationInfo.java
- 起始行号:L12
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public Component createChatLink(boolean enabled, Component description) @ L13
- 方法名:createChatLink
- 源码定位:L13
- 返回类型:Component
- 修饰符:public
参数:
- enabled: boolean
- description: Component
说明:
TODO
代码
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(this.id))
.withHoverEvent(new HoverEvent.ShowText(Component.empty().append(this.title).append("\n").append(description)))
);
}
}引用的其他类
-
- 引用位置:
参数/方法调用/返回值 - 关联成员:
Component.empty(), Component.literal()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ComponentUtils.wrapInSquareBrackets()
- 引用位置:
-
- 引用位置:
方法调用/构造调用 - 关联成员:
HoverEvent.ShowText(), ShowText()
- 引用位置: