CommonComponents.java

net.minecraft.network.chat.CommonComponents

信息

  • 全限定名:net.minecraft.network.chat.CommonComponents
  • 类型:public class
  • 包:net.minecraft.network.chat
  • 源码路径:src/main/java/net/minecraft/network/chat/CommonComponents.java
  • 起始行号:L6
  • 职责:

    TODO

字段/常量

  • EMPTY

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L7
    • 说明:

      TODO

  • OPTION_ON

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L8
    • 说明:

      TODO

  • OPTION_OFF

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L9
    • 说明:

      TODO

  • GUI_DONE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L10
    • 说明:

      TODO

  • GUI_CANCEL

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L11
    • 说明:

      TODO

  • GUI_YES

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L12
    • 说明:

      TODO

  • GUI_NO

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L13
    • 说明:

      TODO

  • GUI_OK

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L14
    • 说明:

      TODO

  • GUI_PROCEED

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L15
    • 说明:

      TODO

  • GUI_CONTINUE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L16
    • 说明:

      TODO

  • GUI_BACK

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L17
    • 说明:

      TODO

  • GUI_TO_TITLE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L18
    • 说明:

      TODO

  • GUI_ACKNOWLEDGE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L19
    • 说明:

      TODO

  • GUI_OPEN_IN_BROWSER

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L20
    • 说明:

      TODO

  • GUI_COPY_TO_CLIPBOARD

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L21
    • 说明:

      TODO

  • GUI_COPY_LINK_TO_CLIPBOARD

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L22
    • 说明:

      TODO

  • GUI_DISCONNECT

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L23
    • 说明:

      TODO

  • GUI_RETURN_TO_MENU

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L24
    • 说明:

      TODO

  • TRANSFER_CONNECT_FAILED

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L25
    • 说明:

      TODO

  • CONNECT_FAILED

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L26
    • 说明:

      TODO

  • NEW_LINE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L27
    • 说明:

      TODO

  • NARRATION_SEPARATOR

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L28
    • 说明:

      TODO

  • ELLIPSIS

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L29
    • 说明:

      TODO

  • SPACE

    • 类型: Component
    • 修饰符: public static final
    • 源码定位: L30
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public static MutableComponent space() @ L32

  • 方法名:space
  • 源码定位:L32
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

说明:

TODO

public static MutableComponent days(long value) @ L36

  • 方法名:days
  • 源码定位:L36
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • value: long

说明:

TODO

public static MutableComponent hours(long value) @ L40

  • 方法名:hours
  • 源码定位:L40
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • value: long

说明:

TODO

public static MutableComponent minutes(long value) @ L44

  • 方法名:minutes
  • 源码定位:L44
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • value: long

说明:

TODO

public static Component optionStatus(boolean value) @ L48

  • 方法名:optionStatus
  • 源码定位:L48
  • 返回类型:Component
  • 修饰符:public static

参数:

  • value: boolean

说明:

TODO

public static Component disconnectButtonLabel(boolean isLocalServer) @ L52

  • 方法名:disconnectButtonLabel
  • 源码定位:L52
  • 返回类型:Component
  • 修饰符:public static

参数:

  • isLocalServer: boolean

说明:

TODO

public static MutableComponent optionStatus(Component name, boolean value) @ L56

  • 方法名:optionStatus
  • 源码定位:L56
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • name: Component
  • value: boolean

说明:

TODO

public static MutableComponent optionNameValue(Component name, Component value) @ L60

  • 方法名:optionNameValue
  • 源码定位:L60
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • name: Component
  • value: Component

说明:

TODO

public static MutableComponent joinForNarration(Component... components) @ L64

  • 方法名:joinForNarration
  • 源码定位:L64
  • 返回类型:MutableComponent
  • 修饰符:public static

参数:

  • components: Component…

说明:

TODO

public static Component joinLines(Component... lines) @ L77

  • 方法名:joinLines
  • 源码定位:L77
  • 返回类型:Component
  • 修饰符:public static

参数:

  • lines: Component…

说明:

TODO

public static Component joinLines(Collection<?extends Component> lines) @ L81

  • 方法名:joinLines
  • 源码定位:L81
  • 返回类型:Component
  • 修饰符:public static

参数:

  • lines: Collection<?extends Component>

说明:

TODO

代码

public class CommonComponents {
    public static final Component EMPTY = Component.empty();
    public static final Component OPTION_ON = Component.translatable("options.on");
    public static final Component OPTION_OFF = Component.translatable("options.off");
    public static final Component GUI_DONE = Component.translatable("gui.done");
    public static final Component GUI_CANCEL = Component.translatable("gui.cancel");
    public static final Component GUI_YES = Component.translatable("gui.yes");
    public static final Component GUI_NO = Component.translatable("gui.no");
    public static final Component GUI_OK = Component.translatable("gui.ok");
    public static final Component GUI_PROCEED = Component.translatable("gui.proceed");
    public static final Component GUI_CONTINUE = Component.translatable("gui.continue");
    public static final Component GUI_BACK = Component.translatable("gui.back");
    public static final Component GUI_TO_TITLE = Component.translatable("gui.toTitle");
    public static final Component GUI_ACKNOWLEDGE = Component.translatable("gui.acknowledge");
    public static final Component GUI_OPEN_IN_BROWSER = Component.translatable("chat.link.open");
    public static final Component GUI_COPY_TO_CLIPBOARD = Component.translatable("chat.copy");
    public static final Component GUI_COPY_LINK_TO_CLIPBOARD = Component.translatable("gui.copy_link_to_clipboard");
    public static final Component GUI_DISCONNECT = Component.translatable("menu.disconnect");
    public static final Component GUI_RETURN_TO_MENU = Component.translatable("menu.returnToMenu");
    public static final Component TRANSFER_CONNECT_FAILED = Component.translatable("connect.failed.transfer");
    public static final Component CONNECT_FAILED = Component.translatable("connect.failed");
    public static final Component NEW_LINE = Component.literal("\n");
    public static final Component NARRATION_SEPARATOR = Component.literal(". ");
    public static final Component ELLIPSIS = Component.literal("...");
    public static final Component SPACE = space();
 
    public static MutableComponent space() {
        return Component.literal(" ");
    }
 
    public static MutableComponent days(long value) {
        return Component.translatable("gui.days", value);
    }
 
    public static MutableComponent hours(long value) {
        return Component.translatable("gui.hours", value);
    }
 
    public static MutableComponent minutes(long value) {
        return Component.translatable("gui.minutes", value);
    }
 
    public static Component optionStatus(boolean value) {
        return value ? OPTION_ON : OPTION_OFF;
    }
 
    public static Component disconnectButtonLabel(boolean isLocalServer) {
        return isLocalServer ? GUI_RETURN_TO_MENU : GUI_DISCONNECT;
    }
 
    public static MutableComponent optionStatus(Component name, boolean value) {
        return Component.translatable(value ? "options.on.composed" : "options.off.composed", name);
    }
 
    public static MutableComponent optionNameValue(Component name, Component value) {
        return Component.translatable("options.generic_value", name, value);
    }
 
    public static MutableComponent joinForNarration(Component... components) {
        MutableComponent result = Component.empty();
 
        for (int i = 0; i < components.length; i++) {
            result.append(components[i]);
            if (i != components.length - 1) {
                result.append(NARRATION_SEPARATOR);
            }
        }
 
        return result;
    }
 
    public static Component joinLines(Component... lines) {
        return joinLines(Arrays.asList(lines));
    }
 
    public static Component joinLines(Collection<? extends Component> lines) {
        return ComponentUtils.formatList(lines, NEW_LINE);
    }
}

引用的其他类

  • Component

    • 引用位置: 参数/字段/方法调用/返回值
    • 关联成员: Component.empty(), Component.literal(), Component.translatable()
  • ComponentUtils

    • 引用位置: 方法调用
    • 关联成员: ComponentUtils.formatList()
  • MutableComponent

    • 引用位置: 返回值