diff --git a/.idea/copyright/GPL_3_0.xml b/.idea/copyright/GPL_3_0.xml new file mode 100644 index 0000000..e392efa --- /dev/null +++ b/.idea/copyright/GPL_3_0.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..508fdf4 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/de/florianmichael/viaforge/common/ViaForgeCommon.java b/src/main/java/de/florianmichael/viaforge/common/ViaForgeCommon.java index 4739071..40380e7 100644 --- a/src/main/java/de/florianmichael/viaforge/common/ViaForgeCommon.java +++ b/src/main/java/de/florianmichael/viaforge/common/ViaForgeCommon.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common; import com.viaversion.viaversion.api.connection.UserConnection; @@ -41,8 +42,9 @@ * It is used to inject the ViaVersion pipeline into the netty pipeline. It also manages the target version. */ public class ViaForgeCommon { - public final static AttributeKey LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user"); - public final static AttributeKey VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup"); + + public static final AttributeKey LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user"); + public static final AttributeKey VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup"); private static ViaForgeCommon manager; @@ -144,4 +146,5 @@ public ViaForgeConfig getConfig() { public static ViaForgeCommon getManager() { return manager; } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/gui/ExtendedServerData.java b/src/main/java/de/florianmichael/viaforge/common/gui/ExtendedServerData.java index 8b35805..601d9f2 100644 --- a/src/main/java/de/florianmichael/viaforge/common/gui/ExtendedServerData.java +++ b/src/main/java/de/florianmichael/viaforge/common/gui/ExtendedServerData.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.gui; import net.raphimc.vialoader.util.VersionEnum; @@ -24,7 +25,8 @@ */ public interface ExtendedServerData { - VersionEnum viaforge_getVersion(); + VersionEnum viaForge$getVersion(); + + void viaForge$setVersion(final VersionEnum version); - void viaforge_setVersion(final VersionEnum version); } diff --git a/src/main/java/de/florianmichael/viaforge/common/platform/VFPlatform.java b/src/main/java/de/florianmichael/viaforge/common/platform/VFPlatform.java index 33a54b3..4ad73df 100644 --- a/src/main/java/de/florianmichael/viaforge/common/platform/VFPlatform.java +++ b/src/main/java/de/florianmichael/viaforge/common/platform/VFPlatform.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.platform; import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.providers.GameProfileFetcher; @@ -54,4 +55,5 @@ public interface VFPlatform { * @return the game profile fetcher of the platform for ViaLegacy */ GameProfileFetcher getGameProfileFetcher(); + } diff --git a/src/main/java/de/florianmichael/viaforge/common/platform/ViaForgeConfig.java b/src/main/java/de/florianmichael/viaforge/common/platform/ViaForgeConfig.java index 18dae76..ab1230c 100644 --- a/src/main/java/de/florianmichael/viaforge/common/platform/ViaForgeConfig.java +++ b/src/main/java/de/florianmichael/viaforge/common/platform/ViaForgeConfig.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.common.platform; import com.viaversion.viaversion.util.Config; @@ -10,18 +28,19 @@ import java.util.Map; public class ViaForgeConfig extends Config { - public final static String CLIENT_SIDE_VERSION = "client-side-version"; - public final static String VERIFY_SESSION_IN_OLD_VERSIONS = "verify-session-in-old-versions"; - public final static String ALLOW_BETACRAFT_AUTHENTICATION = "allow-betacraft-authentication"; - public final static String SHOW_PROTOCOL_VERSION_IN_F3 = "show-protocol-version-in-f3"; + + public static final String CLIENT_SIDE_VERSION = "client-side-version"; + public static final String VERIFY_SESSION_IN_OLD_VERSIONS = "verify-session-in-old-versions"; + public static final String ALLOW_BETACRAFT_AUTHENTICATION = "allow-betacraft-authentication"; + public static final String SHOW_PROTOCOL_VERSION_IN_F3 = "show-protocol-version-in-f3"; - public final static String SHOW_MAIN_MENU_BUTTON = "show-main-menu-button"; - public final static String SHOW_MULTIPLAYER_BUTTON = "show-multiplayer-button"; - public final static String SHOW_DIRECT_CONNECT_BUTTON = "show-direct-connect-button"; - public final static String SHOW_ADD_SERVER_BUTTON = "show-add-server-button"; + public static final String SHOW_MAIN_MENU_BUTTON = "show-main-menu-button"; + public static final String SHOW_MULTIPLAYER_BUTTON = "show-multiplayer-button"; + public static final String SHOW_DIRECT_CONNECT_BUTTON = "show-direct-connect-button"; + public static final String SHOW_ADD_SERVER_BUTTON = "show-add-server-button"; - public final static String VIA_FORGE_BUTTON_POSITION = "via-forge-button-position"; - public final static String ADD_SERVER_SCREEN_BUTTON_POSITION = "add-server-screen-button-position"; + public static final String VIA_FORGE_BUTTON_POSITION = "via-forge-button-position"; + public static final String ADD_SERVER_SCREEN_BUTTON_POSITION = "add-server-screen-button-position"; /** * @param configFile The location of where the config is loaded/saved. @@ -117,6 +136,8 @@ public Pair getPosition(int width, int height) { public interface PositionInvoker { Pair invoke(int width, int height); + } } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLInjector.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLInjector.java index fbb2ec4..f7e445e 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLInjector.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLInjector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.protocolhack; import net.raphimc.vialoader.impl.viaversion.VLInjector; @@ -31,4 +32,5 @@ public String getDecoderName() { public String getEncoderName() { return VLLegacyPipeline.VIA_ENCODER_NAME; } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLLoader.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLLoader.java index ff75d21..a39563a 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLLoader.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/ViaForgeVLLoader.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.protocolhack; import com.viaversion.viaversion.api.Via; @@ -44,10 +45,11 @@ public void load() { final ViaProviders providers = Via.getManager().getProviders(); providers.use(VersionProvider.class, new ViaForgeVersionProvider()); - providers.use(MovementTransmitterProvider.class, new DummyMovementTransmitter()); + providers.use(MovementTransmitterProvider.class, new ViaForgeMovementTransmitterProvider()); providers.use(OldAuthProvider.class, new ViaForgeOldAuthProvider()); providers.use(GameProfileFetcher.class, platform.getGameProfileFetcher()); providers.use(EncryptionProvider.class, new ViaForgeEncryptionProvider()); providers.use(ClassicMPPassProvider.class, new ViaForgeClassicMPPassProvider()); } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/VFNetworkManager.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/VFNetworkManager.java index 29f5686..9b48851 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/VFNetworkManager.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/VFNetworkManager.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.common.protocolhack.netty; import net.raphimc.vialoader.util.VersionEnum; @@ -8,17 +26,18 @@ public interface VFNetworkManager { * API method to setup the decryption side of the pipeline. * This method is called by the {@link de.florianmichael.viaforge.common.protocolhack.provider.ViaForgeEncryptionProvider} class. */ - void viaforge_setupPreNettyDecryption(); + void viaForge$setupPreNettyDecryption(); /** * @return the target version of the connection */ - VersionEnum viaforge_getTrackedVersion(); + VersionEnum viaForge$getTrackedVersion(); /** * Sets the target version of the connection. * * @param version the target version */ - void viaforge_setTrackedVersion(final VersionEnum version); + void viaForge$setTrackedVersion(final VersionEnum version); + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/ViaForgeVLLegacyPipeline.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/ViaForgeVLLegacyPipeline.java index ea0427f..144038e 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/ViaForgeVLLegacyPipeline.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/netty/ViaForgeVLLegacyPipeline.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.protocolhack.netty; import com.viaversion.viaversion.api.connection.UserConnection; @@ -56,4 +57,5 @@ protected String lengthSplitterName() { protected String lengthPrependerName() { return "prepender"; } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/DummyMovementTransmitter.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/DummyMovementTransmitter.java deleted file mode 100644 index e4e046e..0000000 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/DummyMovementTransmitter.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.florianmichael.viaforge.common.protocolhack.provider; - -import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider; - -public class DummyMovementTransmitter extends MovementTransmitterProvider { - - @Override - public void sendPlayer(UserConnection userConnection) { - // We are on the client side, so we can handle the idle packet properly - } -} diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeClassicMPPassProvider.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeClassicMPPassProvider.java index 4eac934..b79534e 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeClassicMPPassProvider.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeClassicMPPassProvider.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.common.protocolhack.provider; import com.viaversion.viaversion.api.Via; @@ -66,4 +84,5 @@ private static String sha1(final byte[] input) { return null; } } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeEncryptionProvider.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeEncryptionProvider.java index 1df437c..9e00336 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeEncryptionProvider.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeEncryptionProvider.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.common.protocolhack.provider; import com.viaversion.viaversion.api.connection.UserConnection; @@ -8,6 +26,7 @@ public class ViaForgeEncryptionProvider extends EncryptionProvider { @Override public void enableDecryption(UserConnection user) { - user.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).getAndRemove().viaforge_setupPreNettyDecryption(); + user.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).getAndRemove().viaForge$setupPreNettyDecryption(); } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeMovementTransmitterProvider.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeMovementTransmitterProvider.java new file mode 100644 index 0000000..f5cab39 --- /dev/null +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeMovementTransmitterProvider.java @@ -0,0 +1,31 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + +package de.florianmichael.viaforge.common.protocolhack.provider; + +import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider; + +public class ViaForgeMovementTransmitterProvider extends MovementTransmitterProvider { + + @Override + public void sendPlayer(UserConnection userConnection) { + // We are on the client side, so we can handle the idle packet properly + } + +} diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeOldAuthProvider.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeOldAuthProvider.java index a075758..0814146 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeOldAuthProvider.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeOldAuthProvider.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.common.protocolhack.provider; import com.viaversion.viaversion.api.connection.UserConnection; @@ -12,7 +30,7 @@ public void sendAuthRequest(UserConnection user, String serverId) throws Throwab if (!common.getConfig().isVerifySessionInOldVersions()) { return; } - common.getPlatform().joinServer(serverId); } + } diff --git a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeVersionProvider.java b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeVersionProvider.java index e1603f0..8cd88d3 100644 --- a/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeVersionProvider.java +++ b/src/main/java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeVersionProvider.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.common.protocolhack.provider; import com.viaversion.viaversion.api.connection.UserConnection; @@ -32,9 +33,9 @@ public int getClosestServerProtocol(UserConnection connection) throws Exception } catch (Exception e) { e.printStackTrace(); } - return connection.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).get().viaforge_getTrackedVersion().getVersion(); + return connection.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).get().viaForge$getTrackedVersion().getVersion(); } - return super.getClosestServerProtocol(connection); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/ViaForge112.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/ViaForge112.java index c4390b6..2d61d74 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/ViaForge112.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/ViaForge112.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -30,7 +31,8 @@ @Mod(modid = "viaforge") public class ViaForge112 implements VFPlatform { - public final static ViaForge112 PLATFORM = new ViaForge112(); + + public static final ViaForge112 PLATFORM = new ViaForge112(); @Override public int getGameVersion() { @@ -58,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index a05e34f..1db1064 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.realmsclient.gui.ChatFormatting; @@ -170,4 +171,5 @@ public interface FinishedCallback { void finished(final VersionEnum version, final GuiScreen parent); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java index c362ed0..52d4426 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; @@ -55,4 +56,5 @@ public void injectData(Map data) { public String getAccessTransformerClass() { return null; } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiConnecting_1.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiConnecting_1.java index bac0150..ee80722 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiConnecting_1.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiConnecting_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getMinecraft().getCurrentServerData() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getMinecraft().getCurrentServerData()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getMinecraft().getCurrentServerData()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { return NetworkManager.createNetworkManagerAndConnect(address, i, b); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java index 1c8bdb5..7d721bc 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java @@ -15,6 +15,7 @@ * 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; import com.viaversion.viaversion.util.Pair; @@ -51,4 +52,5 @@ public void handleViaForgeButtonClicking(GuiButton p_actionPerformed_1_, Callbac } } } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMultiplayer.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMultiplayer.java index c2d57d6..a29541e 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMultiplayer.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMultiplayer.java @@ -15,6 +15,7 @@ * 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; import com.viaversion.viaversion.util.Pair; @@ -50,4 +51,5 @@ public void handleViaForgeButtonClicking(GuiButton p_actionPerformed_1_, Callbac } } } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java index da7ad59..d7613b8 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenAddServer.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenAddServer.java index 940e296..fb65d1e 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenAddServer.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenAddServer.java @@ -15,6 +15,7 @@ * 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; import com.viaversion.viaversion.util.Pair; @@ -46,7 +47,7 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); buttonList.add(new GuiButton(1_000_000_000, pos.key(), pos.value(), 100, 20, target != null ? target.getName() : "Set Version")); } } @@ -57,10 +58,11 @@ public void actionPerformed(GuiButton button, CallbackInfo ci) { if (button.id == 1_000_000_000) { mc.displayGuiScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); mc.displayGuiScreen(parent); })); } } } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenServerList.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenServerList.java index c4d1546..8d51b00 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenServerList.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiScreenServerList.java @@ -15,6 +15,7 @@ * 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; import com.viaversion.viaversion.util.Pair; @@ -50,4 +51,5 @@ public void handleViaForgeButtonClicking(GuiButton p_actionPerformed_1_, Callbac } } } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerLoginClient.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerLoginClient.java index 19610fc..36d5456 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerLoginClient.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerLoginClient.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager.java index 1dc306f..f79ca8c 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager.java @@ -15,6 +15,7 @@ * 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; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -47,10 +48,10 @@ public class MixinNetworkManager implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "createNetworkManagerAndConnect", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetAddress address, int serverPort, boolean useNativeTransport, CallbackInfoReturnable cir, NetworkManager networkmanager, Class oclass, LazyLoadBase lazyloadbase) { @@ -58,7 +59,7 @@ private static void trackSelfTarget(InetAddress address, int serverPort, boolean // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) networkmanager).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) networkmanager).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "enableEncryption", at = @At("HEAD"), cancellable = true) @@ -70,7 +71,7 @@ private void storeEncryptionCiphers(SecretKey key, CallbackInfo ci) { // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = CryptManager.createNetCipherInstance(2, key); + this.viaForge$decryptionCipher = CryptManager.createNetCipherInstance(2, key); // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key))); @@ -89,18 +90,19 @@ public void reorderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager_5.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager_5.java index 35182c8..8327420 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager_5.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetworkManager_5.java @@ -15,6 +15,7 @@ * 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; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -37,4 +38,5 @@ public class MixinNetworkManager_5 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerData.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerData.java index 90eceb8..9ebb618 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerData.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "getNBTCompound", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTTagCompound;setString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, NBTTagCompound nbttagcompound) { - if (viaforge_version != null) { - nbttagcompound.setInteger("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + nbttagcompound.setInteger("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "getServerDataFromNBTCompound", at = @At(value = "TAIL")) private static void getVersion(NBTTagCompound nbtCompound, CallbackInfoReturnable cir) { - if (nbtCompound.hasKey("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(nbtCompound.getInteger("viaforge_version"))); + if (nbtCompound.hasKey("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(nbtCompound.getInteger("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerPinger.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerPinger.java index 1aa0c3a..3b1cf45 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerPinger.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinServerPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "ping", at = @At("HEAD")) public void trackServerData(ServerData server, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "ping", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;createNetworkManagerAndConnect(Ljava/net/InetAddress;IZ)Lnet/minecraft/network/NetworkManager;")) @@ -32,8 +50,8 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return NetworkManager.createNetworkManagerAndConnect(address, i, b); } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/MixinEntityPlayerSP.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/MixinEntityPlayerSP.java index 159b4c9..68f9a4c 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/MixinEntityPlayerSP.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/mixin/impl/fixes/MixinEntityPlayerSP.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.impl.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(EntityPlayerSP instance) { } return prevOnGround; } + } diff --git a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc112/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc112/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/ViaForge114.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/ViaForge114.java index 78b7bf1..2edfadf 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/ViaForge114.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/ViaForge114.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -30,7 +31,8 @@ @Mod("viaforge") public class ViaForge114 implements VFPlatform { - public final static ViaForge114 PLATFORM = new ViaForge114(); + + public static final ViaForge114 PLATFORM = new ViaForge114(); @Override public int getGameVersion() { @@ -58,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index 0450d80..1930e5e 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.realmsclient.gui.ChatFormatting; @@ -158,5 +159,7 @@ public void render(int p_230432_2_, int y, int p_230432_4_, int p_230432_5_, int public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java index 3d934d6..9d3077e 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -51,14 +52,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addButton(new Button(pos.key(), pos.value(), 100, 20, target != null ? target.getName() : "Set Version", b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); })); } } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java index 4e762a5..3a76b6d 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java index c0b3129..82f0c93 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java index add58e7..5aa9c58 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java index 5f510aa..f81314d 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -49,4 +50,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java index 71a4e7f..5ca8095 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java index 796e12a..9068539 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -47,10 +48,10 @@ public class MixinNetworkManager implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetAddress address, int serverPort, boolean useNativeTransport, CallbackInfoReturnable cir, NetworkManager networkmanager, Class oclass, LazyLoadBase lazyloadbase) { @@ -58,7 +59,7 @@ private static void trackSelfTarget(InetAddress address, int serverPort, boolean // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) networkmanager).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) networkmanager).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -70,7 +71,7 @@ private void storeEncryptionCiphers(SecretKey key, CallbackInfo ci) { // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = CryptManager.getCipher(2, key); + this.viaForge$decryptionCipher = CryptManager.getCipher(2, key); // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new NettyEncryptingEncoder(CryptManager.getCipher(1, key))); @@ -89,18 +90,19 @@ public void reorderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java index 0bca0b1..512a5e3 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinNetworkManager_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager); } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index e62390e..c06e1c8 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundNBT;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundNBT compoundnbt) { - if (viaforge_version != null) { - compoundnbt.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundnbt.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundNBT compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java index e26166a..be6ad44 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", b -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java index b92df76..6800a02 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;connectToServer(Ljava/net/InetAddress;IZ)Lnet/minecraft/network/NetworkManager;")) @@ -32,8 +50,8 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java index c2f3baf..c6f6b8e 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(ClientPlayerEntity instance) { } return lastOnGround; } + } diff --git a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc114/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc114/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/ViaForge115.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/ViaForge115.java index 535f06d..54fc3a0 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/ViaForge115.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/ViaForge115.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge115 implements VFPlatform { - public final static ViaForge115 PLATFORM = new ViaForge115(); + public static final ViaForge115 PLATFORM = new ViaForge115(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index 0450d80..1930e5e 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.realmsclient.gui.ChatFormatting; @@ -158,5 +159,7 @@ public void render(int p_230432_2_, int y, int p_230432_4_, int p_230432_5_, int public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java index 3d934d6..9d3077e 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -51,14 +52,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addButton(new Button(pos.key(), pos.value(), 100, 20, target != null ? target.getName() : "Set Version", b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); })); } } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java index 4e762a5..3a76b6d 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java index c0b3129..82f0c93 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java index add58e7..5aa9c58 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java index ffa0fd5..c158987 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -49,4 +50,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java index 71a4e7f..5ca8095 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java index d34061f..3da5f27 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -47,10 +48,10 @@ public class MixinNetworkManager implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_, CallbackInfoReturnable cir, NetworkManager networkmanager, Class oclass, LazyValue lazyvalue) { @@ -58,7 +59,7 @@ private static void trackSelfTarget(InetAddress p_181124_0_, int p_181124_1_, bo // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) networkmanager).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) networkmanager).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -70,7 +71,7 @@ private void storeEncryptionCiphers(SecretKey key, CallbackInfo ci) { // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = CryptManager.getCipher(2, key); + this.viaForge$decryptionCipher = CryptManager.getCipher(2, key); // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new NettyEncryptingEncoder(CryptManager.getCipher(1, key))); @@ -89,18 +90,19 @@ public void reorderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java index 0bca0b1..512a5e3 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinNetworkManager_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager); } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index e62390e..c06e1c8 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundNBT;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundNBT compoundnbt) { - if (viaforge_version != null) { - compoundnbt.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundnbt.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundNBT compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java index e26166a..be6ad44 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", b -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java index b92df76..6800a02 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;connectToServer(Ljava/net/InetAddress;IZ)Lnet/minecraft/network/NetworkManager;")) @@ -32,8 +50,8 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java index c2f3baf..c6f6b8e 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(ClientPlayerEntity instance) { } return lastOnGround; } + } diff --git a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc115/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc115/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/ViaForge116.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/ViaForge116.java index 27e5be9..afc7728 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/ViaForge116.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/ViaForge116.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge116 implements VFPlatform { - public final static ViaForge116 PLATFORM = new ViaForge116(); + public static final ViaForge116 PLATFORM = new ViaForge116(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index a65f347..f3d1598 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.blaze3d.matrix.MatrixStack; @@ -159,5 +160,7 @@ public void render(MatrixStack matrices, int p_230432_2_, int y, int p_230432_4_ public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java index cc5e478..7671b15 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinAddServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -52,14 +53,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent(target != null ? target.getName() : "Set Version"), b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); })); } } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java index 4e762a5..3a76b6d 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinClientLoginNetHandler.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java index c0b3129..82f0c93 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectingScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java index add58e7..5aa9c58 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java index 88dcca0..948baf9 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -50,4 +51,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java index 929589f..8cfcb9f 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java index 61a4845..642b6ec 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -47,10 +48,10 @@ public class MixinNetworkManager implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_, CallbackInfoReturnable cir, NetworkManager networkmanager, Class oclass, LazyValue lazyvalue) { @@ -58,7 +59,7 @@ private static void trackSelfTarget(InetAddress p_181124_0_, int p_181124_1_, bo // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) networkmanager).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) networkmanager).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -70,7 +71,7 @@ private void storeEncryptionCiphers(Cipher p_244777_1_, Cipher p_244777_2_, Call // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = p_244777_1_; + this.viaForge$decryptionCipher = p_244777_1_; // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new NettyEncryptingEncoder(p_244777_2_)); @@ -89,18 +90,19 @@ public void reorderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new NettyEncryptingDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java index 0bca0b1..512a5e3 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinNetworkManager_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinNetworkManager_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager); } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index e62390e..c06e1c8 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundNBT;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundNBT compoundnbt) { - if (viaforge_version != null) { - compoundnbt.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundnbt.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundNBT compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java index 7ace99a..bce4375 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java index b8bdbe0..b954e6b 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/MixinServerPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, Runnable p_147224_2_, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;connectToServer(Ljava/net/InetAddress;IZ)Lnet/minecraft/network/NetworkManager;")) @@ -32,8 +50,8 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public NetworkManager trackVersion(InetAddress address, int i, boolean b) { ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return NetworkManager.connectToServer(address, i, b); } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java index c2f3baf..c6f6b8e 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinClientPlayerEntity.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(ClientPlayerEntity instance) { } return lastOnGround; } + } diff --git a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc116/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc116/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/ViaForge117.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/ViaForge117.java index 7ab37d0..ce0885f 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/ViaForge117.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/ViaForge117.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge117 implements VFPlatform { - public final static ViaForge117 PLATFORM = new ViaForge117(); + public static final ViaForge117 PLATFORM = new ViaForge117(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index f090eb2..057acc5 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.blaze3d.vertex.PoseStack; @@ -164,5 +165,7 @@ public void render(PoseStack matrices, int p_93524_, int y, int p_93526_, int p_ public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java index 741a694..79a69cc 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java index b2e5703..7d91ae5 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java index 5f1483e..d0d19b6 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -44,10 +45,10 @@ public class MixinConnection implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_178302_, CallbackInfoReturnable cir, final Connection connection) { @@ -55,7 +56,7 @@ private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_17830 // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) connection).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) connection).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -67,7 +68,7 @@ private void storeEncryptionCiphers(Cipher p_244777_1_, Cipher p_244777_2_, Call // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = p_244777_1_; + this.viaForge$decryptionCipher = p_244777_1_; // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new CipherEncoder(p_244777_2_)); @@ -86,18 +87,19 @@ public void reorderPipeline(int p_129485_, boolean p_182682_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java index 5bef153..ae856a5 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinConnection_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection); } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java index ef1533c..0c0d181 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java index 07d4d0a..448c388 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java index 2164cc7..4822347 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -54,14 +55,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent(target != null ? target.getName() : "Set Version"), b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); })); } } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java index 17ad42a..d7210d5 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index 6061579..c03de91 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundTag compoundtag) { - if (viaforge_version != null) { - compoundtag.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundtag.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundTag compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java index ab43c3f..8af4a32 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerStatusPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, Runnable p_147224_2_, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;connectToServer(Ljava/net/InetSocketAddress;Z)Lnet/minecraft/network/Connection;")) @@ -32,8 +50,8 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java index bb4d0d9..f5409a9 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -50,4 +51,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java index 24f5235..0953765 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(LocalPlayer instance) { } return lastOnGround; } + } \ No newline at end of file diff --git a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc117/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc117/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/ViaForge118.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/ViaForge118.java index 3330024..eda9625 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/ViaForge118.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/ViaForge118.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge118 implements VFPlatform { - public final static ViaForge118 PLATFORM = new ViaForge118(); + public static final ViaForge118 PLATFORM = new ViaForge118(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index 65ae16a..095a2dc 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.blaze3d.vertex.PoseStack; @@ -164,5 +165,7 @@ public void render(PoseStack matrices, int p_93524_, int y, int p_93526_, int p_ public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java index 741a694..79a69cc 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java index b2e5703..7d91ae5 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java index 5f1483e..d0d19b6 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -44,10 +45,10 @@ public class MixinConnection implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_178302_, CallbackInfoReturnable cir, final Connection connection) { @@ -55,7 +56,7 @@ private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_17830 // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) connection).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) connection).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -67,7 +68,7 @@ private void storeEncryptionCiphers(Cipher p_244777_1_, Cipher p_244777_2_, Call // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = p_244777_1_; + this.viaForge$decryptionCipher = p_244777_1_; // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new CipherEncoder(p_244777_2_)); @@ -86,18 +87,19 @@ public void reorderPipeline(int p_129485_, boolean p_182682_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java index 5bef153..ae856a5 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinConnection_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection); } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java index ef1533c..0c0d181 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java index 07d4d0a..448c388 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java index 2164cc7..4822347 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -54,14 +55,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent(target != null ? target.getName() : "Set Version"), b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); })); } } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java index 17ad42a..d7210d5 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -47,4 +48,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index 6061579..c03de91 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundTag compoundtag) { - if (viaforge_version != null) { - compoundtag.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundtag.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundTag compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java index ab43c3f..8af4a32 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerStatusPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, Runnable p_147224_2_, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;connectToServer(Ljava/net/InetSocketAddress;Z)Lnet/minecraft/network/Connection;")) @@ -32,8 +50,8 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java index a85f1ef..0cd4779 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -50,4 +51,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft))); } } + } diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java index 24f5235..0953765 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(LocalPlayer instance) { } return lastOnGround; } + } \ No newline at end of file diff --git a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc118/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc118/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/ViaForge119.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/ViaForge119.java index 5fe176e..d7e85f5 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/ViaForge119.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/ViaForge119.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge119 implements VFPlatform { - public final static ViaForge119 PLATFORM = new ViaForge119(); + public static final ViaForge119 PLATFORM = new ViaForge119(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index ac4f268..f19380d 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.blaze3d.vertex.PoseStack; @@ -163,5 +164,7 @@ public void render(PoseStack matrices, int p_93524_, int y, int p_93526_, int p_ public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java index 741a694..79a69cc 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, GameProfil } instance.joinServer(profile, authenticationToken, serverId); } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java index b2e5703..7d91ae5 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnectScreen_1.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,7 +38,7 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -32,4 +50,5 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java index 5f1483e..d0d19b6 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -44,10 +45,10 @@ public class MixinConnection implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_178302_, CallbackInfoReturnable cir, final Connection connection) { @@ -55,7 +56,7 @@ private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_17830 // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) connection).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) connection).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "setEncryptionKey", at = @At("HEAD"), cancellable = true) @@ -67,7 +68,7 @@ private void storeEncryptionCiphers(Cipher p_244777_1_, Cipher p_244777_2_, Call // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = p_244777_1_; + this.viaForge$decryptionCipher = p_244777_1_; // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new CipherEncoder(p_244777_2_)); @@ -86,18 +87,19 @@ public void reorderPipeline(int p_129485_, boolean p_182682_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java index 5bef153..ae856a5 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinConnection_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection); } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java index ef1533c..0c0d181 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java index 09053d7..65e6216 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java index 80f1697..511e509 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -53,14 +54,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addRenderableWidget(Button.builder(Component.literal(target != null ? target.getName() : "Set Version"), b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); }).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java index eba26e1..670306b 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index 6061579..c03de91 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundTag compoundtag) { - if (viaforge_version != null) { - compoundtag.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundtag.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundTag compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java index ab43c3f..8af4a32 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -19,11 +37,11 @@ public class MixinServerStatusPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, Runnable p_147224_2_, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;connectToServer(Ljava/net/InetSocketAddress;Z)Lnet/minecraft/network/Connection;")) @@ -32,8 +50,8 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -42,9 +60,10 @@ public Connection trackVersion(InetSocketAddress oclass, boolean lazyloadedvalue ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return Connection.connectToServer(oclass, lazyloadedvalue); } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java index a5516c5..284a0ef 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -49,4 +50,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java index 24f5235..0953765 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(LocalPlayer instance) { } return lastOnGround; } + } \ No newline at end of file diff --git a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 2d06f53..3adcfa4 100644 --- a/viaforge-mc119/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc119/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.Agent; @@ -16,9 +34,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -54,4 +73,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { return gameProfile; } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/ViaForge120.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/ViaForge120.java index d61402e..ee723ce 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/ViaForge120.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/ViaForge120.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge; import de.florianmichael.viaforge.common.platform.VFPlatform; @@ -31,7 +32,7 @@ @Mod("viaforge") public class ViaForge120 implements VFPlatform { - public final static ViaForge120 PLATFORM = new ViaForge120(); + public static final ViaForge120 PLATFORM = new ViaForge120(); @Override public int getGameVersion() { @@ -59,4 +60,5 @@ public void joinServer(String serverId) throws Throwable { public GameProfileFetcher getGameProfileFetcher() { return new ViaForgeGameProfileFetcher(); } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java index 6ef71a3..71cad43 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/gui/GuiProtocolSelector.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.gui; import com.mojang.blaze3d.vertex.PoseStack; @@ -162,5 +163,7 @@ public void render(GuiGraphics graphics, int p_93524_, int y, int p_93526_, int public interface FinishedCallback { void finished(final VersionEnum version, final Screen parent); + } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java index 4cc0116..4934a71 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinClientHandshakePacketListenerImpl.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import com.mojang.authlib.exceptions.AuthenticationException; @@ -35,4 +53,5 @@ public void onlyJoinServerIfPremium(MinecraftSessionService instance, UUID uuid, } instance.joinServer(uuid, authenticationToken, serverId); } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java index 3d5b610..b4b67c2 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -49,10 +50,10 @@ public class MixinConnection implements VFNetworkManager { @Shadow private Channel channel; @Unique - private Cipher viaforge_decryptionCipher; + private Cipher viaForge$decryptionCipher; @Unique - private VersionEnum viaforge_targetVersion; + private VersionEnum viaForge$targetVersion; @Inject(method = "connectToServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/Connection;)Lio/netty/channel/ChannelFuture;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_178302_, SampleLogger p_300093_, CallbackInfoReturnable cir, Connection connection) { @@ -60,13 +61,13 @@ private static void trackSelfTarget(InetSocketAddress p_178301_, boolean p_17830 // This works for joining perfect since we can simply restore the version when the server doesn't have a specific one set, // but for the server pinger we need to store the target version and force the pinging to use the target version. // Due to the fact that the server pinger is being called multiple times. - ((VFNetworkManager) connection).viaforge_setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); + ((VFNetworkManager) connection).viaForge$setTrackedVersion(ViaForgeCommon.getManager().getTargetVersion()); } @Inject(method = "initiateServerboundConnection", at = @At("HEAD")) public void test(String p_300730_, int p_300598_, PacketListener p_298739_, ClientIntent p_297789_, CallbackInfo ci) { if (Minecraft.getInstance().getCurrentServer() instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaforge_getVersion(); + final VersionEnum version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -86,7 +87,7 @@ private void storeEncryptionCiphers(Cipher p_244777_1_, Cipher p_244777_2_, Call // Minecraft 1.6.4 supports tile encryption which means the server can only disable one side of the encryption // So we only enable the encryption side and later enable the decryption side if the 1.7 -> 1.6 protocol // tells us to do, therefore we need to store the cipher instance. - this.viaforge_decryptionCipher = p_244777_1_; + this.viaForge$decryptionCipher = p_244777_1_; // Enabling the encryption side this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new CipherEncoder(p_244777_2_)); @@ -105,18 +106,19 @@ public void reorderPipeline(int p_129485_, boolean p_182682_, CallbackInfo ci) { } @Override - public void viaforge_setupPreNettyDecryption() { + public void viaForge$setupPreNettyDecryption() { // Enabling the decryption side for 1.6.4 if the 1.7 -> 1.6 protocol tells us to do - this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaforge_decryptionCipher)); + this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "decrypt", new CipherDecoder(this.viaForge$decryptionCipher)); } @Override - public VersionEnum viaforge_getTrackedVersion() { - return viaforge_targetVersion; + public VersionEnum viaForge$getTrackedVersion() { + return viaForge$targetVersion; } @Override - public void viaforge_setTrackedVersion(VersionEnum version) { - viaforge_targetVersion = version; + public void viaForge$setTrackedVersion(VersionEnum version) { + viaForge$targetVersion = version; } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java index 5bef153..ae856a5 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinConnection_1.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -39,4 +40,5 @@ public class MixinConnection_1 { private void onInitChannel(Channel channel, CallbackInfo ci) { ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection); } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java index ef1533c..0c0d181 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -32,4 +50,5 @@ public void addViaForgeVersion(CallbackInfoReturnable> cir) { cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")"); } } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java index 09053d7..65e6216 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java index 80f1697..511e509 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinEditServerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -53,14 +54,15 @@ public void initGui(CallbackInfo ci) { if (config.isShowAddServerButton()) { final Pair pos = config.getAddServerScreenButtonPosition().getPosition(this.width, this.height); - final VersionEnum target = ((ExtendedServerData) serverData).viaforge_getVersion(); + final VersionEnum target = ((ExtendedServerData) serverData).viaForge$getVersion(); addRenderableWidget(Button.builder(Component.literal(target != null ? target.getName() : "Set Version"), b -> { minecraft.setScreen(new GuiProtocolSelector(this, true, (version, parent) -> { // Set version and go back to the parent screen. - ((ExtendedServerData) serverData).viaforge_setVersion(version); + ((ExtendedServerData) serverData).viaForge$setVersion(version); minecraft.setScreen(parent); })); }).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java index eba26e1..670306b 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -46,4 +47,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java index 6061579..c03de91 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerData.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.gui.ExtendedServerData; @@ -16,36 +34,37 @@ public class MixinServerData implements ExtendedServerData { @Unique - private VersionEnum viaforge_version; + private VersionEnum viaForge$version; @Inject(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void saveVersion(CallbackInfoReturnable cir, CompoundTag compoundtag) { - if (viaforge_version != null) { - compoundtag.putInt("viaforge_version", viaforge_version.getVersion()); + if (viaForge$version != null) { + compoundtag.putInt("viaForge$version", viaForge$version.getVersion()); } } @Inject(method = "read", at = @At(value = "TAIL")) private static void getVersion(CompoundTag compoundnbt, CallbackInfoReturnable cir) { - if (compoundnbt.contains("viaforge_version")) { - ((ExtendedServerData) cir.getReturnValue()).viaforge_setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaforge_version"))); + if (compoundnbt.contains("viaForge$version")) { + ((ExtendedServerData) cir.getReturnValue()).viaForge$setVersion(VersionEnum.fromProtocolId(compoundnbt.getInt("viaForge$version"))); } } @Inject(method = "copyFrom", at = @At("HEAD")) public void track(ServerData serverDataIn, CallbackInfo ci) { if (serverDataIn instanceof ExtendedServerData) { - viaforge_version = ((ExtendedServerData) serverDataIn).viaforge_getVersion(); + viaForge$version = ((ExtendedServerData) serverDataIn).viaForge$getVersion(); } } @Override - public VersionEnum viaforge_getVersion() { - return viaforge_version; + public VersionEnum viaForge$getVersion() { + return viaForge$version; } @Override - public void viaforge_setVersion(VersionEnum version) { - viaforge_version = version; + public void viaForge$setVersion(VersionEnum version) { + viaForge$version = version; } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java index 11d2d64..bbff016 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinServerStatusPinger.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin; import de.florianmichael.viaforge.common.ViaForgeCommon; @@ -20,11 +38,11 @@ public class MixinServerStatusPinger { @Unique - private ServerData viaforge_serverData; + private ServerData viaForge$serverData; @Inject(method = "pingServer", at = @At("HEAD")) public void trackServerData(ServerData server, Runnable p_147224_2_, CallbackInfo ci) { - viaforge_serverData = server; + viaForge$serverData = server; } @Redirect(method = "pingServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;connectToServer(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/SampleLogger;)Lnet/minecraft/network/Connection;")) @@ -33,8 +51,8 @@ public Connection trackVersion(InetSocketAddress address, boolean b, SampleLogge // use it to determine the protocol version to use. // We hope that the current server data is not null - if (viaforge_serverData instanceof ExtendedServerData) { - final VersionEnum version = ((ExtendedServerData) viaforge_serverData).viaforge_getVersion(); + if (viaForge$serverData instanceof ExtendedServerData) { + final VersionEnum version = ((ExtendedServerData) viaForge$serverData).viaForge$getVersion(); if (version != null) { ViaForgeCommon.getManager().setTargetVersionSilent(version); } else { @@ -43,9 +61,10 @@ public Connection trackVersion(InetSocketAddress address, boolean b, SampleLogge ViaForgeCommon.getManager().restoreVersion(); } - viaforge_serverData = null; + viaForge$serverData = null; } return Connection.connectToServer(address, b, sampleLogger); } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java index 740dbdc..4e05a51 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package de.florianmichael.viaforge.mixin; import com.viaversion.viaversion.util.Pair; @@ -49,4 +50,5 @@ public void hookViaForgeButton(CallbackInfo ci) { addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build()); } } + } diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java index bea874d..cbd402b 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/mixin/fixes/MixinLocalPlayer.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.mixin.fixes; import com.mojang.authlib.GameProfile; @@ -34,4 +52,5 @@ public boolean emulateIdlePacket(LocalPlayer instance) { } return lastOnGround; } + } \ No newline at end of file diff --git a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java index 977a0b4..eb538f7 100644 --- a/viaforge-mc120/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java +++ b/viaforge-mc120/src/main/java/de/florianmichael/viaforge/provider/ViaForgeGameProfileFetcher.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge + * 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 . + */ + package de.florianmichael.viaforge.provider; import com.mojang.authlib.GameProfileRepository; @@ -15,9 +33,10 @@ import java.util.concurrent.CompletableFuture; public class ViaForgeGameProfileFetcher extends GameProfileFetcher { - public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY); - public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); - public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); + + public static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY); + public static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService(); + public static final GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository(); @Override public UUID loadMojangUUID(String playerName) throws Exception { @@ -53,4 +72,5 @@ public GameProfile loadGameProfile(UUID uuid) throws Exception { } return gameProfile; } + }