Fix steamwar check
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2022-12-24 10:44:49 +01:00
Ursprung 7895f0f2c9
Commit dd5f16a279
3 geänderte Dateien mit 14 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -17,19 +17,24 @@
package de.zonlykroks.advancedscripts.mixin; package de.zonlykroks.advancedscripts.mixin;
import de.zonlykroks.advancedscripts.AdvancedScripts; import de.zonlykroks.advancedscripts.AdvancedScripts;
import net.minecraft.client.network.ClientLoginNetworkHandler; import net.minecraft.client.MinecraftClient;
import net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket; import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
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.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientLoginNetworkHandler.class) @Mixin(ConnectScreen.class)
public class ClientLoginNetworkHandlerMixin { public class ConnectScreenMixin {
@Inject(method = "onSuccess", at = @At("TAIL")) @Inject(method = "connect(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;)V", at = @At("TAIL"))
public void isOnSteamwar(LoginSuccessS2CPacket packet, CallbackInfo ci) { private static void isOnSteamwar(Screen screen, MinecraftClient client, ServerAddress address, ServerInfo info, CallbackInfo ci) {
String adress = ((ClientLoginNetworkHandler) (Object)this).serverInfo.address; String adress = address.getAddress();
AdvancedScripts.isOnSteamwar = adress == "steamwar.de" || adress == "78.31.71.136"; AdvancedScripts.isOnSteamwar = adress == "steamwar.de" || adress == "78.31.71.136";
} }

Datei anzeigen

@ -1,4 +1,4 @@
accessWidener v1 named accessWidener v1 named
accessible field net/minecraft/client/network/ClientLoginNetworkHandler serverInfo Lnet/minecraft/client/network/ServerInfo; accessible field net/minecraft/client/network/ClientPlayNetworkHandler serverInfo Lnet/minecraft/client/network/ServerInfo;
accessible field net/minecraft/client/Keyboard client Lnet/minecraft/client/MinecraftClient; accessible field net/minecraft/client/Keyboard client Lnet/minecraft/client/MinecraftClient;

Datei anzeigen

@ -6,7 +6,7 @@
"mixins": [ "mixins": [
], ],
"client": [ "client": [
"ClientLoginNetworkHandlerMixin", "ConnectScreenMixin",
"KeyboardMixin" "KeyboardMixin"
], ],
"injectors": { "injectors": {