NameReportScreen.java

net.minecraft.client.gui.screens.reporting.NameReportScreen

信息

  • 全限定名:net.minecraft.client.gui.screens.reporting.NameReportScreen
  • 类型:public class
  • 包:net.minecraft.client.gui.screens.reporting
  • 源码路径:src/main/java/net/minecraft/client/gui/screens/reporting/NameReportScreen.java
  • 起始行号:L18
  • 继承:AbstractReportScreen<NameReport.Builder>
  • 职责:

    TODO

字段/常量

  • TITLE

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

      TODO

  • COMMENT_BOX_LABEL

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

      TODO

  • commentBox

    • 类型: MultiLineEditBox
    • 修饰符: private
    • 源码定位: L21
    • 说明:

      TODO

内部类/嵌套类型

构造器

private NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport.Builder reportBuilder) @ L23

  • 构造器名:NameReportScreen
  • 源码定位:L23
  • 修饰符:private

参数:

  • lastScreen: Screen
  • reportingContext: ReportingContext
  • reportBuilder: NameReport.Builder

说明:

TODO

public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId, String reportedName) @ L27

  • 构造器名:NameReportScreen
  • 源码定位:L27
  • 修饰符:public

参数:

  • lastScreen: Screen
  • reportingContext: ReportingContext
  • playerId: UUID
  • reportedName: String

说明:

TODO

public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport draft) @ L31

  • 构造器名:NameReportScreen
  • 源码定位:L31
  • 修饰符:public

参数:

  • lastScreen: Screen
  • reportingContext: ReportingContext
  • draft: NameReport

说明:

TODO

方法

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

protected void addContent() @ L35

  • 方法名:addContent
  • 源码定位:L35
  • 返回类型:void
  • 修饰符:protected

参数:

说明:

TODO

public boolean mouseReleased(MouseButtonEvent event) @ L50

  • 方法名:mouseReleased
  • 源码定位:L50
  • 返回类型:boolean
  • 修饰符:public

参数:

  • event: MouseButtonEvent

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class NameReportScreen extends AbstractReportScreen<NameReport.Builder> {
    private static final Component TITLE = Component.translatable("gui.abuseReport.name.title");
    private static final Component COMMENT_BOX_LABEL = Component.translatable("gui.abuseReport.name.comment_box_label");
    private @Nullable MultiLineEditBox commentBox;
 
    private NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport.Builder reportBuilder) {
        super(TITLE, lastScreen, reportingContext, reportBuilder);
    }
 
    public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId, String reportedName) {
        this(lastScreen, reportingContext, new NameReport.Builder(playerId, reportedName, reportingContext.sender().reportLimits()));
    }
 
    public NameReportScreen(Screen lastScreen, ReportingContext reportingContext, NameReport draft) {
        this(lastScreen, reportingContext, new NameReport.Builder(draft, reportingContext.sender().reportLimits()));
    }
 
    @Override
    protected void addContent() {
        Component reportedName = Component.literal(this.reportBuilder.report().getReportedName()).withStyle(ChatFormatting.YELLOW);
        this.layout
            .addChild(
                new StringWidget(Component.translatable("gui.abuseReport.name.reporting", reportedName), this.font),
                s -> s.alignHorizontallyCenter().padding(0, 8)
            );
        this.commentBox = this.createCommentBox(280, 9 * 8, comments -> {
            this.reportBuilder.setComments(comments);
            this.onReportChanged();
        });
        this.layout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, COMMENT_BOX_LABEL, s -> s.paddingBottom(12)));
    }
 
    @Override
    public boolean mouseReleased(MouseButtonEvent event) {
        if (super.mouseReleased(event)) {
            return true;
        } else {
            return this.commentBox != null ? this.commentBox.mouseReleased(event) : false;
        }
    }
}

引用的其他类

  • MultiLineEditBox

    • 引用位置: 字段
  • StringWidget

    • 引用位置: 构造调用
    • 关联成员: StringWidget()
  • CommonLayouts

    • 引用位置: 方法调用
    • 关联成员: CommonLayouts.labeledElement()
  • Screen

    • 引用位置: 参数
  • MouseButtonEvent

    • 引用位置: 参数
  • NameReport

    • 引用位置: 参数/方法调用/构造调用/继承
    • 关联成员: Builder(), NameReport.Builder()
  • ReportingContext

    • 引用位置: 参数
  • Component

    • 引用位置: 字段/方法调用
    • 关联成员: Component.literal(), Component.translatable()