From 7c28b78c1045703d66a340f284dc4b2104bade66 Mon Sep 17 00:00:00 2001 From: Josiah Glosson Date: Tue, 3 Dec 2024 15:42:08 -0600 Subject: [PATCH 1/5] Add 1.21.4 to build --- build.gradle.kts | 50 +++++++++++++++++++++++++-------------------- settings.gradle.kts | 2 ++ version.gradle.kts | 5 +++++ 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 546446c..42e487c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("io.github.gaming32.gradle.preprocess-root") version "0.4.4" - id("dev.architectury.loom") version "1.7.415" apply false + id("dev.architectury.loom") version "1.7.416" apply false id("com.modrinth.minotaur") version "2.8.7" apply false id("xyz.wagyourtail.jvmdowngrader") version "1.2.1" apply false } @@ -10,14 +10,18 @@ repositories { } preprocess { - val fabric12103 = createNode("1.21.3-fabric", 1_21_03, "yarn") - val neoforge12103 = createNode("1.21.3-neoforge", 1_21_03, "yarn") - val fabric12101 = createNode("1.21.1-fabric", 1_21_01, "yarn") - val neoforge12101 = createNode("1.21.1-neoforge", 1_21_01, "yarn") - val fabric12006 = createNode("1.20.6-fabric", 1_20_06, "yarn") - val neoforge12006 = createNode("1.20.6-neoforge", 1_20_06, "yarn") - val fabric12004 = createNode("1.20.4-fabric", 1_20_04, "yarn") - val neoforge12004 = createNode("1.20.4-neoforge", 1_20_04, "yarn") + fun createNode(project: String, mcVersion: Int) = createNode(project, mcVersion, "yarn") + + val fabric12104 = createNode("1.21.4-fabric", 1_21_04) + val neoforge12104 = createNode("1.21.4-neoforge", 1_21_04) + val fabric12103 = createNode("1.21.3-fabric", 1_21_03) + val neoforge12103 = createNode("1.21.3-neoforge", 1_21_03) + val fabric12101 = createNode("1.21.1-fabric", 1_21_01) + val neoforge12101 = createNode("1.21.1-neoforge", 1_21_01) + val fabric12006 = createNode("1.20.6-fabric", 1_20_06) + val neoforge12006 = createNode("1.20.6-neoforge", 1_20_06) + val fabric12004 = createNode("1.20.4-fabric", 1_20_04) + val neoforge12004 = createNode("1.20.4-neoforge", 1_20_04) val fabric12001 = createNode("1.20.1-fabric", 1_20_01, "yarn") val forge12001 = createNode("1.20.1-forge", 1_20_01, "srg") val fabric11904 = createNode("1.19.4-fabric", 1_19_04, "yarn") @@ -25,19 +29,21 @@ preprocess { val fabric11902 = createNode("1.19.2-fabric", 1_19_02, "yarn") val forge11902 = createNode("1.19.2-forge", 1_19_02, "srg") - fabric12103.link(neoforge12103) - neoforge12103.link(neoforge12101) - neoforge12101.link(fabric12101) - fabric12101.link(fabric12006) - fabric12006.link(neoforge12006) - neoforge12006.link(neoforge12004) - neoforge12004.link(fabric12004) - fabric12004.link(fabric12001) - fabric12001.link(forge12001) - forge12001.link(forge11904) - forge11904.link(fabric11904) - fabric11904.link(fabric11902) - fabric11902.link(forge11902) + fabric12104.link(neoforge12104) + neoforge12104.link(neoforge12103) + neoforge12103.link(fabric12103) + fabric12103.link(fabric12101) + fabric12101.link(neoforge12101) + neoforge12101.link(neoforge12006) + neoforge12006.link(fabric12006) + fabric12006.link(fabric12004) + fabric12004.link(neoforge12004) + neoforge12004.link(forge12001) + forge12001.link(fabric12001) + fabric12001.link(fabric11904) + fabric11904.link(forge11904) + forge11904.link(forge11902) + forge11902.link(fabric11902) } subprojects { diff --git a/settings.gradle.kts b/settings.gradle.kts index 48d44c9..07a7f23 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -32,6 +32,8 @@ listOf( "1.21.1-fabric", "1.21.3-neoforge", "1.21.3-fabric", + "1.21.4-neoforge", + "1.21.4-fabric", ).forEach { version -> include(":$version") project(":$version").apply { diff --git a/version.gradle.kts b/version.gradle.kts index dc56385..d3119e2 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -174,6 +174,7 @@ dependencies { }.let { "forge"("net.minecraftforge:forge:$mcVersionString-$it") } isNeoForge -> when (mcVersion) { + 1_21_04 -> "21.4.1-beta" 1_21_03 -> "21.3.56" 1_21_01 -> "21.1.1" 1_20_06 -> "20.6.115" @@ -189,6 +190,7 @@ dependencies { if (isFabric) { when (mcVersion) { + 1_21_04 -> "12.0.0-beta.1" // TODO: Use actual version 1_21_03 -> "12.0.0-beta.1" 1_21_01 -> "11.0.1" 1_20_06 -> "10.0.0" @@ -211,6 +213,7 @@ dependencies { if (isFabric) { when (mcVersion) { + 1_21_04 -> "0.110.5+1.21.4" 1_21_03 -> "0.106.1+1.21.3" 1_21_01 -> "0.102.0+1.21.1" 1_20_06 -> "0.100.0+1.20.6" @@ -247,6 +250,7 @@ dependencies { compileOnly("de.maxhenkel.voicechat:voicechat-api:2.5.0") when (mcVersion) { + 1_21_04 -> "2.5.26" 1_21_03 -> "2.5.24" 1_21_01 -> "2.5.20" 1_20_06 -> "2.5.20" @@ -330,6 +334,7 @@ tasks.processResources { // TODO: Remove pack.mcmeta in 1.20.4 filesMatching("pack.mcmeta") { expand("pack_format" to when { + mcVersion >= 1_21_04 -> 61 mcVersion >= 1_21_02 -> 42 mcVersion >= 1_21_00 -> 34 mcVersion >= 1_20_05 -> 32 From 531060e1779f5fa234cbc4317c37d5c3e51820d3 Mon Sep 17 00:00:00 2001 From: Josiah Glosson Date: Tue, 3 Dec 2024 15:59:26 -0600 Subject: [PATCH 2/5] Switch to 1.21.4 as core version --- .../gui/screen/OnlineFriendsScreen.java | 10 ++++++---- .../worldhost/gui/widget/UserListWidget.java | 18 +++++++++++++++++- src/main/resources/META-INF/neoforge.mods.toml | 4 ++-- src/main/resources/fabric.mod.json | 4 ++-- versions/mainProject | 2 +- 5 files changed, 28 insertions(+), 10 deletions(-) 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 f1554dc..d3ffc71 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 @@ -297,10 +297,12 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { return (entry != null && entry.keyPressed(keyCode, scanCode, modifiers)) || super.keyPressed(keyCode, scanCode, modifiers); } - @Override - protected int getScrollbarPosition() { - return super.getScrollbarPosition() + 30; - } + //#if MC < 1.21.4 + //$$ @Override + //$$ protected int getScrollbarPosition() { + //$$ return super.getScrollbarPosition() + 30; + //$$ } + //#endif @Override public int getRowWidth() { diff --git a/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java b/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java index 4ef0679..acbc8e2 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java @@ -183,7 +183,11 @@ private void addButtons(int fromI) { } public int getVisibleCount() { - return Math.min(users.size(), getHeight() / 24); + //#if MC >= 1.21.4 + return users.size(); + //#else + //$$ return Math.min(users.size(), getHeight() / 24); + //#endif } @Override @@ -191,6 +195,18 @@ public int getVisibleCount() { return actionButtons; } + //#if MC >= 1.21.4 + @Override + protected int contentHeight() { + return 24 * users.size(); + } + + @Override + protected double scrollRate() { + return 12.0; + } + //#endif + //#if MC < 1.19.4 //$$ private int getX() { //$$ return x; diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index b5c8008..5f16366 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -31,9 +31,9 @@ modId = "minecraft" ##elseif MC == 1.21.1 #?? versionRange = "[1.21.0,1.21.2)" ##elseif MC == 1.21.3 -versionRange = "[1.21.2,1.21.4)" +#?? versionRange = "[1.21.2,1.21.4)" ##else -#?? versionRange = "[$mc_version]" +versionRange = "[$mc_version]" ##endif type = "required" ordering = "NONE" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5166f31..a3ad8ac 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -45,9 +45,9 @@ //#elseif MC == 1.21.1 //?? "minecraft": ">=1.21.0 <1.21.2", //#elseif MC == 1.21.3 - "minecraft": ">=1.21.2 <1.21.4", + //?? "minecraft": ">=1.21.2 <1.21.4", //#else - //?? "minecraft": "$mc_version", + "minecraft": "$mc_version", //#endif "fabric-resource-loader-v0": "*" }, diff --git a/versions/mainProject b/versions/mainProject index 71a33c8..940b501 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.21.3-fabric \ No newline at end of file +1.21.4-fabric \ No newline at end of file From 14ae1f75de34c5039df8872ed0b6d8362f88b416 Mon Sep 17 00:00:00 2001 From: Josiah Glosson Date: Tue, 3 Dec 2024 16:58:15 -0600 Subject: [PATCH 3/5] Make add friends screen scrollable on 1.21.4+ --- .../worldhost/gui/screen/AddFriendScreen.java | 8 +++- .../worldhost/gui/widget/UserListWidget.java | 44 +++++++++++++++---- version.gradle.kts | 2 +- 3 files changed, 43 insertions(+), 11 deletions(-) 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 73dd7a8..b7a5b58 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 @@ -127,11 +127,15 @@ protected void init() { .build() ); - maxFriends = (cancelY - 90) / 24; + //#if MC >= 1.21.4 + maxFriends = 25; + //#else + //$$ maxFriends = (cancelY - 94) / 24; + //#endif userList = addRenderableWidget(new UserListWidget( font, - widgetsX, 90, widgetsWidth, cancelY - 90, + widgetsX, 90, widgetsWidth, cancelY - 94, this::getActions, userList )); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java b/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java index acbc8e2..f55a2fe 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/widget/UserListWidget.java @@ -1,5 +1,6 @@ package io.github.gaming32.worldhost.gui.widget; +import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; import io.github.gaming32.worldhost.WorldHost; import io.github.gaming32.worldhost.gui.screen.WorldHostScreen; @@ -46,7 +47,8 @@ public final class UserListWidget //#endif { private final List users = new ArrayList<>(); - private final List