ReportEnvironment.java
net.minecraft.client.multiplayer.chat.report.ReportEnvironment
信息
- 全限定名:net.minecraft.client.multiplayer.chat.report.ReportEnvironment
- 类型:public record
- 包:net.minecraft.client.multiplayer.chat.report
- 源码路径:src/main/java/net/minecraft/client/multiplayer/chat/report/ReportEnvironment.java
- 起始行号:L15
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.multiplayer.chat.report.ReportEnvironment.Server- 类型:
interface - 修饰符:
public - 源码定位:
L55 - 说明:
TODO
- 类型:
-
net.minecraft.client.multiplayer.chat.report.ReportEnvironment.Server.Realm- 类型:
record - 修饰符:
public - 源码定位:
L57 - 说明:
TODO
- 类型:
-
net.minecraft.client.multiplayer.chat.report.ReportEnvironment.Server.ThirdParty- 类型:
record - 修饰符:
public - 源码定位:
L64 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static ReportEnvironment local() @ L16
- 方法名:local
- 源码定位:L16
- 返回类型:ReportEnvironment
- 修饰符:public static
参数:
- 无
说明:
TODO
public static ReportEnvironment thirdParty(String ip) @ L20
- 方法名:thirdParty
- 源码定位:L20
- 返回类型:ReportEnvironment
- 修饰符:public static
参数:
- ip: String
说明:
TODO
public static ReportEnvironment realm(RealmsServer realm) @ L24
- 方法名:realm
- 源码定位:L24
- 返回类型:ReportEnvironment
- 修饰符:public static
参数:
- realm: RealmsServer
说明:
TODO
public static ReportEnvironment create(ReportEnvironment.Server server) @ L28
- 方法名:create
- 源码定位:L28
- 返回类型:ReportEnvironment
- 修饰符:public static
参数:
- server: ReportEnvironment.Server
说明:
TODO
public ClientInfo clientInfo() @ L32
- 方法名:clientInfo
- 源码定位:L32
- 返回类型:ClientInfo
- 修饰符:public
参数:
- 无
说明:
TODO
public ThirdPartyServerInfo thirdPartyServerInfo() @ L36
- 方法名:thirdPartyServerInfo
- 源码定位:L36
- 返回类型:ThirdPartyServerInfo
- 修饰符:public
参数:
- 无
说明:
TODO
public RealmInfo realmInfo() @ L40
- 方法名:realmInfo
- 源码定位:L40
- 返回类型:RealmInfo
- 修饰符:public
参数:
- 无
说明:
TODO
private static String getClientVersion() @ L44
- 方法名:getClientVersion
- 源码定位:L44
- 返回类型:String
- 修饰符:private static
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record ReportEnvironment(String clientVersion, ReportEnvironment.@Nullable Server server) {
public static ReportEnvironment local() {
return create(null);
}
public static ReportEnvironment thirdParty(String ip) {
return create(new ReportEnvironment.Server.ThirdParty(ip));
}
public static ReportEnvironment realm(RealmsServer realm) {
return create(new ReportEnvironment.Server.Realm(realm));
}
public static ReportEnvironment create(ReportEnvironment.@Nullable Server server) {
return new ReportEnvironment(getClientVersion(), server);
}
public ClientInfo clientInfo() {
return new ClientInfo(this.clientVersion, Locale.getDefault().toLanguageTag());
}
public @Nullable ThirdPartyServerInfo thirdPartyServerInfo() {
return this.server instanceof ReportEnvironment.Server.ThirdParty thirdParty ? new ThirdPartyServerInfo(thirdParty.ip) : null;
}
public @Nullable RealmInfo realmInfo() {
return this.server instanceof ReportEnvironment.Server.Realm realm ? new RealmInfo(String.valueOf(realm.realmId()), realm.slotId()) : null;
}
private static String getClientVersion() {
StringBuilder version = new StringBuilder();
version.append(SharedConstants.getCurrentVersion().id());
if (Minecraft.checkModStatus().shouldReportAsModified()) {
version.append(" (modded)");
}
return version.toString();
}
@OnlyIn(Dist.CLIENT)
public interface Server {
@OnlyIn(Dist.CLIENT)
public record Realm(long realmId, int slotId) implements ReportEnvironment.Server {
public Realm(RealmsServer realm) {
this(realm.id, realm.activeSlot);
}
}
@OnlyIn(Dist.CLIENT)
public record ThirdParty(String ip) implements ReportEnvironment.Server {
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SharedConstants.getCurrentVersion()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Minecraft.checkModStatus()
- 引用位置:
-
- 引用位置:
构造调用/返回值 - 关联成员:
ClientInfo()
- 引用位置: