SkinReportScreen .java

net.minecraft.client.gui.screens.reporting.SkinReportScreen (class, 80 lines): members: FORM_WIDTH, selectReasonButton, SKIN_WIDTH, onReportChanged, TITLE.

net.minecraft.client.gui.screens.reportingclass80 linesclientextends AbstractReportScreen<SkinReport.Builder>3.5 KB

API Surface (3)

void addContent()
void onReportChanged()
boolean mouseReleased(final MouseButtonEvent event)

Fields & Constants (5)

SKIN_WIDTH
FORM_WIDTH
TITLE
commentBox
selectReasonButton

String literals (1)

"gui.abuseReport.skin.title"

Full Source

SkinReportScreen.java80 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.screens.reporting;
2
3
import java.util.UUID;
4
import java.util.function.Supplier;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.client.gui.components.Button;
8
import net.minecraft.client.gui.components.MultiLineEditBox;
9
import net.minecraft.client.gui.components.PlayerSkinWidget;
10
import net.minecraft.client.gui.layouts.CommonLayouts;
11
import net.minecraft.client.gui.layouts.LinearLayout;
12
import net.minecraft.client.gui.screens.Screen;
13
import net.minecraft.client.input.MouseButtonEvent;
14
import net.minecraft.client.multiplayer.chat.report.ReportReason;
15
import net.minecraft.client.multiplayer.chat.report.ReportType;
16
import net.minecraft.client.multiplayer.chat.report.ReportingContext;
17
import net.minecraft.client.multiplayer.chat.report.SkinReport;
18
import net.minecraft.network.chat.Component;
19
import net.minecraft.world.entity.player.PlayerSkin;
20
21
@Environment(EnvType.CLIENT)
22
public class SkinReportScreen extends AbstractReportScreen<SkinReport.Builder> {
23
	private static final int SKIN_WIDTH = 85;
24
	private static final int FORM_WIDTH = 178;
25
	private static final Component TITLE = Component.translatable("gui.abuseReport.skin.title");
26
	private MultiLineEditBox commentBox;
27
	private Button selectReasonButton;
28
29
	private SkinReportScreen(final Screen lastScreen, final ReportingContext reportingContext, final SkinReport.Builder reportBuilder) {
30
		super(TITLE, lastScreen, reportingContext, reportBuilder);
31
	}
32
33
	public SkinReportScreen(final Screen lastScreen, final ReportingContext reportingContext, final UUID playerId, final Supplier<PlayerSkin> skinGetter) {
34
		this(lastScreen, reportingContext, new SkinReport.Builder(playerId, skinGetter, reportingContext.sender().reportLimits()));
35
	}
36
37
	public SkinReportScreen(final Screen lastScreen, final ReportingContext reportingContext, final SkinReport draft) {
38
		this(lastScreen, reportingContext, new SkinReport.Builder(draft, reportingContext.sender().reportLimits()));
39
	}
40
41
	@Override
42
	protected void addContent() {
43
		LinearLayout contentLayout = this.layout.addChild(LinearLayout.horizontal().spacing(8));
44
		contentLayout.defaultCellSetting().alignVerticallyMiddle();
45
		contentLayout.addChild(new PlayerSkinWidget(85, 120, this.minecraft.getEntityModels(), this.reportBuilder.report().getSkinGetter()));
46
		LinearLayout formLayout = contentLayout.addChild(LinearLayout.vertical().spacing(8));
47
		this.selectReasonButton = Button.builder(
48
				SELECT_REASON, var1x -> this.minecraft.gui.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), ReportType.SKIN, reason -> {
49
					this.reportBuilder.setReason(reason);
50
					this.onReportChanged();
51
				}))
52
			)
53
			.width(178)
54
			.build();
55
		formLayout.addChild(CommonLayouts.labeledElement(this.font, this.selectReasonButton, OBSERVED_WHAT_LABEL));
56
		this.commentBox = this.createCommentBox(178, 9 * 8, comments -> {
57
			this.reportBuilder.setComments(comments);
58
			this.onReportChanged();
59
		});
60
		formLayout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, MORE_COMMENTS_LABEL, s -> s.paddingBottom(12)));
61
	}
62
63
	@Override
64
	protected void onReportChanged() {
65
		ReportReason reportReason = this.reportBuilder.reason();
66
		if (reportReason != null) {
67
			this.selectReasonButton.setMessage(reportReason.title());
68
		} else {
69
			this.selectReasonButton.setMessage(SELECT_REASON);
70
		}
71
72
		super.onReportChanged();
73
	}
74
75
	@Override
76
	public boolean mouseReleased(final MouseButtonEvent event) {
77
		return super.mouseReleased(event) ? true : this.commentBox.mouseReleased(event);
78
	}
79
}
80

Decompiled Minecraft 26.3 source of SkinReportScreen (net/minecraft/client/gui/screens/reporting/SkinReportScreen.java) with Mojang official mappings, stored verbatim on the site.