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

Commit cda23a1

Browse files
committed
fix some more bugs and oversights
1 parent 4bfe8a8 commit cda23a1

File tree

20 files changed

+75
-71
lines changed

20 files changed

+75
-71
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import io.github.axolotlclient.util.LoggerImpl;
5050
import io.github.axolotlclient.util.notifications.Notifications;
5151
import net.fabricmc.api.ClientModInitializer;
52-
import net.minecraft.client.resource.language.I18n;
5352
import net.minecraft.resource.Resource;
5453
import net.minecraft.util.Identifier;
5554

@@ -90,7 +89,7 @@ public void onInitializeClient() {
9089
addExternalModules();
9190

9291
init(LOGGER, Notifications.getInstance());
93-
new API(LOGGER, I18n::translate, new StatusUpdateProviderImpl(), APIOptions.getInstance());
92+
new API(new StatusUpdateProviderImpl(), APIOptions.getInstance());
9493

9594
LOGGER.debug("Debug Output enabled, Logs will be quite verbose!");
9695
LOGGER.info("AxolotlClient Initialized");

1.16_combat-6/src/main/java/io/github/axolotlclient/bridge/mixin/PlatformDispatchMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ public void draw(MinecraftClient client, MatrixStack stack, int sX, int sY, int
142142

143143
@Override
144144
public void close() {
145-
minecraft.getTextureManager().destroyTexture(iconId);
146-
icon.close();
145+
minecraft.execute(() -> {
146+
minecraft.getTextureManager().destroyTexture(iconId);
147+
icon.close();
148+
});
147149
}
148150
}
149151

1.20/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import io.github.axolotlclient.util.LoggerImpl;
5050
import io.github.axolotlclient.util.notifications.Notifications;
5151
import net.fabricmc.api.ClientModInitializer;
52-
import net.minecraft.client.resource.language.I18n;
5352
import net.minecraft.resource.Resource;
5453
import net.minecraft.util.Identifier;
5554

@@ -90,7 +89,7 @@ public void onInitializeClient() {
9089
addExternalModules();
9190

9291
init(LOGGER, Notifications.getInstance());
93-
new API(LOGGER, I18n::translate, new StatusUpdateProviderImpl(), APIOptions.getInstance());
92+
new API(new StatusUpdateProviderImpl(), APIOptions.getInstance());
9493

9594
LOGGER.debug("Debug Output enabled, Logs will be quite verbose!");
9695
LOGGER.info("AxolotlClient Initialized");

1.20/src/main/java/io/github/axolotlclient/bridge/mixin/PlatformDispatchMixin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,15 @@ class Impl implements AxoSprite.Dynamic, AxoSpriteImpl {
149149
@Override
150150
public void draw(MinecraftClient client, GuiGraphics stack, int sX, int sY, int sW, int sH) {
151151
client.getTextureManager().bindTexture(iconId);
152-
stack.drawTexture(iconId, sX, sY, 0, 0, sW, sH, sW, sH);
152+
stack.drawTexture(iconId, sX, sY, 0, 0, sW, sH, sW, sH);
153153
}
154154

155155
@Override
156156
public void close() {
157-
minecraft.getTextureManager().destroyTexture(iconId);
158-
icon.close();
157+
minecraft.execute(() -> {
158+
minecraft.getTextureManager().destroyTexture(iconId);
159+
icon.close();
160+
});
159161
}
160162
}
161163

1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package io.github.axolotlclient.modules.hud.gui.hud;
2424

2525
import java.nio.file.Files;
26-
import java.nio.file.Path;
2726
import java.util.*;
2827
import java.util.function.Function;
2928
import java.util.function.Supplier;
@@ -40,9 +39,9 @@
4039
import io.github.axolotlclient.config.profiles.ProfileAware;
4140
import io.github.axolotlclient.mixin.KeyBindAccessor;
4241
import io.github.axolotlclient.modules.hud.ClickInputTracker;
42+
import io.github.axolotlclient.modules.hud.gui.entry.TextHudEntry;
4343
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokePositioningScreen;
4444
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokesScreen;
45-
import io.github.axolotlclient.modules.hud.gui.entry.TextHudEntry;
4645
import io.github.axolotlclient.modules.hud.gui.layout.Justification;
4746
import io.github.axolotlclient.modules.hud.util.DrawPosition;
4847
import io.github.axolotlclient.modules.hud.util.DrawUtil;
@@ -76,7 +75,7 @@
7675

7776
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7877

79-
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
78+
private static final String KEYSTROKE_SAVE_FILE_NAME = "keystrokes.json";
8079
public static final Identifier ID = new Identifier("kronhud", "keystrokehud");
8180

8281
private final ColorOption pressedTextColor = new ColorOption("heldtextcolor", new Color(0xFF000000));
@@ -482,8 +481,9 @@ public boolean isLabelEditable() {
482481

483482
public void saveKeystrokes() {
484483
try {
485-
Files.createDirectories(KEYSTROKE_SAVE_FILE.getParent());
486-
Files.writeString(KEYSTROKE_SAVE_FILE, GsonHelper.GSON.toJson(keystrokes.stream().map(Keystroke::serialize).toList()));
484+
var path = AxolotlClientCommon.resolveProfileConfigFile(KEYSTROKE_SAVE_FILE_NAME);
485+
Files.createDirectories(path.getParent());
486+
Files.writeString(path, GsonHelper.GSON.toJson(keystrokes.stream().map(Keystroke::serialize).toList()));
487487
} catch (Exception e) {
488488
AxolotlClient.LOGGER.warn("Failed to save keystroke configuration!", e);
489489
}
@@ -492,8 +492,9 @@ public void saveKeystrokes() {
492492
@SuppressWarnings("unchecked")
493493
public void loadKeystrokes() {
494494
try {
495-
if (Files.exists(KEYSTROKE_SAVE_FILE)) {
496-
List<?> entries = (List<?>) GsonHelper.read(Files.readString(KEYSTROKE_SAVE_FILE));
495+
var path = AxolotlClientCommon.resolveProfileConfigFile(KEYSTROKE_SAVE_FILE_NAME);
496+
if (Files.exists(path)) {
497+
List<?> entries = (List<?>) GsonHelper.read(Files.readString(path));
497498
var loaded = entries.stream().map(e -> (Map<String, Object>) e)
498499
.map(KeystrokeHud.this::deserializeKey)
499500
.toList();

1.21.7/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import io.github.axolotlclient.util.LoggerImpl;
4747
import io.github.axolotlclient.util.notifications.Notifications;
4848
import net.fabricmc.api.ClientModInitializer;
49-
import net.minecraft.client.resources.language.I18n;
5049
import net.minecraft.resources.ResourceLocation;
5150
import net.minecraft.server.packs.resources.Resource;
5251

@@ -85,7 +84,7 @@ public void onInitializeClient() {
8584
addExternalModules();
8685

8786
init(LOGGER, Notifications.getInstance());
88-
new API(LOGGER, I18n::get, new StatusUpdateProviderImpl(), APIOptions.getInstance());
87+
new API(new StatusUpdateProviderImpl(), APIOptions.getInstance());
8988

9089
LOGGER.debug("Debug Output enabled, Logs will be quite verbose!");
9190
LOGGER.info("AxolotlClient Initialized");

1.21.7/src/main/java/io/github/axolotlclient/bridge/mixin/PlatformDispatchMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void draw(Minecraft client, GuiGraphics stack, int sX, int sY, int sW, in
112112

113113
@Override
114114
public void close() {
115-
icon.close();
115+
minecraft.execute(icon::close);
116116
}
117117
}
118118

1.21.7/src/main/java/io/github/axolotlclient/mixin/EntityRendererMixin.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
import net.minecraft.client.Minecraft;
3535
import net.minecraft.client.gui.Font;
3636
import net.minecraft.client.player.AbstractClientPlayer;
37-
import net.minecraft.client.renderer.MultiBufferSource;
38-
import net.minecraft.client.renderer.RenderPipelines;
39-
import net.minecraft.client.renderer.RenderStateShard;
40-
import net.minecraft.client.renderer.RenderType;
37+
import net.minecraft.client.renderer.*;
4138
import net.minecraft.client.renderer.entity.EntityRenderer;
4239
import net.minecraft.client.renderer.entity.state.EntityRenderState;
4340
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
@@ -153,7 +150,7 @@ private int getNameOffset(Player entity) {
153150

154151
Matrix4f matrix4f = matrices.last().pose();
155152
textRenderer.drawInBatch(text, x, y, ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
156-
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, light);
153+
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, LightTexture.lightCoordsWithEmission(light, 2));
157154
}
158155
} else if (LevelHead.getInstance().enabled.get()) {
159156
String text = LevelHead.getInstance().getDisplayString(entity.getStringUUID());
@@ -167,7 +164,7 @@ private int getNameOffset(Player entity) {
167164

168165
Matrix4f matrix4f = matrices.last().pose();
169166
textRenderer.drawInBatch(text, x, y, ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
170-
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, light);
167+
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, LightTexture.lightCoordsWithEmission(light, 2));
171168
}
172169
}
173170
}

1.21.7/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package io.github.axolotlclient.modules.hud.gui.hud;
2424

2525
import java.nio.file.Files;
26-
import java.nio.file.Path;
2726
import java.util.*;
2827
import java.util.function.Function;
2928
import java.util.function.Supplier;
@@ -73,7 +72,7 @@
7372

7473
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7574

76-
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
75+
private static final String KEYSTROKE_SAVE_FILE_NAME = "keystrokes.json";
7776
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("kronhud", "keystrokehud");
7877

7978
private final Minecraft client = (Minecraft) super.client;
@@ -477,8 +476,9 @@ public boolean isLabelEditable() {
477476

478477
public void saveKeystrokes() {
479478
try {
480-
Files.createDirectories(KEYSTROKE_SAVE_FILE.getParent());
481-
Files.writeString(KEYSTROKE_SAVE_FILE, GsonHelper.GSON.toJson(keystrokes.stream().map(Keystroke::serialize).toList()));
479+
var path = AxolotlClientCommon.resolveProfileConfigFile(KEYSTROKE_SAVE_FILE_NAME);
480+
Files.createDirectories(path.getParent());
481+
Files.writeString(path, GsonHelper.GSON.toJson(keystrokes.stream().map(Keystroke::serialize).toList()));
482482
} catch (Exception e) {
483483
AxolotlClient.LOGGER.warn("Failed to save keystroke configuration!", e);
484484
}
@@ -487,8 +487,9 @@ public void saveKeystrokes() {
487487
@SuppressWarnings("unchecked")
488488
public void loadKeystrokes() {
489489
try {
490-
if (Files.exists(KEYSTROKE_SAVE_FILE)) {
491-
List<?> entries = (List<?>) GsonHelper.read(Files.readString(KEYSTROKE_SAVE_FILE));
490+
var path = AxolotlClientCommon.resolveProfileConfigFile(KEYSTROKE_SAVE_FILE_NAME);
491+
if (Files.exists(path)) {
492+
List<?> entries = (List<?>) GsonHelper.read(Files.readString(path));
492493
var loaded = entries.stream().map(e -> (Map<String, Object>) e)
493494
.map(KeystrokeHud.this::deserializeKey)
494495
.toList();

1.21/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import io.github.axolotlclient.util.LoggerImpl;
4848
import io.github.axolotlclient.util.notifications.Notifications;
4949
import net.fabricmc.api.ClientModInitializer;
50-
import net.minecraft.client.resource.language.I18n;
5150
import net.minecraft.resource.Resource;
5251
import net.minecraft.util.Identifier;
5352

@@ -86,7 +85,7 @@ public void onInitializeClient() {
8685
addExternalModules();
8786

8887
init(LOGGER, Notifications.getInstance());
89-
new API(LOGGER, I18n::translate, new StatusUpdateProviderImpl(), APIOptions.getInstance());
88+
new API(new StatusUpdateProviderImpl(), APIOptions.getInstance());
9089

9190
LOGGER.debug("Debug Output enabled, Logs will be quite verbose!");
9291
LOGGER.info("AxolotlClient Initialized");

0 commit comments

Comments
 (0)