From f5f0d3c6f68ce9269ee2e094345a26507cf24c08 Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Tue, 5 Dec 2023 17:16:55 -0600 Subject: [PATCH] 1.20.3 compiles! --- build.gradle.kts | 6 +++- settings.gradle.kts | 2 ++ .../github/gaming32/worldhost/WorldHost.java | 4 +-- .../gaming32/worldhost/WorldHostConfig.java | 4 +-- .../worldhost/gui/screen/FriendsScreen.java | 28 +++++++++++++--- .../gui/screen/OnlineFriendsScreen.java | 18 +++++++--- .../worldhost/gui/screen/WorldHostScreen.java | 9 +++++ version.gradle.kts | 33 +++++++++++-------- versions/mainProject | 2 +- 9 files changed, 76 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f049b7d..70a4341 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,8 @@ repositories { } preprocess { + val fabric12003 = createNode("1.20.3-fabric", 1_20_03, "yarn") + val neoforge12003 = createNode("1.20.3-neoforge", 1_20_03, "yarn") val fabric12002 = createNode("1.20.2-fabric", 1_20_02, "yarn") val neoforge12002 = createNode("1.20.2-neoforge", 1_20_02, "yarn") val fabric12001 = createNode("1.20.1-fabric", 1_20_01, "yarn") @@ -24,7 +26,9 @@ preprocess { val forge11605 = createNode("1.16.5-forge", 1_16_05, "srg") val fabric11601 = createNode("1.16.1-fabric", 1_16_01, "yarn") - fabric12002.link(neoforge12002) + fabric12003.link(neoforge12003) + neoforge12003.link(neoforge12002) + neoforge12002.link(fabric12002) fabric12002.link(fabric12001) fabric12001.link(forge12001) forge12001.link(forge11904) diff --git a/settings.gradle.kts b/settings.gradle.kts index 9ef05f1..3b39224 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -37,6 +37,8 @@ listOf( "1.20.1-fabric", "1.20.2-neoforge", "1.20.2-fabric", + "1.20.3-neoforge", + "1.20.3-fabric", ).forEach { version -> include(":$version") project(":$version").apply { diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHost.java b/src/main/java/io/github/gaming32/worldhost/WorldHost.java index 4036d6e..a0ca5aa 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHost.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHost.java @@ -37,8 +37,8 @@ import net.minecraft.server.players.GameProfileCache; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.Nullable; -import org.quiltmc.qup.json.JsonReader; -import org.quiltmc.qup.json.JsonWriter; +import org.quiltmc.parsers.json.JsonReader; +import org.quiltmc.parsers.json.JsonWriter; import java.io.*; import java.net.InetAddress; diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHostConfig.java b/src/main/java/io/github/gaming32/worldhost/WorldHostConfig.java index 792263c..ed9ff1d 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHostConfig.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHostConfig.java @@ -1,8 +1,8 @@ package io.github.gaming32.worldhost; import io.github.gaming32.worldhost.gui.OnlineStatusLocation; -import org.quiltmc.qup.json.JsonReader; -import org.quiltmc.qup.json.JsonWriter; +import org.quiltmc.parsers.json.JsonReader; +import org.quiltmc.parsers.json.JsonWriter; import java.io.IOException; import java.util.LinkedHashSet; 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 a902dbd..56f39f3 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,15 +60,14 @@ protected void init() { super.init(); if (list == null) { - list = new FriendsList(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64), 36); + list = new FriendsList(); //#if MC > 1.16.1 if (minecraft != null && minecraft.level != null) { list.setRenderBackground(false); } //#endif - } else { - list.updateSize(width, height, 32, height - (WorldHost.BEDROCK_SUPPORT ? 80 : 64)); } + setListSize(list, 32, WorldHost.BEDROCK_SUPPORT ? 80 : 64); addWidget(list); addRenderableWidget( @@ -174,9 +173,17 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { } public class FriendsList extends ObjectSelectionList { - public FriendsList(int i, int j, int k, int l, int m) { + public FriendsList() { //noinspection DataFlowIssue - super(FriendsScreen.this.minecraft, i, j, k, l, m); + super( + FriendsScreen.this.minecraft, + //#if MC >= 1.20.3 + 0, 0, 0, + //#else + //$$ 0, 0, 0, 0, + //#endif + 36 + ); } //#if MC >= 1.20.2 @@ -184,6 +191,17 @@ public FriendsList(int i, int j, int k, int l, int m) { protected void renderDecorations(@NotNull GuiGraphics graphics, int mouseX, int mouseY) { super.renderDecorations(graphics, mouseX, mouseY); graphics.setColor(0.25f, 0.25f, 0.25f, 1f); + //#if MC >= 1.20.3 + final int x0 = getX(); + final int x1 = getRight(); + final int y0 = getY(); + final int y1 = getBottom(); + //#else + //$$ final int x0 = this.x0; + //$$ final int x1 = this.x1; + //$$ final int y0 = this.y0; + //$$ final int y1 = this.y1; + //#endif graphics.blit(BACKGROUND_LOCATION, x0, 0, 0f, 0f, width, y0, 32, 32); graphics.blit(BACKGROUND_LOCATION, x0, y1, 0f, y1, width, height - y1, 32, 32); graphics.setColor(1f, 1f, 1f, 1f); 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 2341067..76162c3 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 @@ -67,13 +67,12 @@ protected void init() { assert minecraft != null; sendRepeatEvents(true); if (list == null) { - list = new OnlineFriendsList(minecraft, width, height, 60, height - 64, 36); + list = new OnlineFriendsList(); WorldHost.ONLINE_FRIENDS.forEach((u, c) -> list.addEntry(new OnlineFriendsListEntry(u, c))); WorldHost.pingFriends(); WorldHost.ONLINE_FRIEND_UPDATES.add(this); - } else { - list.updateSize(width, height, 60, height - 64); } + setListSize(list, 60, 64); addWidget(list); joinButton = addRenderableWidget( @@ -231,8 +230,17 @@ public void friendsListUpdate(Map friends) { } public class OnlineFriendsList extends ObjectSelectionList { - public OnlineFriendsList(Minecraft minecraftClient, int i, int j, int k, int l, int m) { - super(minecraftClient, i, j, k, l, m); + public OnlineFriendsList() { + //noinspection DataFlowIssue + super( + OnlineFriendsScreen.this.minecraft, + //#if MC >= 1.20.3 + 0, 0, 0, + //#else + //$$ 0, 0, 0, 0, + //#endif + 36 + ); } @Nullable diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java index c48e1e8..0895301 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import io.github.gaming32.worldhost.versions.ButtonBuilder; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.components.AbstractSelectionList; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -402,4 +403,12 @@ public void whRenderBackground( super.renderBackground(context, mouseX, mouseY, delta); //#endif } + + public void setListSize(AbstractSelectionList list, int topMargin, int bottomMargin) { + //#if MC >= 1.20.3 + list.setRectangle(width, height - bottomMargin - topMargin, 0, topMargin); + //#else + //$$ list.updateSize(width, height, topMargin, height - bottomMargin); + //#endif + } } diff --git a/version.gradle.kts b/version.gradle.kts index d5972b7..190f30a 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -58,6 +58,7 @@ unimined.minecraft { searge() mojmap() when { + mcVersion >= 1_20_02 -> "1.20.2:2023.10.22" mcVersion >= 1_20_01 -> "1.20.1:2023.09.03" mcVersion >= 1_19_04 -> "1.19.4:2023.06.26" mcVersion >= 1_19_03 -> "1.19.3:2023.06.25" @@ -98,9 +99,13 @@ unimined.minecraft { } isNeoForge -> neoForged { loader(when (mcVersion) { - 1_20_02 -> "35-beta" + 1_20_02 -> "86" + 1_20_03 -> "1-beta" else -> throw IllegalStateException("Unknown NeoForge version for $mcVersionString") }) + minecraftRemapper.config { + ignoreConflicts(true) + } } else -> throw IllegalStateException() } @@ -205,9 +210,9 @@ dependencies { bundle(dependency) } - bundleImplementation("org.quiltmc.qup:json:0.2.0") + bundleImplementation("org.quiltmc.parsers:json:0.2.1") if (isForgeLike) { - "minecraftLibraries"("org.quiltmc.qup:json:0.2.0") + "minecraftLibraries"("org.quiltmc.parsers:json:0.2.1") } //TODO: bump to unimined 1.1.0+ to use these, also enable the processor in unimined's mixin config settings @@ -218,9 +223,10 @@ dependencies { if (isFabric) { when (mcVersion) { - 1_20_02 -> "8.0.0-beta.2" // TODO: Update out of beta - 1_20_01 -> "7.0.1" - 1_19_04 -> "6.2.3" + 1_20_03 -> "9.0.0-pre.1" // TODO: Update out of pre + 1_20_02 -> "8.0.0" + 1_20_01 -> "7.2.2" + 1_19_04 -> "6.3.1" 1_19_02 -> "4.2.0-beta.2" 1_18_02 -> "3.2.5" 1_17_01 -> "2.0.17" @@ -234,17 +240,16 @@ dependencies { } } - if (!isNeoForge) { // TODO: Remove check when DevAuth for NeoForge is released (which depends on Arch) - modRuntimeOnly("me.djtheredstoner:DevAuth-${if (isFabric) "fabric" else "forge-latest"}:1.1.2") - } + modRuntimeOnly("me.djtheredstoner:DevAuth-${if (isFabric) "fabric" else "forge-latest"}:1.1.2") if (isFabric) { when (mcVersion) { - 1_20_02 -> "0.89.2+1.20.2" - 1_20_01 -> "0.89.0+1.20.1" - 1_19_04 -> "0.87.0+1.19.4" - 1_19_02 -> "0.76.1+1.19.2" - 1_18_02 -> "0.76.0+1.18.2" + 1_20_03 -> "0.91.1+1.20.3" + 1_20_02 -> "0.91.1+1.20.2" + 1_20_01 -> "0.91.0+1.20.1" + 1_19_04 -> "0.87.2+1.19.4" + 1_19_02 -> "0.77.0+1.19.2" + 1_18_02 -> "0.77.0+1.18.2" 1_17_01 -> "0.46.1+1.17" 1_16_05, 1_16_01 -> "0.42.0+1.16" else -> null diff --git a/versions/mainProject b/versions/mainProject index 1c5c939..8a82347 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.20.2-fabric \ No newline at end of file +1.20.3-fabric \ No newline at end of file