Skip to content

Commit

Permalink
Added new setting for legacy skin loading
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Mar 31, 2023
1 parent 8e097df commit 63e22d0
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}

}
8 changes: 8 additions & 0 deletions src/main/java/net/raphimc/viaproxy/ui/impl/AdvancedTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -76,6 +77,13 @@ protected void init(JPanel contentPane) {
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
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/raphimc/viaproxy/ui/impl/GeneralTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ private void start() {
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 {
Expand Down Expand Up @@ -238,6 +239,7 @@ private void start() {
Options.ONLINE_MODE = proxyOnlineMode;
Options.PROTOCOL_VERSION = serverVersion;
Options.BETACRAFT_AUTH = betaCraftAuth;
Options.LEGACY_SKIN_LOADING = legacySkinLoading;

if (authMethod == 2) {
Options.OPENAUTHMOD_AUTH = true;
Expand Down

0 comments on commit 63e22d0

Please sign in to comment.