Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1.16_combat-6/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tasks.processResources {

tasks.runClient {
classpath(sourceSets.getByName("test").runtimeClasspath)
jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+IgnoreUnrecognizedVMOptions")
}

tasks.withType(JavaCompile::class).configureEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright © 2025 moehreag <[email protected]> & Contributors
*
* This file is part of AxolotlClient.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.mixin;

import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.VanillaButtonWidget;
import io.github.axolotlclient.modules.hud.util.DrawUtil;
import io.github.axolotlclient.util.ButtonWidgetTextures;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(VanillaButtonWidget.class)
public abstract class ConfigVanillaButtonWidgetMixin extends ButtonWidget {
@Shadow(remap = false)
public abstract int getX();

@Shadow(remap = false)
public abstract int getY();

private ConfigVanillaButtonWidgetMixin(int x, int y, int width, int height, Text message, PressAction action) {
super(x, y, width, height, message, action);
}

@Redirect(method = "renderButton", at = @At(value = "INVOKE", target = "Lio/github/axolotlclient/AxolotlClientConfig/impl/ui/vanilla/widgets/VanillaButtonWidget;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V", ordinal = 0))
private void drawTexture$1(VanillaButtonWidget instance, MatrixStack stack, int x, int y, int u, int v, int width, int height) {

}

@Redirect(method = "renderButton", at = @At(value = "INVOKE", target = "Lio/github/axolotlclient/AxolotlClientConfig/impl/ui/vanilla/widgets/VanillaButtonWidget;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V", ordinal = 1))
private void drawTexture$2$replaceWithNineSlice(VanillaButtonWidget instance, MatrixStack stack, int x, int y, int u, int v, int width, int height) {
Identifier tex = ButtonWidgetTextures.get(getYImage(hovered));
DrawUtil.blitSprite(tex, getX(), getY(), getWidth(), getHeight(), new DrawUtil.NineSlice(200, 20, 3));
MinecraftClient.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright © 2025 moehreag <[email protected]> & Contributors
*
* This file is part of AxolotlClient.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.mixin.skins;

import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.PlayerSkinTexture;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(PlayerSkinTexture.class)
public interface PlayerSkinTextureAccessor {

@Invoker("remapTexture")
static NativeImage invokeRemapTexture(NativeImage img) {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package io.github.axolotlclient.modules.auth;

import io.github.axolotlclient.modules.auth.skin.SkinManagementScreen;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ScreenTexts;
Expand All @@ -36,6 +37,7 @@ public class AccountsScreen extends Screen {
private ButtonWidget loginButton;
private ButtonWidget deleteButton;
private ButtonWidget refreshButton;
private ButtonWidget skinsButton;

public AccountsScreen(Screen currentScreen) {
super(new TranslatableText("accounts"));
Expand Down Expand Up @@ -77,10 +79,14 @@ public void init() {

accountsListWidget.setAccounts(Auth.getInstance().getAccounts());

addButton(loginButton = new ButtonWidget(this.width / 2 - 154, this.height - 52, 150, 20, new TranslatableText("auth.login"),
addButton(loginButton = new ButtonWidget(this.width / 2 - 154, this.height - 52, 100, 20, new TranslatableText("auth.login"),
buttonWidget -> login()));

this.addButton(new ButtonWidget(this.width / 2 + 4, this.height - 52, 150, 20, new TranslatableText("auth.add"),
addButton(skinsButton = new ButtonWidget(this.width / 2 - 50, this.height - 52, 100, 20, new TranslatableText("skins.manage"),
btn -> client.openScreen(new SkinManagementScreen(
this, accountsListWidget.getSelected().getAccount()))));

this.addButton(new ButtonWidget(this.width / 2 + 4 + 50, this.height - 52, 100, 20, new TranslatableText("auth.add"),
button -> {
if (!Auth.getInstance().allowOfflineAccounts()) {
initMSAuth();
Expand Down Expand Up @@ -120,27 +126,25 @@ public void removed() {
}

private void initMSAuth() {
Auth.getInstance().getAuth().startDeviceAuth().thenRun(() -> client.execute(this::refresh));
Auth.getInstance().getMsApi().startDeviceAuth().thenRun(() -> client.execute(this::refresh));
}

private void refreshAccount() {
refreshButton.active = false;
AccountsListWidget.Entry entry = accountsListWidget.getSelected();
if (entry != null) {
entry.getAccount().refresh(Auth.getInstance().getAuth()).thenRun(() -> client.execute(() -> {
Auth.getInstance().save();
refresh();
}));
entry.getAccount().refresh(Auth.getInstance().getMsApi());
}
}

private void updateButtonActivationStates() {
AccountsListWidget.Entry entry = accountsListWidget.getSelected();
if (client.world == null && entry != null) {
loginButton.active = entry.getAccount().isExpired() || !entry.getAccount().equals(Auth.getInstance().getCurrent());
deleteButton.active = refreshButton.active = true;
refreshButton.active = skinsButton.active = !entry.getAccount().isOffline();
deleteButton.active = true;
} else {
loginButton.active = deleteButton.active = refreshButton.active = false;
loginButton.active = deleteButton.active = refreshButton.active = skinsButton.active = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@
package io.github.axolotlclient.modules.auth;

import java.util.*;
import java.util.concurrent.CompletableFuture;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import io.github.axolotlclient.AxolotlClient;
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
import io.github.axolotlclient.api.API;
import io.github.axolotlclient.api.types.User;
import io.github.axolotlclient.api.util.UUIDHelper;
import io.github.axolotlclient.mixin.MinecraftClientAccessor;
import io.github.axolotlclient.modules.Module;
import io.github.axolotlclient.modules.auth.skin.SkinManager;
import io.github.axolotlclient.util.ThreadExecuter;
import io.github.axolotlclient.util.notifications.Notifications;
import io.github.axolotlclient.util.options.GenericOption;
import lombok.Getter;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.Session;
import net.minecraft.text.TranslatableText;
Expand All @@ -51,17 +51,20 @@ public class Auth extends Accounts implements Module {
@Getter
private final static Auth Instance = new Auth();
public final BooleanOption showButton = new BooleanOption("auth.showButton", false);
public final BooleanOption skinManagerAnimations = new BooleanOption("skins.manage.animations", true);
private final MinecraftClient client = MinecraftClient.getInstance();
private final GenericOption viewAccounts = new GenericOption("viewAccounts", "clickToOpen", () -> client.openScreen(new AccountsScreen(client.currentScreen)));

private final Map<String, Identifier> textures = new HashMap<>();
private final Set<String> loadingTexture = new HashSet<>();
private final Map<String, GameProfile> profileCache = new WeakHashMap<>();
@Getter
private final SkinManager skinManager = new SkinManager();

@Override
public void init() {
load();
this.auth = new MSAuth(AxolotlClient.LOGGER, this, () -> client.options.language);
this.msApi = new MSApi(this, () -> client.options.language);
if (isContained(client.getSession().getUuid())) {
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).toList().get(0);
current.setAuthToken(client.getSession().getAccessToken());
Expand All @@ -73,7 +76,6 @@ public void init() {
current = new Account(client.getSession().getUsername(), client.getSession().getUuid(), client.getSession().getAccessToken());
}

OptionCategory category = OptionCategory.create("auth");
category.add(showButton, viewAccounts);
AxolotlClient.config().general.add(category);
}
Expand All @@ -88,12 +90,10 @@ protected void login(Account account) {
if (account.isExpired()) {
Notifications.getInstance().addStatus(new TranslatableText("auth.notif.title"), new TranslatableText("auth.notif.refreshing", account.getName()));
}
account.refresh(auth).thenAccept(res -> {
res.ifPresent(a -> {
if (!a.isExpired()) {
login(a);
}
});
account.refresh(msApi).thenAccept(a -> {
if (!a.isExpired()) {
login(a);
}
}).thenRun(this::save);
} else {
try {
Expand Down Expand Up @@ -138,14 +138,18 @@ public void loadTextures(String uuid, String name) {
}

@Override
void showAccountsExpiredScreen(Account account) {
Screen current = client.currentScreen;
CompletableFuture<Account> showAccountsExpiredScreen(Account account) {
var screen = client.currentScreen;
var fut = new CompletableFuture<Account>();
client.execute(() -> client.openScreen(new ConfirmScreen((bl) -> {
client.openScreen(current);
if (bl) {
auth.startDeviceAuth();
msApi.startDeviceAuth().thenRun(() -> fut.complete(account));
} else {
fut.cancel(true);
}
client.openScreen(screen);
}, new TranslatableText("auth"), new TranslatableText("auth.accountExpiredNotice", account.getName()))));
return fut;
}

@Override
Expand Down
Loading