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 76162c3..3d343a7 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 @@ -36,9 +36,9 @@ //$$ import com.mojang.blaze3d.vertex.PoseStack; //#endif -//#if MC >= 1.19.4 && FABRIC -import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings; -import io.github.gaming32.worldhost.versions.ButtonBuilder; +//#if MC >= 1.20.4 && FABRIC +import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen; +import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import net.fabricmc.loader.api.FabricLoader; //#if MC >= 1.20.1 import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen; @@ -117,33 +117,24 @@ protected void init() { updateButtonActivationStates(); - //#if MC >= 1.19.4 && FABRIC + //#if MC >= 1.20.4 && FABRIC if (FabricLoader.getInstance().isModLoaded("viafabricplus")) { vfpInit(); } //#endif } - //#if MC >= 1.19.4 && FABRIC - // Based on https://github.com/ViaVersion/ViaFabricPlus/blob/main/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinMultiplayerScreen.java + //#if MC >= 1.20.4 && FABRIC + // Based on https://github.com/ViaVersion/ViaFabricPlus/blob/main/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMultiplayerScreen.java private void vfpInit() { - final ButtonBuilder builder = button( - Components.literal("ViaFabricPlus"), - b -> ProtocolSelectionScreen.INSTANCE.open(this) + Button.Builder builder = Button.builder( + Component.literal("ViaFabricPlus"), + button -> ProtocolSelectionScreen.INSTANCE.open(this) + ).size(98, 20); + builder = GeneralSettings.withOrientation( + builder, GeneralSettings.global().multiplayerScreenButtonOrientation.getIndex(), width, height ); - - //#if MC >= 1.20.1 - switch (GeneralSettings.INSTANCE.multiplayerScreenButtonOrientation.getIndex()) { - //#else - //$$ switch (GeneralSettings.INSTANCE.mainButtonOrientation.getIndex()) { - //#endif - case 0 -> builder.pos(5, 5); - case 1 -> builder.pos(width - 98 - 5, 5); - case 2 -> builder.pos(5, height - 20 - 5); - case 3 -> builder.pos(width - 95 - 5, height - 20 - 5); - } - - addRenderableWidget(builder.width(98).build()); + addRenderableWidget(builder.build()); } //#endif diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d8088c8..b19eff6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -42,8 +42,6 @@ "breaks": { //#if MC == 1.19.4 //?? "modmenu": "<6.2.0" - //#elseif MC == 1.20.1 - //?? "viafabricplus": "<2.8.5" //#endif }, "suggests": { diff --git a/version.gradle.kts b/version.gradle.kts index 9808989..02f17fd 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -267,17 +267,9 @@ dependencies { modCompileOnly("dev.isxander:main-menu-credits:1.1.2") } - if (isFabric) { - when { - mcVersion >= 1_20_02 -> "2.9.0" - mcVersion >= 1_20_01 -> "2.8.7-SNAPSHOT" - mcVersion >= 1_20_00 -> "2.7.6" - mcVersion >= 1_19_04 -> "2.7.5" - else -> null - }?.let { - modCompileOnly("de.florianmichael:viafabricplus:$it") { - isTransitive = false - } + if (isFabric && mcVersion >= 1_20_04) { + modCompileOnly("de.florianmichael:viafabricplus:3.0.2") { + isTransitive = false } }