diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHost.java b/src/main/java/io/github/gaming32/worldhost/WorldHost.java index c7004fb..12cf767 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHost.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHost.java @@ -423,7 +423,12 @@ public static void reconnect(boolean successToast, boolean failureToast) { proxyProtocolClient.close(); proxyProtocolClient = null; } - final UUID uuid = Minecraft.getInstance().getUser().getProfileId(); + final var user = Minecraft.getInstance().getUser(); + //#if MC >= 1.19.2 + final UUID uuid = user.getProfileId(); + //#else + //$$ final UUID uuid = user.getGameProfile().getId(); + //#endif //noinspection ConstantValue if (uuid == null) { LOGGER.warn("Failed to get player UUID. Unable to use World Host."); 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 c056c00..b61ff96 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 @@ -78,7 +78,11 @@ protected void init() { usernameField = addWidget(new EditBox(font, width / 2 - 100, 66, 200, 20, FRIEND_USERNAME_TEXT)); usernameField.setMaxLength(36); + //#if MC >= 1.19.4 usernameField.setFocused(true); + //#else + //$$ usernameField.setFocus(true); + //#endif if (friendProfile != null) { usernameField.setValue(friendProfile.getName()); } @@ -176,7 +180,12 @@ public void render( final ResourceLocation skinTexture = WorldHost.getSkinLocationNow(friendProfile); RenderSystem.setShaderColor(1f, 1f, 1f, 1f); RenderSystem.enableBlend(); - final int size = addFriendButton.getY() - 110; + //#if MC >= 1.19.4 + final int addFriendY = addFriendButton.getY(); + //#else + //$$ final int addFriendY = addFriendButton.y; + //#endif + final int size = addFriendY - 110; final int x = width / 2 - size / 2; blit(context, skinTexture, x, 98, size, size, 8, 8, 8, 8, 64, 64); blit(context, skinTexture, x, 98, size, size, 40, 8, 8, 8, 64, 64); diff --git a/src/main/java/io/github/gaming32/worldhost/versions/Pattern.java b/src/main/java/io/github/gaming32/worldhost/versions/Pattern.java deleted file mode 100644 index d76e947..0000000 --- a/src/main/java/io/github/gaming32/worldhost/versions/Pattern.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.github.gaming32.worldhost.versions; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.SOURCE) -@Target(ElementType.METHOD) -public @interface Pattern { -} diff --git a/src/main/java/io/github/gaming32/worldhost/versions/Patterns.java b/src/main/java/io/github/gaming32/worldhost/versions/Patterns.java deleted file mode 100644 index d773235..0000000 --- a/src/main/java/io/github/gaming32/worldhost/versions/Patterns.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.github.gaming32.worldhost.versions; - -import net.minecraft.client.User; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.components.EditBox; - -import java.util.UUID; - -public class Patterns { - @Pattern - public static void setFocused(EditBox editBox, boolean focus) { - //#if MC >= 1.19.4 - editBox.setFocused(focus); - //#else - //$$ editBox.setFocus(focus); - //#endif - } - - @Pattern - public static int getY(AbstractWidget widget) { - //#if MC >= 1.19.4 - return widget.getY(); - //#else - //$$ return widget.y; - //#endif - } - - @Pattern - public static UUID getProfileId(User user) { - //#if MC >= 1.19.2 - return user.getProfileId(); - //#else - //$$ return user.getGameProfile().getId(); - //#endif - } -}