updated mod metadata and mixins

This commit is contained in:
FlorianMichael 2023-04-03 20:57:11 +02:00
parent 7c80473594
commit 4fcba4bca8
4 changed files with 23 additions and 54 deletions

View File

@ -17,15 +17,21 @@
*/ */
package de.florianmichael.viafabricplus.injection.mixin.base; package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.v1_14_4.LegacyServerAddress;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen; import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings; import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MultiplayerScreen.class) @Mixin(MultiplayerScreen.class)
@ -49,4 +55,17 @@ public class MixinMultiplayerScreen extends Screen {
this.addDrawableChild(builder.size(98, 20).build()); this.addDrawableChild(builder.size(98, 20).build());
} }
@Unique
private ServerInfo viafabricplus_lastConnect;
@Inject(method = "connect(Lnet/minecraft/client/network/ServerInfo;)V", at = @At("HEAD"))
public void track(ServerInfo entry, CallbackInfo ci) {
viafabricplus_lastConnect = entry;
}
@Redirect(method = "connect(Lnet/minecraft/client/network/ServerInfo;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerAddress;parse(Ljava/lang/String;)Lnet/minecraft/client/network/ServerAddress;"))
public ServerAddress doOwnParse(String address) {
return LegacyServerAddress.parse(((IServerInfo) viafabricplus_lastConnect).viafabricplus_forcedVersion(), address);
}
} }

View File

@ -1,47 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2023 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 <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
import de.florianmichael.viafabricplus.definition.v1_14_4.LegacyServerAddress;
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MultiplayerScreen.class)
public class MixinMultiplayerScreen {
@Unique
private ServerInfo viafabricplus_lastConnect;
@Inject(method = "connect(Lnet/minecraft/client/network/ServerInfo;)V", at = @At("HEAD"))
public void track(ServerInfo entry, CallbackInfo ci) {
viafabricplus_lastConnect = entry;
}
@Redirect(method = "connect(Lnet/minecraft/client/network/ServerInfo;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerAddress;parse(Ljava/lang/String;)Lnet/minecraft/client/network/ServerAddress;"))
public ServerAddress doOwnParse(String address) {
return LegacyServerAddress.parse(((IServerInfo) viafabricplus_lastConnect).viafabricplus_forcedVersion(), address);
}
}

View File

@ -27,7 +27,7 @@
"accessWidener": "viafabricplus.accesswidener", "accessWidener": "viafabricplus.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.14.11", "fabricloader": ">=0.14.11",
"minecraft": "~1.19.3", "minecraft": "~1.19.4",
"java": ">=17" "java": ">=17"
}, },
"breaks": { "breaks": {

View File

@ -107,7 +107,6 @@
"fixes.minecraft.screen.MixinGameModeSelectionScreen", "fixes.minecraft.screen.MixinGameModeSelectionScreen",
"fixes.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection", "fixes.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection",
"fixes.minecraft.screen.MixinJigsawBlockScreen", "fixes.minecraft.screen.MixinJigsawBlockScreen",
"fixes.minecraft.screen.MixinMultiplayerScreen",
"fixes.minecraft.screen.MixinStructureBlockScreen_1", "fixes.minecraft.screen.MixinStructureBlockScreen_1",
"fixes.minecraft.screen.merchant.MixinMerchantScreen", "fixes.minecraft.screen.merchant.MixinMerchantScreen",
"fixes.minecraft.screen.merchant.MixinMerchantScreenHandler", "fixes.minecraft.screen.merchant.MixinMerchantScreenHandler",
@ -150,12 +149,10 @@
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread", "fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
"jsonwebtoken.MixinClasses", "jsonwebtoken.MixinClasses",
"jsonwebtoken.MixinDefaultCompressionCodecResolver", "jsonwebtoken.MixinDefaultCompressionCodecResolver",
"jsonwebtoken.MixinDefaultJwtParserBuilder" "jsonwebtoken.MixinDefaultJwtParserBuilder",
"fixes.vialegacy.MixinViaLegacyConfig"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1
}, }
"mixins": [
"fixes.vialegacy.MixinViaLegacyConfig"
]
} }