From c93999b9ba0b5f6784cf6d604efb083ef47ee9cc Mon Sep 17 00:00:00 2001 From: Howard ZHY <96782166+HowardZHY@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:29:03 +0800 Subject: [PATCH] Update Via* libraries and fixup build files (#93) * Some small improvements * Update Via*, Fix things Fix incompatibility with Patcher Fix jar manifest attribute caused not detected in mod list * Update build.gradle * Update src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java Co-authored-by: EnZaXD * Update src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java * Update src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java * Update src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java * Update src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java --------- Co-authored-by: EnZaXD --- build.gradle | 5 ++- gradle.properties | 8 ++-- .../patcher/MixinProtocolVersionDetector.java | 41 +++++++++++++++++++ src/main/resources/mixins.viaforge-mc189.json | 5 ++- 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java diff --git a/build.gradle b/build.gradle index 3c4753a..db95639 100644 --- a/build.gradle +++ b/build.gradle @@ -96,9 +96,10 @@ mixin { jar { manifest.attributes( "MixinConfigs": "mixins.${maven_name}.json", - "tweakClass": "org.spongepowered.asm.launch.MixinTweaker", + "TweakClass": "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder": 0, - "FMLCorePluginContainsFMLMod": "de.florianmichael.viaforge.mixin.MixinLoader" + "FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", + "FMLCorePluginContainsFMLMod": "true" ) enabled = false diff --git a/gradle.properties b/gradle.properties index 3a42f1d..c67826d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,13 +4,13 @@ org.gradle.daemon=false # Project Details maven_name=viaforge-mc189 -maven_version=3.6.2-SNAPSHOT +maven_version=3.6.2 maven_group=de.florianmichael # ViaVersion -viaversion_version=4.10.1 -viabackwards_version=4.10.1 -viarewind_version=3.1.1 +viaversion_version=4.10.3-SNAPSHOT +viabackwards_version=4.10.3-SNAPSHOT +viarewind_version=3.1.2 vialegacy_version=2.2.23-SNAPSHOT viaaprilfools_version=2.0.13-SNAPSHOT vialoader_version=2.2.14-SNAPSHOT diff --git a/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java b/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java new file mode 100644 index 0000000..e185edc --- /dev/null +++ b/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/patcher/MixinProtocolVersionDetector.java @@ -0,0 +1,41 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package de.florianmichael.viaforge.mixin.impl.fixes.patcher; + +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import de.florianmichael.viaforge.common.ViaForgeCommon; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Pseudo +@Mixin(targets = "club.sk1er.patcher.util.status.ProtocolVersionDetector", remap = false) +public abstract class MixinProtocolVersionDetector { + + @SuppressWarnings("rawtypes, unchecked") + @Dynamic + @Inject(method = "isCompatibleWithVersion", at = @At("HEAD"), cancellable = true) + private void viaforge$setCompatible(String ip, int version, CallbackInfoReturnable cir) { + cir.setReturnValue(ViaForgeCommon.getManager().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_11)); + } + +} diff --git a/src/main/resources/mixins.viaforge-mc189.json b/src/main/resources/mixins.viaforge-mc189.json index 94a834b..259d110 100644 --- a/src/main/resources/mixins.viaforge-mc189.json +++ b/src/main/resources/mixins.viaforge-mc189.json @@ -10,13 +10,14 @@ "MixinGuiOverlayDebug", "MixinGuiScreenAddServer", "MixinGuiScreenServerList", + "MixinServerData", + "connect.MixinGuiConnecting_1", "connect.MixinNetHandlerLoginClient", "connect.MixinNetworkManager", "connect.MixinNetworkManager_5", - "MixinServerData", "connect.MixinServerPinger", "fixes.MixinEntityPlayerSP", - "connect.MixinGuiConnecting_1" + "fixes.patcher.MixinProtocolVersionDetector" ], "verbose": true }