From 6210c3023968bce614306f0a43cdfb7db6a8bb44 Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Mon, 2 Oct 2023 07:25:24 -0500 Subject: [PATCH] Fix crashes on 1.20.2 --- src/main/java/io/github/gaming32/worldhost/WorldHost.java | 2 +- .../gaming32/worldhost/gui/screen/AddFriendScreen.java | 2 +- .../github/gaming32/worldhost/gui/screen/FriendsScreen.java | 5 +++-- .../gaming32/worldhost/gui/screen/OnlineFriendsScreen.java | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHost.java b/src/main/java/io/github/gaming32/worldhost/WorldHost.java index 4199d48..7a8eb88 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHost.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHost.java @@ -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 diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java index 27b4795..81756b9 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java @@ -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); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java index d0cd5d2..a902dbd 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java @@ -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); @@ -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 -> { @@ -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 diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java index d4025c2..1535044 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java @@ -301,7 +301,7 @@ public class OnlineFriendsListEntry extends ObjectSelectionList.Entry profile = WorldHost.fetchProfile(minecraft.getMinecraftSessionService(), profile) );