mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Co-authored-by: David Quintana <[email protected]> Co-authored-by: SizableShrimp <[email protected]>
50 lines
2.5 KiB
Diff
50 lines
2.5 KiB
Diff
--- a/net/minecraft/client/User.java
|
|
+++ b/net/minecraft/client/User.java
|
|
@@ -21,8 +_,22 @@
|
|
private final Optional<String> f_193796_;
|
|
private final Optional<String> f_193797_;
|
|
private final User.Type f_92538_;
|
|
+ /** Forge: Cache of the local session's GameProfile properties. */
|
|
+ private com.mojang.authlib.properties.PropertyMap properties;
|
|
|
|
public User(String p_193799_, String p_193800_, String p_193801_, Optional<String> p_193802_, Optional<String> p_193803_, User.Type p_193804_) {
|
|
+ if (p_193799_ == null || p_193799_.isEmpty()) {
|
|
+ p_193799_ = "MissingName";
|
|
+ p_193800_ = p_193801_ = "NotValid";
|
|
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
|
|
+ logger.warn("=========================================================");
|
|
+ logger.warn("WARNING!! the username was not set for this session, typically");
|
|
+ logger.warn("this means you installed Forge incorrectly. We have set your");
|
|
+ logger.warn("name to \"MissingName\" and your session to nothing. Please");
|
|
+ logger.warn("check your installation and post a console log from the launcher");
|
|
+ logger.warn("when asking for help!");
|
|
+ logger.warn("=========================================================");
|
|
+ }
|
|
this.f_92535_ = p_193799_;
|
|
this.f_92536_ = p_193800_;
|
|
this.f_92537_ = p_193801_;
|
|
@@ -58,10 +_,22 @@
|
|
public GameProfile m_92548_() {
|
|
try {
|
|
UUID uuid = UUIDTypeAdapter.fromString(this.m_92545_());
|
|
- return new GameProfile(uuid, this.m_92546_());
|
|
+ GameProfile ret = new GameProfile(uuid, this.m_92546_()); //Forge: Adds cached GameProfile properties to returned GameProfile.
|
|
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
|
|
+ return ret; // which helps to fix MC-52974.
|
|
} catch (IllegalArgumentException illegalargumentexception) {
|
|
return new GameProfile((UUID)null, this.m_92546_());
|
|
}
|
|
+ }
|
|
+
|
|
+ //For internal use only. Modders should never need to use this.
|
|
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
|
+ if (this.properties == null)
|
|
+ this.properties = properties;
|
|
+ }
|
|
+
|
|
+ public boolean hasCachedProperties() {
|
|
+ return properties != null;
|
|
}
|
|
|
|
public User.Type m_168638_() {
|