ReportPlayerScreen.java
net.minecraft.client.gui.screens.reporting.ReportPlayerScreen
信息
- 全限定名:net.minecraft.client.gui.screens.reporting.ReportPlayerScreen
- 类型:public class
- 包:net.minecraft.client.gui.screens.reporting
- 源码路径:src/main/java/net/minecraft/client/gui/screens/reporting/ReportPlayerScreen.java
- 起始行号:L19
- 继承:Screen
- 职责:
TODO
字段/常量
-
TITLE- 类型:
Component - 修饰符:
private static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
MESSAGE- 类型:
Component - 修饰符:
private static final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
REPORT_CHAT- 类型:
Component - 修饰符:
private static final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
REPORT_SKIN- 类型:
Component - 修饰符:
private static final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
REPORT_NAME- 类型:
Component - 修饰符:
private static final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
SPACING- 类型:
int - 修饰符:
private static final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
lastScreen- 类型:
Screen - 修饰符:
private final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
context- 类型:
ReportingContext - 修饰符:
private final - 源码定位:
L27 - 说明:
TODO
- 类型:
-
player- 类型:
PlayerEntry - 修饰符:
private final - 源码定位:
L28 - 说明:
TODO
- 类型:
-
chatDisabledOrBlocked- 类型:
boolean - 修饰符:
private final - 源码定位:
L29 - 说明:
TODO
- 类型:
-
layout- 类型:
LinearLayout - 修饰符:
private final - 源码定位:
L30 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ReportPlayerScreen(Screen lastScreen, ReportingContext context, PlayerEntry player, boolean chatDisabledOrBlocked) @ L32
- 构造器名:ReportPlayerScreen
- 源码定位:L32
- 修饰符:public
参数:
- lastScreen: Screen
- context: ReportingContext
- player: PlayerEntry
- chatDisabledOrBlocked: boolean
说明:
TODO
方法
下面的方法块按源码顺序生成。
public Component getNarrationMessage() @ L40
- 方法名:getNarrationMessage
- 源码定位:L40
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
protected void init() @ L45
- 方法名:init
- 源码定位:L45
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
protected void repositionElements() @ L90
- 方法名:repositionElements
- 源码定位:L90
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public void onClose() @ L96
- 方法名:onClose
- 源码定位:L96
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class ReportPlayerScreen extends Screen {
private static final Component TITLE = Component.translatable("gui.abuseReport.title");
private static final Component MESSAGE = Component.translatable("gui.abuseReport.message");
private static final Component REPORT_CHAT = Component.translatable("gui.abuseReport.type.chat");
private static final Component REPORT_SKIN = Component.translatable("gui.abuseReport.type.skin");
private static final Component REPORT_NAME = Component.translatable("gui.abuseReport.type.name");
private static final int SPACING = 6;
private final Screen lastScreen;
private final ReportingContext context;
private final PlayerEntry player;
private final boolean chatDisabledOrBlocked;
private final LinearLayout layout = LinearLayout.vertical().spacing(6);
public ReportPlayerScreen(Screen lastScreen, ReportingContext context, PlayerEntry player, boolean chatDisabledOrBlocked) {
super(TITLE);
this.lastScreen = lastScreen;
this.context = context;
this.player = player;
this.chatDisabledOrBlocked = chatDisabledOrBlocked;
}
@Override
public Component getNarrationMessage() {
return CommonComponents.joinForNarration(super.getNarrationMessage(), MESSAGE);
}
@Override
protected void init() {
this.layout.defaultCellSetting().alignHorizontallyCenter();
this.layout.addChild(new StringWidget(this.title, this.font), this.layout.newCellSettings().paddingBottom(6));
this.layout.addChild(new MultiLineTextWidget(MESSAGE, this.font).setCentered(true), this.layout.newCellSettings().paddingBottom(6));
Button chatButton = this.layout
.addChild(
Button.builder(REPORT_CHAT, b -> this.minecraft.setScreen(new ChatReportScreen(this.lastScreen, this.context, this.player.getPlayerId())))
.build()
);
if (this.chatDisabledOrBlocked) {
chatButton.active = false;
chatButton.setTooltip(Tooltip.create(Component.translatable("gui.socialInteractions.tooltip.report.chat_disabled_or_blocked")));
} else if (!this.player.isChatReportable()) {
chatButton.active = false;
chatButton.setTooltip(Tooltip.create(Component.translatable("gui.socialInteractions.tooltip.report.not_reportable")));
} else if (!this.player.hasRecentMessages()) {
chatButton.active = false;
chatButton.setTooltip(Tooltip.create(Component.translatable("gui.socialInteractions.tooltip.report.no_messages", this.player.getPlayerName())));
}
this.layout
.addChild(
Button.builder(
REPORT_SKIN,
b -> this.minecraft
.setScreen(new SkinReportScreen(this.lastScreen, this.context, this.player.getPlayerId(), this.player.getSkinGetter()))
)
.build()
);
this.layout
.addChild(
Button.builder(
REPORT_NAME,
b -> this.minecraft
.setScreen(new NameReportScreen(this.lastScreen, this.context, this.player.getPlayerId(), this.player.getPlayerName()))
)
.build()
);
this.layout.addChild(SpacerElement.height(20));
this.layout.addChild(Button.builder(CommonComponents.GUI_CANCEL, b -> this.onClose()).build());
this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
this.repositionElements();
}
@Override
protected void repositionElements() {
this.layout.arrangeElements();
FrameLayout.centerInRectangle(this.layout, this.getRectangle());
}
@Override
public void onClose() {
this.minecraft.setScreen(this.lastScreen);
}
}引用的其他类
-
- 引用位置:
方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MultiLineTextWidget()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
StringWidget()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Tooltip.create()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
FrameLayout.centerInRectangle()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
LinearLayout.vertical()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SpacerElement.height()
- 引用位置:
-
- 引用位置:
参数/字段/继承
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
ChatReportScreen()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
NameReportScreen()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
SkinReportScreen()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CommonComponents.joinForNarration()
- 引用位置:
-
- 引用位置:
字段/方法调用/返回值 - 关联成员:
Component.translatable()
- 引用位置: