mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-23 12:15:25 +01:00
Some final cleanup before 1.20.3
This commit is contained in:
parent
a6c9ed237f
commit
79631f7caf
6
.idea/copyright/GPL_3_0.xml
Normal file
6
.idea/copyright/GPL_3_0.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge Copyright (C) 2021-&#36;today.year FlorianMichael/EnZaXD and contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>." />
|
||||
<option name="myName" value="GPL-3.0" />
|
||||
</copyright>
|
||||
</component>
|
8
.idea/copyright/profiles_settings.xml
Normal file
8
.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="GPL_3_0">
|
||||
<module2copyright>
|
||||
<element module="Project Files" copyright="GPL-3.0" />
|
||||
</module2copyright>
|
||||
<LanguageOptions name="__TEMPLATE__" />
|
||||
</settings>
|
||||
</component>
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
@ -41,8 +42,9 @@ import java.io.File;
|
||||
* 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<UserConnection> LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user");
|
||||
public final static AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup");
|
||||
|
||||
public static final AttributeKey<UserConnection> LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user");
|
||||
public static final AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup");
|
||||
|
||||
private static ViaForgeCommon manager;
|
||||
|
||||
@ -144,4 +146,5 @@ public class ViaForgeCommon {
|
||||
public static ViaForgeCommon getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.gui;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
@ -24,7 +25,8 @@ import net.raphimc.vialoader.util.VersionEnum;
|
||||
*/
|
||||
public interface ExtendedServerData {
|
||||
|
||||
VersionEnum viaforge_getVersion();
|
||||
VersionEnum viaForge$getVersion();
|
||||
|
||||
void viaForge$setVersion(final VersionEnum version);
|
||||
|
||||
void viaforge_setVersion(final VersionEnum version);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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();
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.platform;
|
||||
|
||||
import com.viaversion.viaversion.util.Config;
|
||||
@ -10,18 +28,19 @@ import java.util.List;
|
||||
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 class ViaForgeConfig extends Config {
|
||||
public interface PositionInvoker {
|
||||
|
||||
Pair<Integer, Integer> invoke(int width, int height);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack;
|
||||
|
||||
import net.raphimc.vialoader.impl.viaversion.VLInjector;
|
||||
@ -31,4 +32,5 @@ public class ViaForgeVLInjector extends VLInjector {
|
||||
public String getEncoderName() {
|
||||
return VLLegacyPipeline.VIA_ENCODER_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
@ -44,10 +45,11 @@ public class ViaForgeVLLoader extends VLLoader {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack.netty;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
@ -56,4 +57,5 @@ public class ViaForgeVLLegacyPipeline extends VLLegacyPipeline {
|
||||
protected String lengthPrependerName() {
|
||||
return "prepender";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack.provider;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
@ -66,4 +84,5 @@ public class ViaForgeClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack.provider;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
@ -12,7 +30,7 @@ public class ViaForgeOldAuthProvider extends OldAuthProvider {
|
||||
if (!common.getConfig().isVerifySessionInOldVersions()) {
|
||||
return;
|
||||
}
|
||||
|
||||
common.getPlatform().joinServer(serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.common.protocolhack.provider;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
@ -32,9 +33,9 @@ public class ViaForgeVersionProvider extends BaseVersionProvider {
|
||||
} 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -30,7 +31,8 @@ import java.util.function.Supplier;
|
||||
|
||||
@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 class ViaForge112 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
@ -170,4 +171,5 @@ public class GuiProtocolSelector extends GuiScreen {
|
||||
|
||||
void finished(final VersionEnum version, final GuiScreen parent);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||
@ -55,4 +56,5 @@ public class MixinLoader implements IFMLLoadingPlugin {
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinGuiConnecting_1 {
|
||||
// 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 class MixinGuiConnecting_1 {
|
||||
|
||||
return NetworkManager.createNetworkManagerAndConnect(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -51,4 +52,5 @@ public class MixinGuiMainMenu extends GuiScreen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -50,4 +51,5 @@ public class MixinGuiMultiplayer extends GuiScreen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinGuiOverlayDebug {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -46,7 +47,7 @@ public class MixinGuiScreenAddServer extends GuiScreen {
|
||||
if (config.isShowAddServerButton()) {
|
||||
final Pair<Integer, Integer> 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 class MixinGuiScreenAddServer extends GuiScreen {
|
||||
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);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -50,4 +51,5 @@ public class MixinGuiScreenServerList extends GuiScreen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinNetHandlerLoginClient {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<NetworkManager> cir, NetworkManager networkmanager, Class oclass, LazyLoadBase lazyloadbase) {
|
||||
@ -58,7 +59,7 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 class MixinNetworkManager implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.viaforge.common.gui.ExtendedServerData;
|
||||
@ -16,36 +34,37 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
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<NBTTagCompound> 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<ServerData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -19,11 +37,11 @@ import java.net.InetAddress;
|
||||
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 class MixinServerPinger {
|
||||
// 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 class MixinServerPinger {
|
||||
ViaForgeCommon.getManager().restoreVersion();
|
||||
}
|
||||
|
||||
viaforge_serverData = null;
|
||||
viaForge$serverData = null;
|
||||
}
|
||||
|
||||
return NetworkManager.createNetworkManagerAndConnect(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.impl.fixes;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinEntityPlayerSP extends AbstractClientPlayer {
|
||||
}
|
||||
return prevOnGround;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.provider;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
@ -16,9 +34,10 @@ import java.util.UUID;
|
||||
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 class ViaForgeGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -30,7 +31,8 @@ import java.util.function.Supplier;
|
||||
|
||||
@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 class ViaForge114 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
@ -158,5 +159,7 @@ public class GuiProtocolSelector extends Screen {
|
||||
public interface FinishedCallback {
|
||||
|
||||
void finished(final VersionEnum version, final Screen parent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -51,14 +52,15 @@ public class MixinAddServerScreen extends Screen {
|
||||
if (config.isShowAddServerButton()) {
|
||||
final Pair<Integer, Integer> 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);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientLoginNetHandler {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinConnectingScreen_1 {
|
||||
// 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 class MixinConnectingScreen_1 {
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinDebugOverlayGui {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -49,4 +50,5 @@ public class MixinMainMenuScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -46,4 +47,5 @@ public class MixinMultiplayerScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<NetworkManager> cir, NetworkManager networkmanager, Class oclass, LazyLoadBase lazyloadbase) {
|
||||
@ -58,7 +59,7 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 class MixinNetworkManager implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.gui.ExtendedServerData;
|
||||
@ -16,36 +34,37 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
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<CompoundNBT> 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<ServerData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -46,4 +47,5 @@ public class MixinServerListScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", b -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -19,11 +37,11 @@ import java.net.InetAddress;
|
||||
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 class MixinServerPinger {
|
||||
// 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 class MixinServerPinger {
|
||||
ViaForgeCommon.getManager().restoreVersion();
|
||||
}
|
||||
|
||||
viaforge_serverData = null;
|
||||
viaForge$serverData = null;
|
||||
}
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.fixes;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientPlayerEntity extends AbstractClientPlayerEntity {
|
||||
}
|
||||
return lastOnGround;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.provider;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
@ -16,9 +34,10 @@ import java.util.UUID;
|
||||
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 class ViaForgeGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -31,7 +32,7 @@ import java.util.function.Supplier;
|
||||
@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 class ViaForge115 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
@ -158,5 +159,7 @@ public class GuiProtocolSelector extends Screen {
|
||||
public interface FinishedCallback {
|
||||
|
||||
void finished(final VersionEnum version, final Screen parent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -51,14 +52,15 @@ public class MixinAddServerScreen extends Screen {
|
||||
if (config.isShowAddServerButton()) {
|
||||
final Pair<Integer, Integer> 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);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientLoginNetHandler {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinConnectingScreen_1 {
|
||||
// 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 class MixinConnectingScreen_1 {
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinDebugOverlayGui {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -49,4 +50,5 @@ public class MixinMainMenuScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -46,4 +47,5 @@ public class MixinMultiplayerScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<NetworkManager> cir, NetworkManager networkmanager, Class oclass, LazyValue lazyvalue) {
|
||||
@ -58,7 +59,7 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 class MixinNetworkManager implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.gui.ExtendedServerData;
|
||||
@ -16,36 +34,37 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
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<CompoundNBT> 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<ServerData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -46,4 +47,5 @@ public class MixinServerListScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, "ViaForge", b -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -19,11 +37,11 @@ import java.net.InetAddress;
|
||||
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 class MixinServerPinger {
|
||||
// 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 class MixinServerPinger {
|
||||
ViaForgeCommon.getManager().restoreVersion();
|
||||
}
|
||||
|
||||
viaforge_serverData = null;
|
||||
viaForge$serverData = null;
|
||||
}
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.fixes;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientPlayerEntity extends AbstractClientPlayerEntity {
|
||||
}
|
||||
return lastOnGround;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.provider;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
@ -16,9 +34,10 @@ import java.util.UUID;
|
||||
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 class ViaForgeGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -31,7 +32,7 @@ import java.util.function.Supplier;
|
||||
@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 class ViaForge116 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
@ -159,5 +160,7 @@ public class GuiProtocolSelector extends Screen {
|
||||
public interface FinishedCallback {
|
||||
|
||||
void finished(final VersionEnum version, final Screen parent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -52,14 +53,15 @@ public class MixinAddServerScreen extends Screen {
|
||||
if (config.isShowAddServerButton()) {
|
||||
final Pair<Integer, Integer> 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);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientLoginNetHandler {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinConnectingScreen_1 {
|
||||
// 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 class MixinConnectingScreen_1 {
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinDebugOverlayGui {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -50,4 +51,5 @@ public class MixinMainMenuScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -47,4 +48,5 @@ public class MixinMultiplayerScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<NetworkManager> cir, NetworkManager networkmanager, Class oclass, LazyValue lazyvalue) {
|
||||
@ -58,7 +59,7 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 @@ public class MixinNetworkManager implements VFNetworkManager {
|
||||
// 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 class MixinNetworkManager implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.gui.ExtendedServerData;
|
||||
@ -16,36 +34,37 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
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<CompoundNBT> 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<ServerData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -47,4 +48,5 @@ public class MixinServerListScreen extends Screen {
|
||||
addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -19,11 +37,11 @@ import java.net.InetAddress;
|
||||
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 class MixinServerPinger {
|
||||
// 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 class MixinServerPinger {
|
||||
ViaForgeCommon.getManager().restoreVersion();
|
||||
}
|
||||
|
||||
viaforge_serverData = null;
|
||||
viaForge$serverData = null;
|
||||
}
|
||||
|
||||
return NetworkManager.connectToServer(address, i, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.fixes;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientPlayerEntity extends AbstractClientPlayerEntity {
|
||||
}
|
||||
return lastOnGround;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.provider;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
@ -16,9 +34,10 @@ import java.util.UUID;
|
||||
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 class ViaForgeGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -31,7 +32,7 @@ import java.util.function.Supplier;
|
||||
@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 class ViaForge117 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@ -164,5 +165,7 @@ public class GuiProtocolSelector extends Screen {
|
||||
public interface FinishedCallback {
|
||||
|
||||
void finished(final VersionEnum version, final Screen parent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientHandshakePacketListenerImpl {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinConnectScreen_1 {
|
||||
// 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 class MixinConnectScreen_1 {
|
||||
|
||||
return Connection.connectToServer(oclass, lazyloadedvalue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<Connection> cir, final Connection connection) {
|
||||
@ -55,7 +56,7 @@ public class MixinConnection implements VFNetworkManager {
|
||||
// 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 @@ public class MixinConnection implements VFNetworkManager {
|
||||
// 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 class MixinConnection implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinDebugScreenOverlay {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -47,4 +48,5 @@ public class MixinDirectJoinServerScreen extends Screen {
|
||||
addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -54,14 +55,15 @@ public class MixinEditServerScreen extends Screen {
|
||||
if (config.isShowAddServerButton()) {
|
||||
final Pair<Integer, Integer> 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);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -47,4 +48,5 @@ public class MixinJoinMultiplayerScreen extends Screen {
|
||||
addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.gui.ExtendedServerData;
|
||||
@ -16,36 +34,37 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
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<CompoundTag> 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<ServerData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -19,11 +37,11 @@ import java.net.InetSocketAddress;
|
||||
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 class MixinServerStatusPinger {
|
||||
// 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 class MixinServerStatusPinger {
|
||||
ViaForgeCommon.getManager().restoreVersion();
|
||||
}
|
||||
|
||||
viaforge_serverData = null;
|
||||
viaForge$serverData = null;
|
||||
}
|
||||
|
||||
return Connection.connectToServer(oclass, lazyloadedvalue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -50,4 +51,5 @@ public class MixinTitleScreen extends Screen {
|
||||
addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin.fixes;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinLocalPlayer extends AbstractClientPlayer {
|
||||
}
|
||||
return lastOnGround;
|
||||
}
|
||||
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.provider;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
@ -16,9 +34,10 @@ import java.util.UUID;
|
||||
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 class ViaForgeGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.viaforge.common.platform.VFPlatform;
|
||||
@ -31,7 +32,7 @@ import java.util.function.Supplier;
|
||||
@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 class ViaForge118 implements VFPlatform {
|
||||
public GameProfileFetcher getGameProfileFetcher() {
|
||||
return new ViaForgeGameProfileFetcher();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@ -164,5 +165,7 @@ public class GuiProtocolSelector extends Screen {
|
||||
public interface FinishedCallback {
|
||||
|
||||
void finished(final VersionEnum version, final Screen parent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -34,4 +52,5 @@ public class MixinClientHandshakePacketListenerImpl {
|
||||
}
|
||||
instance.joinServer(profile, authenticationToken, serverId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -20,7 +38,7 @@ public class MixinConnectScreen_1 {
|
||||
// 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 class MixinConnectScreen_1 {
|
||||
|
||||
return Connection.connectToServer(oclass, lazyloadedvalue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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<Connection> cir, final Connection connection) {
|
||||
@ -55,7 +56,7 @@ public class MixinConnection implements VFNetworkManager {
|
||||
// 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 @@ public class MixinConnection implements VFNetworkManager {
|
||||
// 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 class MixinConnection implements VFNetworkManager {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
@ -32,4 +50,5 @@ public class MixinDebugScreenOverlay {
|
||||
cir.getReturnValue().add("ViaForge: " + version.getName() + " (" + protocolVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
@ -47,4 +48,5 @@ public class MixinDirectJoinServerScreen extends Screen {
|
||||
addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user