SkinReportScreen.java

net.minecraft.client.gui.screens.reporting.SkinReportScreen

信息

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

    TODO

字段/常量

  • SKIN_WIDTH

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

      TODO

  • FORM_WIDTH

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

      TODO

  • TITLE

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

      TODO

  • commentBox

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

      TODO

  • selectReasonButton

    • 类型: Button
    • 修饰符: private
    • 源码定位: L27
    • 说明:

      TODO

内部类/嵌套类型

构造器

private SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport.Builder reportBuilder) @ L29

  • 构造器名:SkinReportScreen
  • 源码定位:L29
  • 修饰符:private

参数:

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

说明:

TODO

public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId, Supplier<PlayerSkin> skinGetter) @ L33

  • 构造器名:SkinReportScreen
  • 源码定位:L33
  • 修饰符:public

参数:

  • lastScreen: Screen
  • reportingContext: ReportingContext
  • playerId: UUID
  • skinGetter: Supplier

说明:

TODO

public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport draft) @ L37

  • 构造器名:SkinReportScreen
  • 源码定位:L37
  • 修饰符:public

参数:

  • lastScreen: Screen
  • reportingContext: ReportingContext
  • draft: SkinReport

说明:

TODO

方法

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

protected void addContent() @ L41

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

参数:

说明:

TODO

protected void onReportChanged() @ L63

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

参数:

说明:

TODO

public boolean mouseReleased(MouseButtonEvent event) @ L75

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

参数:

  • event: MouseButtonEvent

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class SkinReportScreen extends AbstractReportScreen<SkinReport.Builder> {
    private static final int SKIN_WIDTH = 85;
    private static final int FORM_WIDTH = 178;
    private static final Component TITLE = Component.translatable("gui.abuseReport.skin.title");
    private MultiLineEditBox commentBox;
    private Button selectReasonButton;
 
    private SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport.Builder reportBuilder) {
        super(TITLE, lastScreen, reportingContext, reportBuilder);
    }
 
    public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId, Supplier<PlayerSkin> skinGetter) {
        this(lastScreen, reportingContext, new SkinReport.Builder(playerId, skinGetter, reportingContext.sender().reportLimits()));
    }
 
    public SkinReportScreen(Screen lastScreen, ReportingContext reportingContext, SkinReport draft) {
        this(lastScreen, reportingContext, new SkinReport.Builder(draft, reportingContext.sender().reportLimits()));
    }
 
    @Override
    protected void addContent() {
        LinearLayout contentLayout = this.layout.addChild(LinearLayout.horizontal().spacing(8));
        contentLayout.defaultCellSetting().alignVerticallyMiddle();
        contentLayout.addChild(new PlayerSkinWidget(85, 120, this.minecraft.getEntityModels(), this.reportBuilder.report().getSkinGetter()));
        LinearLayout formLayout = contentLayout.addChild(LinearLayout.vertical().spacing(8));
        this.selectReasonButton = Button.builder(
                SELECT_REASON, b -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), ReportType.SKIN, reason -> {
                    this.reportBuilder.setReason(reason);
                    this.onReportChanged();
                }))
            )
            .width(178)
            .build();
        formLayout.addChild(CommonLayouts.labeledElement(this.font, this.selectReasonButton, OBSERVED_WHAT_LABEL));
        this.commentBox = this.createCommentBox(178, 9 * 8, comments -> {
            this.reportBuilder.setComments(comments);
            this.onReportChanged();
        });
        formLayout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, MORE_COMMENTS_LABEL, s -> s.paddingBottom(12)));
    }
 
    @Override
    protected void onReportChanged() {
        ReportReason reportReason = this.reportBuilder.reason();
        if (reportReason != null) {
            this.selectReasonButton.setMessage(reportReason.title());
        } else {
            this.selectReasonButton.setMessage(SELECT_REASON);
        }
 
        super.onReportChanged();
    }
 
    @Override
    public boolean mouseReleased(MouseButtonEvent event) {
        return super.mouseReleased(event) ? true : this.commentBox.mouseReleased(event);
    }
}

引用的其他类

  • Button

    • 引用位置: 字段/方法调用
    • 关联成员: Button.builder()
  • MultiLineEditBox

    • 引用位置: 字段
  • PlayerSkinWidget

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

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

    • 引用位置: 方法调用
    • 关联成员: LinearLayout.horizontal(), LinearLayout.vertical()
  • Screen

    • 引用位置: 参数
  • ReportReasonSelectionScreen

    • 引用位置: 构造调用
    • 关联成员: ReportReasonSelectionScreen()
  • MouseButtonEvent

    • 引用位置: 参数
  • ReportingContext

    • 引用位置: 参数
  • SkinReport

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

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

    • 引用位置: 参数