PlayerInfo.java
net.minecraft.client.multiplayer.PlayerInfo
信息
- 全限定名:net.minecraft.client.multiplayer.PlayerInfo
- 类型:public class
- 包:net.minecraft.client.multiplayer
- 源码路径:src/main/java/net/minecraft/client/multiplayer/PlayerInfo.java
- 起始行号:L18
- 职责:
TODO
字段/常量
-
profile- 类型:
GameProfile - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
skinLookup- 类型:
Supplier<PlayerSkin> - 修饰符:
private - 源码定位:
L20 - 说明:
TODO
- 类型:
-
gameMode- 类型:
GameType - 修饰符:
private - 源码定位:
L21 - 说明:
TODO
- 类型:
-
latency- 类型:
int - 修饰符:
private - 源码定位:
L22 - 说明:
TODO
- 类型:
-
tabListDisplayName- 类型:
Component - 修饰符:
private - 源码定位:
L23 - 说明:
TODO
- 类型:
-
showHat- 类型:
boolean - 修饰符:
private - 源码定位:
L24 - 说明:
TODO
- 类型:
-
chatSession- 类型:
RemoteChatSession - 修饰符:
private - 源码定位:
L25 - 说明:
TODO
- 类型:
-
messageValidator- 类型:
SignedMessageValidator - 修饰符:
private - 源码定位:
L26 - 说明:
TODO
- 类型:
-
tabListOrder- 类型:
int - 修饰符:
private - 源码定位:
L27 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public PlayerInfo(GameProfile profile, boolean enforcesSecureChat) @ L29
- 构造器名:PlayerInfo
- 源码定位:L29
- 修饰符:public
参数:
- profile: GameProfile
- enforcesSecureChat: boolean
说明:
TODO
方法
下面的方法块按源码顺序生成。
private static Supplier<PlayerSkin> createSkinLookup(GameProfile profile) @ L34
- 方法名:createSkinLookup
- 源码定位:L34
- 返回类型:Supplier
- 修饰符:private static
参数:
- profile: GameProfile
说明:
TODO
public GameProfile getProfile() @ L40
- 方法名:getProfile
- 源码定位:L40
- 返回类型:GameProfile
- 修饰符:public
参数:
- 无
说明:
TODO
public RemoteChatSession getChatSession() @ L44
- 方法名:getChatSession
- 源码定位:L44
- 返回类型:RemoteChatSession
- 修饰符:public
参数:
- 无
说明:
TODO
public SignedMessageValidator getMessageValidator() @ L48
- 方法名:getMessageValidator
- 源码定位:L48
- 返回类型:SignedMessageValidator
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean hasVerifiableChat() @ L52
- 方法名:hasVerifiableChat
- 源码定位:L52
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
protected void setChatSession(RemoteChatSession chatSession) @ L56
- 方法名:setChatSession
- 源码定位:L56
- 返回类型:void
- 修饰符:protected
参数:
- chatSession: RemoteChatSession
说明:
TODO
protected void clearChatSession(boolean enforcesSecureChat) @ L61
- 方法名:clearChatSession
- 源码定位:L61
- 返回类型:void
- 修饰符:protected
参数:
- enforcesSecureChat: boolean
说明:
TODO
private static SignedMessageValidator fallbackMessageValidator(boolean enforcesSecureChat) @ L66
- 方法名:fallbackMessageValidator
- 源码定位:L66
- 返回类型:SignedMessageValidator
- 修饰符:private static
参数:
- enforcesSecureChat: boolean
说明:
TODO
public GameType getGameMode() @ L70
- 方法名:getGameMode
- 源码定位:L70
- 返回类型:GameType
- 修饰符:public
参数:
- 无
说明:
TODO
protected void setGameMode(GameType gameMode) @ L74
- 方法名:setGameMode
- 源码定位:L74
- 返回类型:void
- 修饰符:protected
参数:
- gameMode: GameType
说明:
TODO
public int getLatency() @ L78
- 方法名:getLatency
- 源码定位:L78
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
protected void setLatency(int latency) @ L82
- 方法名:setLatency
- 源码定位:L82
- 返回类型:void
- 修饰符:protected
参数:
- latency: int
说明:
TODO
public PlayerSkin getSkin() @ L86
- 方法名:getSkin
- 源码定位:L86
- 返回类型:PlayerSkin
- 修饰符:public
参数:
- 无
说明:
TODO
public PlayerTeam getTeam() @ L94
- 方法名:getTeam
- 源码定位:L94
- 返回类型:PlayerTeam
- 修饰符:public
参数:
- 无
说明:
TODO
public void setTabListDisplayName(Component tabListDisplayName) @ L98
- 方法名:setTabListDisplayName
- 源码定位:L98
- 返回类型:void
- 修饰符:public
参数:
- tabListDisplayName: Component
说明:
TODO
public Component getTabListDisplayName() @ L102
- 方法名:getTabListDisplayName
- 源码定位:L102
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
public void setShowHat(boolean showHat) @ L106
- 方法名:setShowHat
- 源码定位:L106
- 返回类型:void
- 修饰符:public
参数:
- showHat: boolean
说明:
TODO
public boolean showHat() @ L110
- 方法名:showHat
- 源码定位:L110
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public void setTabListOrder(int tabListOrder) @ L114
- 方法名:setTabListOrder
- 源码定位:L114
- 返回类型:void
- 修饰符:public
参数:
- tabListOrder: int
说明:
TODO
public int getTabListOrder() @ L118
- 方法名:getTabListOrder
- 源码定位:L118
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class PlayerInfo {
private final GameProfile profile;
private @Nullable Supplier<PlayerSkin> skinLookup;
private GameType gameMode = GameType.DEFAULT_MODE;
private int latency;
private @Nullable Component tabListDisplayName;
private boolean showHat = true;
private @Nullable RemoteChatSession chatSession;
private SignedMessageValidator messageValidator;
private int tabListOrder;
public PlayerInfo(GameProfile profile, boolean enforcesSecureChat) {
this.profile = profile;
this.messageValidator = fallbackMessageValidator(enforcesSecureChat);
}
private static Supplier<PlayerSkin> createSkinLookup(GameProfile profile) {
Minecraft minecraft = Minecraft.getInstance();
boolean requireSecure = !minecraft.isLocalPlayer(profile.id());
return minecraft.getSkinManager().createLookup(profile, requireSecure);
}
public GameProfile getProfile() {
return this.profile;
}
public @Nullable RemoteChatSession getChatSession() {
return this.chatSession;
}
public SignedMessageValidator getMessageValidator() {
return this.messageValidator;
}
public boolean hasVerifiableChat() {
return this.chatSession != null;
}
protected void setChatSession(RemoteChatSession chatSession) {
this.chatSession = chatSession;
this.messageValidator = chatSession.createMessageValidator(ProfilePublicKey.EXPIRY_GRACE_PERIOD);
}
protected void clearChatSession(boolean enforcesSecureChat) {
this.chatSession = null;
this.messageValidator = fallbackMessageValidator(enforcesSecureChat);
}
private static SignedMessageValidator fallbackMessageValidator(boolean enforcesSecureChat) {
return enforcesSecureChat ? SignedMessageValidator.REJECT_ALL : SignedMessageValidator.ACCEPT_UNSIGNED;
}
public GameType getGameMode() {
return this.gameMode;
}
protected void setGameMode(GameType gameMode) {
this.gameMode = gameMode;
}
public int getLatency() {
return this.latency;
}
protected void setLatency(int latency) {
this.latency = latency;
}
public PlayerSkin getSkin() {
if (this.skinLookup == null) {
this.skinLookup = createSkinLookup(this.profile);
}
return this.skinLookup.get();
}
public @Nullable PlayerTeam getTeam() {
return Minecraft.getInstance().level.getScoreboard().getPlayersTeam(this.getProfile().name());
}
public void setTabListDisplayName(@Nullable Component tabListDisplayName) {
this.tabListDisplayName = tabListDisplayName;
}
public @Nullable Component getTabListDisplayName() {
return this.tabListDisplayName;
}
public void setShowHat(boolean showHat) {
this.showHat = showHat;
}
public boolean showHat() {
return this.showHat;
}
public void setTabListOrder(int tabListOrder) {
this.tabListOrder = tabListOrder;
}
public int getTabListOrder() {
return this.tabListOrder;
}
}引用的其他类
-
- 引用位置:
方法调用 - 关联成员:
Minecraft.getInstance()
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
返回值
- 引用位置: