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/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/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..c573ce6 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; @@ -23,6 +24,8 @@ import java.util.List; import java.util.function.Function; +import static io.github.gaming32.worldhost.gui.screen.WorldHostScreen.*; + //#if MC >= 1.20.0 import net.minecraft.client.gui.GuiGraphics; //#else @@ -46,7 +49,8 @@ public final class UserListWidget //#endif { private final List users = new ArrayList<>(); - private final List