Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 74c12d0

Browse files
committed
fix various bugs
1 parent a327569 commit 74c12d0

File tree

14 files changed

+118
-67
lines changed

14 files changed

+118
-67
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import java.nio.file.Path;
2626
import java.util.*;
27-
import java.util.stream.Collectors;
2827

2928
import com.mojang.authlib.GameProfile;
3029
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
@@ -66,9 +65,9 @@ public void init() {
6665
load();
6766
this.auth = new MSAuth(AxolotlClient.LOGGER, this, () -> client.options.language);
6867
if (isContained(client.getSession().getUuid())) {
69-
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).collect(Collectors.toList()).get(0);
68+
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).toList().get(0);
7069
if (current.needsRefresh()) {
71-
current.refresh(auth);
70+
current.refresh(auth).thenRun(this::save);
7271
}
7372
} else {
7473
current = new Account(client.getSession().getUsername(), client.getSession().getUuid(), client.getSession().getAccessToken());
@@ -94,7 +93,7 @@ protected void login(Account account) {
9493
if (account.isExpired()) {
9594
Notifications.getInstance().addStatus(new TranslatableText("auth.notif.title"), new TranslatableText("auth.notif.refreshing", account.getName()));
9695
}
97-
account.refresh(auth).thenAccept(this::login);
96+
account.refresh(auth).thenAccept(this::login).thenRun(this::save);
9897
} else {
9998
try {
10099
API.getInstance().shutdown();

1.20/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void init() {
7171
current = getAccounts().stream().filter(account -> account.getUuid()
7272
.equals(UUIDTypeAdapter.fromUUID(client.getSession().getPlayerUuid()))).toList().get(0);
7373
if (current.needsRefresh()) {
74-
current.refresh(auth);
74+
current.refresh(auth).thenRun(this::save);
7575
}
7676
} else {
7777
current = new Account(client.getSession().getUsername(), UUIDTypeAdapter.fromUUID(client.getSession().getPlayerUuid()), client.getSession().getAccessToken());
@@ -97,7 +97,7 @@ protected void login(Account account) {
9797
if (account.isExpired()) {
9898
Notifications.getInstance().addStatus(Text.translatable("auth.notif.title"), Text.translatable("auth.notif.refreshing", account.getName()));
9999
}
100-
account.refresh(auth).thenAccept(this::login);
100+
account.refresh(auth).thenAccept(this::login).thenRun(this::save);
101101
} else {
102102
try {
103103
API.getInstance().shutdown();

1.21.4/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void init() {
7474
if (isContained(mc.getUser().getSessionId())) {
7575
current = getAccounts().stream().filter(account -> account.getUuid().equals(UndashedUuid.toString(mc.getUser().getProfileId()))).toList().getFirst();
7676
if (current.needsRefresh()) {
77-
current.refresh(auth);
77+
current.refresh(auth).thenRun(this::save);
7878
}
7979
} else {
8080
current = new Account(mc.getUser().getName(), UndashedUuid.toString(mc.getUser().getProfileId()), mc.getUser().getAccessToken());
@@ -100,7 +100,7 @@ protected void login(Account account) {
100100
if (account.isExpired()) {
101101
Notifications.getInstance().addStatus(Component.translatable("auth.notif.title"), Component.translatable("auth.notif.refreshing", account.getName()));
102102
}
103-
account.refresh(auth).thenAccept(this::login);
103+
account.refresh(auth).thenAccept(this::login).thenRun(this::save);
104104
} else {
105105
try {
106106
API.getInstance().shutdown();

1.21/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void init() {
7070
current = getAccounts().stream().filter(account -> account.getUuid()
7171
.equals(UndashedUuid.toString(client.getSession().getPlayerUuid()))).toList().getFirst();
7272
if (current.needsRefresh()) {
73-
current.refresh(auth);
73+
current.refresh(auth).thenRun(this::save);
7474
}
7575
} else {
7676
current = new Account(client.getSession().getUsername(), UndashedUuid.toString(client.getSession().getPlayerUuid()), client.getSession().getAccessToken());
@@ -96,7 +96,7 @@ protected void login(Account account) {
9696
if (account.isExpired()) {
9797
Notifications.getInstance().addStatus(Text.translatable("auth.notif.title"), Text.translatable("auth.notif.refreshing", account.getName()));
9898
}
99-
account.refresh(auth).thenAccept(this::login);
99+
account.refresh(auth).thenAccept(this::login).thenRun(this::save);
100100
} else {
101101
try {
102102
API.getInstance().shutdown();

1.8.9/src/main/java/io/github/axolotlclient/mixin/ClientPlayNetworkHandlerMixin.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,53 @@
2222

2323
package io.github.axolotlclient.mixin;
2424

25+
import com.llamalad7.mixinextras.sugar.Local;
2526
import io.github.axolotlclient.modules.hud.HudManager;
2627
import io.github.axolotlclient.modules.hud.gui.hud.simple.TPSHud;
2728
import net.minecraft.client.network.handler.ClientPlayNetworkHandler;
29+
import net.minecraft.client.world.ClientWorld;
30+
import net.minecraft.network.packet.s2c.play.EntityTeleportS2CPacket;
31+
import net.minecraft.network.packet.s2c.play.ScoreboardObjectiveS2CPacket;
32+
import net.minecraft.network.packet.s2c.play.TeamS2CPacket;
2833
import net.minecraft.network.packet.s2c.play.WorldTimeS2CPacket;
34+
import net.minecraft.scoreboard.ScoreboardObjective;
35+
import net.minecraft.scoreboard.team.Team;
2936
import org.spongepowered.asm.mixin.Mixin;
37+
import org.spongepowered.asm.mixin.Shadow;
3038
import org.spongepowered.asm.mixin.injection.At;
3139
import org.spongepowered.asm.mixin.injection.Inject;
3240
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3341

3442
@Mixin(ClientPlayNetworkHandler.class)
3543
public abstract class ClientPlayNetworkHandlerMixin {
3644

45+
@Shadow
46+
private ClientWorld world;
47+
3748
@Inject(method = "handleWorldTime", at = @At("HEAD"))
3849
private void axolotlclient$onWorldUpdate(WorldTimeS2CPacket packet, CallbackInfo ci) {
3950
TPSHud tpsHud = (TPSHud) HudManager.getInstance().get(TPSHud.ID);
4051
tpsHud.updateTime(packet.getTime());
4152
}
53+
54+
@Inject(method = "handleTeam", at = @At(value = "INVOKE", target = "Lnet/minecraft/scoreboard/Scoreboard;removeTeam(Lnet/minecraft/scoreboard/team/Team;)V"), cancellable = true)
55+
private void noStackTraceOnNullTeam(TeamS2CPacket teamS2CPacket, CallbackInfo ci, @Local Team team){
56+
if (team == null) {
57+
ci.cancel();
58+
}
59+
}
60+
61+
@Inject(method = "handleScoreboardObjective", at = @At(value = "INVOKE", target = "Lnet/minecraft/scoreboard/Scoreboard;removeObjective(Lnet/minecraft/scoreboard/ScoreboardObjective;)V"), cancellable = true)
62+
private void noStackTraceOnNullScoreboardObjective(ScoreboardObjectiveS2CPacket scoreboardObjectiveS2CPacket, CallbackInfo ci, @Local ScoreboardObjective objective){
63+
if (objective == null) {
64+
ci.cancel();
65+
}
66+
}
67+
68+
@Inject(method = "handleEntityTeleport", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getEntity(I)Lnet/minecraft/entity/Entity;"), cancellable = true)
69+
private void noStackTraceOnNullWorld(EntityTeleportS2CPacket entityTeleportS2CPacket, CallbackInfo ci) {
70+
if (this.world == null) {
71+
ci.cancel();
72+
}
73+
}
4274
}

1.8.9/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.List;
2626
import java.util.UUID;
2727

28+
import com.llamalad7.mixinextras.sugar.Local;
2829
import io.github.axolotlclient.AxolotlClient;
2930
import io.github.axolotlclient.api.requests.UserRequest;
3031
import io.github.axolotlclient.modules.hypixel.HypixelAbstractionLayer;
@@ -38,7 +39,6 @@
3839
import net.minecraft.client.gui.GuiElement;
3940
import net.minecraft.client.gui.overlay.PlayerTabOverlay;
4041
import net.minecraft.client.network.PlayerInfo;
41-
import net.minecraft.client.network.handler.ClientPlayNetworkHandler;
4242
import net.minecraft.client.render.TextRenderer;
4343
import net.minecraft.network.Connection;
4444
import net.minecraft.scoreboard.Scoreboard;
@@ -51,7 +51,6 @@
5151
import org.spongepowered.asm.mixin.injection.*;
5252
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
5353
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
54-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
5554
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
5655

5756
@Mixin(PlayerTabOverlay.class)
@@ -158,13 +157,12 @@ public abstract class PlayerListHudMixin extends GuiElement {
158157
at = @At(
159158
value = "INVOKE",
160159
target = "Lnet/minecraft/client/gui/overlay/PlayerTabOverlay;renderPing(IIILnet/minecraft/client/network/PlayerInfo;)V"
161-
),
162-
locals = LocalCapture.CAPTURE_FAILHARD
160+
)
163161
)
164162
public void axolotlclient$renderWithoutObjective(
165163
int width, Scoreboard scoreboard, ScoreboardObjective playerListScoreboardObjective, CallbackInfo ci,
166-
ClientPlayNetworkHandler clientPlayNetworkHandler, List list, int i, int j, int l, int m, int k, boolean bl, int n, int o,
167-
int p, int q, int r, List list2, int t, int u, int s, int v, int y, PlayerInfo playerListEntry2
164+
@Local(ordinal = 1) int i, @Local(ordinal = 6) int n,
165+
@Local(ordinal = 13) int v, @Local(ordinal = 14) int y, @Local PlayerInfo playerListEntry2
168166
) {
169167
if (!BedwarsMod.getInstance().isEnabled() || !BedwarsMod.getInstance().isWaiting()) {
170168
return;

1.8.9/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import java.nio.file.Path;
2626
import java.util.*;
27-
import java.util.stream.Collectors;
2827

2928
import com.mojang.authlib.GameProfile;
3029
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
@@ -67,9 +66,9 @@ public void init() {
6766
load();
6867
this.auth = new MSAuth(AxolotlClient.LOGGER, this, () -> client.options.language);
6968
if (isContained(client.getSession().getUuid())) {
70-
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).collect(Collectors.toList()).get(0);
69+
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).toList().get(0);
7170
if (current.needsRefresh()) {
72-
current.refresh(auth);
71+
current.refresh(auth).thenRun(this::save);
7372
}
7473
} else {
7574
current = new Account(client.getSession().getUsername(), client.getSession().getUuid(), client.getSession().getAccessToken());
@@ -95,7 +94,7 @@ protected void login(Account account) {
9594
if (account.isExpired()) {
9695
Notifications.getInstance().addStatus("auth.notif.title", "auth.notif.refreshing", account.getName());
9796
}
98-
account.refresh(auth).thenAccept(this::login);
97+
account.refresh(auth).thenAccept(this::login).thenRun(this::save);
9998
} else {
10099
try {
101100
API.getInstance().shutdown();

1.8.9/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsGame.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private String formatEliminated(BedwarsTeam team) {
198198
for (BedwarsPlayer p : players.values().stream()
199199
.filter(b -> b.getTeam() == team)
200200
.sorted(Comparator.comparingInt(BedwarsPlayer::getNumber))
201-
.collect(Collectors.toList())) {
201+
.toList()) {
202202
BedwarsPlayerStats stats = p.getStats();
203203
if (stats == null) {
204204
continue;
@@ -369,14 +369,14 @@ public void onScoreboardRender(ScoreboardRenderEvent event) {
369369
Scoreboard scoreboard = event.getObjective().getScoreboard();
370370
Collection<ScoreboardScore> scores = scoreboard.getScores(event.getObjective());
371371
List<ScoreboardScore> filteredScores = scores.stream()
372-
.filter(p_apply_1_ -> p_apply_1_.getOwner() != null && !p_apply_1_.getOwner().startsWith("#"))
372+
.filter(score -> score.getOwner() != null && !score.getOwner().startsWith("#"))
373373
.collect(Collectors.toList());
374374
Collections.reverse(filteredScores);
375375
if (filteredScores.size() < 3) {
376376
return;
377377
}
378378
ScoreboardScore score = filteredScores.get(2);
379-
Team team = scoreboard.getTeam(score.getOwner());
379+
Team team = scoreboard.getTeamOfMember(score.getOwner());
380380
String timer = Team.getMemberDisplayName(team, score.getOwner());
381381
if (!timer.contains(":")) {
382382
return;

1.8.9/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsMod.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.List;
2727
import java.util.Optional;
2828
import java.util.regex.Pattern;
29-
import java.util.stream.Collectors;
3029

3130
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
3231
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
@@ -190,7 +189,7 @@ public void onScoreboardRender(ScoreboardRenderEvent event) {
190189
Collection<ScoreboardScore> scores = scoreboard.getScores(event.getObjective());
191190
List<ScoreboardScore> filteredScores = scores.stream()
192191
.filter(score -> score.getOwner() != null && !score.getOwner().startsWith("#"))
193-
.collect(Collectors.toList());
192+
.toList();
194193
waiting = filteredScores.stream().anyMatch(score -> {
195194
Team team = scoreboard.getTeam(score.getOwner());
196195
String format = Formatting.strip(Team.getMemberDisplayName(team, score.getOwner())).replaceAll("[^A-z0-9 .:]", "");

1.8.9/src/main/java/io/github/axolotlclient/util/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public static List<String> getSidebar() {
193193
}
194194

195195
for (ScoreboardScore score : scores) {
196-
Team team = scoreboard.getTeam(score.getOwner());
196+
Team team = scoreboard.getTeamOfMember(score.getOwner());
197197
if (team == null)
198198
return lines;
199199
String text = team.getPrefix() + team.getSuffix();

0 commit comments

Comments
 (0)