Skip to content

Commit

Permalink
Fix crashes on 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Oct 2, 2023
1 parent b960ae5 commit 6210c30
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/github/gaming32/worldhost/WorldHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public static GameProfile fetchProfile(MinecraftSessionService sessionService, U
//#else
final ProfileResult result = sessionService.fetchProfile(uuid, false);
if (result == null) {
return fallback != null ? fallback : new GameProfile(uuid, null);
return fallback != null ? fallback : new GameProfile(uuid, "");
}
return result.profile();
//#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void tick() {
}
});
} else if (VALID_UUID.matcher(username).matches()) {
friendProfile = new GameProfile(UUID.fromString(username), null);
friendProfile = new GameProfile(UUID.fromString(username), "");
addFriendButton.active = true;
} else if (username.startsWith("o:")) {
final String actualName = username.substring(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected void init() {
super.init();

if (list == null) {
list = addWidget(new FriendsList(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64), 36));
list = new FriendsList(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64), 36);
//#if MC > 1.16.1
if (minecraft != null && minecraft.level != null) {
list.setRenderBackground(false);
Expand All @@ -69,6 +69,7 @@ protected void init() {
} else {
list.updateSize(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64));
}
addWidget(list);

addRenderableWidget(
button(ADD_FRIEND_TEXT, button -> {
Expand Down Expand Up @@ -200,7 +201,7 @@ public void setSelected(@Nullable FriendsEntry entry) {

private void updateEntries() {
clearEntries();
WorldHost.CONFIG.getFriends().forEach(uuid -> addEntry(new FriendsEntry(new GameProfile(uuid, null))));
WorldHost.CONFIG.getFriends().forEach(uuid -> addEntry(new FriendsEntry(new GameProfile(uuid, ""))));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public class OnlineFriendsListEntry extends ObjectSelectionList.Entry<OnlineFrie
public OnlineFriendsListEntry(UUID friendUuid, long connectionId) {
minecraft = Minecraft.getInstance();
this.connectionId = connectionId;
profile = new GameProfile(friendUuid, null);
profile = new GameProfile(friendUuid, "");
Util.backgroundExecutor().execute(
() -> profile = WorldHost.fetchProfile(minecraft.getMinecraftSessionService(), profile)
);
Expand Down

0 comments on commit 6210c30

Please sign in to comment.