Added new setting for legacy skin loading

This commit is contained in:
RaphiMC 2023-03-31 22:58:47 +02:00
parent 8e097df090
commit 63e22d06ba
5 changed files with 49 additions and 1 deletions

View File

@ -66,7 +66,7 @@ dependencies {
exclude group: "com.google.guava", module: "guava"
}
include "com.viaversion:viarewind-core:2.0.4-SNAPSHOT"
include "net.raphimc:ViaLegacy:2.2.9"
include "net.raphimc:ViaLegacy:2.2.10"
include "net.raphimc:ViaAprilFools:2.0.6"
include("net.raphimc:ViaProtocolHack:2.2.2") {
exclude group: "org.slf4j", module: "slf4j-api"

View File

@ -48,6 +48,7 @@ public class Options {
// GUI only config options
public static Account MC_ACCOUNT;
public static String CLASSIC_MP_PASS;
public static Boolean LEGACY_SKIN_LOADING;
// CLI only config options
public static int COMPRESSION_THRESHOLD = 256;

View File

@ -0,0 +1,37 @@
/*
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
* Copyright (C) 2023 RK_01/RaphiMC 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 net.raphimc.viaproxy.injection.transformer;
import net.lenni0451.classtransform.InjectionCallback;
import net.lenni0451.classtransform.annotations.CTarget;
import net.lenni0451.classtransform.annotations.CTransformer;
import net.lenni0451.classtransform.annotations.injection.CInject;
import net.raphimc.vialegacy.ViaLegacyConfig;
import net.raphimc.viaproxy.cli.options.Options;
@CTransformer(ViaLegacyConfig.class)
public abstract class ViaLegacyConfigTransformer {
@CInject(method = "isLegacySkinLoading", target = @CTarget("HEAD"), cancellable = true)
private void makeGUIConfigurable(final InjectionCallback ic) {
if (Options.LEGACY_SKIN_LOADING != null) {
ic.setReturnValue(Options.LEGACY_SKIN_LOADING);
}
}
}

View File

@ -30,6 +30,7 @@ public class AdvancedTab extends AUITab {
JSpinner bindPort;
JTextField proxy;
JCheckBox proxyOnlineMode;
JCheckBox legacySkinLoading;
public AdvancedTab(final ViaProxyUI frame) {
super(frame, "Advanced");
@ -76,6 +77,13 @@ public class AdvancedTab extends AUITab {
ViaProxy.saveManager.uiSave.loadCheckBox("proxy_online_mode", this.proxyOnlineMode);
contentPane.add(this.proxyOnlineMode);
}
{
this.legacySkinLoading = new JCheckBox("Legacy Skin Loading");
this.legacySkinLoading.setBounds(10, 140, 465, 20);
this.legacySkinLoading.setToolTipText("Enabling Legacy Skin Loading allows you to see skins on <= 1.6.4 servers");
ViaProxy.saveManager.uiSave.loadCheckBox("legacy_skin_loading", this.legacySkinLoading);
contentPane.add(this.legacySkinLoading);
}
}
@Override

View File

@ -202,6 +202,7 @@ public class GeneralTab extends AUITab {
final int authMethod = this.authMethod.getSelectedIndex();
final boolean betaCraftAuth = this.betaCraftAuth.isSelected();
final boolean proxyOnlineMode = ViaProxy.ui.advancedTab.proxyOnlineMode.isSelected();
final boolean legacySkinLoading = ViaProxy.ui.advancedTab.legacySkinLoading.isSelected();
final String proxyUrl = ViaProxy.ui.advancedTab.proxy.getText();
try {
@ -238,6 +239,7 @@ public class GeneralTab extends AUITab {
Options.ONLINE_MODE = proxyOnlineMode;
Options.PROTOCOL_VERSION = serverVersion;
Options.BETACRAFT_AUTH = betaCraftAuth;
Options.LEGACY_SKIN_LOADING = legacySkinLoading;
if (authMethod == 2) {
Options.OPENAUTHMOD_AUTH = true;