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

Commit e184a13

Browse files
committed
clean up a bit
1 parent dad4c91 commit e184a13

File tree

17 files changed

+54
-50
lines changed

17 files changed

+54
-50
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28+
import java.time.Instant;
2829
import java.util.*;
2930
import java.util.concurrent.CancellationException;
3031
import java.util.concurrent.CompletableFuture;
@@ -90,7 +91,7 @@ public SkinManagementScreen(Screen parent, Account account) {
9091
super(new TranslatableText("skins.manage"));
9192
this.parent = parent;
9293
this.account = account;
93-
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, s -> !s.endsWith(Skin.Local.METADATA_SUFFIX), () -> {
94+
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, () -> {
9495
AxolotlClientCommon.getInstance().getLogger().info("Reloading screen as local files changed!");
9596
loadSkinsList();
9697
});
@@ -193,12 +194,12 @@ protected MutableText getNarrationMessage() {
193194
Runnable addWidgets = () -> {
194195
clear();
195196
addDrawableChild(current);
196-
addDrawableChild(skinList);
197-
addDrawableChild(capesList);
198197
addDrawableChild(skinsTab);
199198
addDrawableChild(capesTab);
200199
addDrawableChild(downloadButton);
201200
addDrawableChild(importButton);
201+
addDrawableChild(skinList);
202+
addDrawableChild(capesList);
202203
addDrawableChild(back);
203204
};
204205
if (cachedProfile != null) {
@@ -256,7 +257,7 @@ private void promptForSkinDownload() {
256257
try {
257258
var bytes = t.skin().join();
258259
var out = ensureNonexistent(SKINS_DIR.resolve(t.skinKey()));
259-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id()));
260+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id(), "download_time", Instant.now()));
260261
Files.write(out, bytes);
261262
client.execute(this::loadSkinsList);
262263
Notifications.getInstance().addStatus("skins.notification.title", "skins.notification.import.online.downloaded", t.name());
@@ -626,7 +627,7 @@ public Entry(int height, SkinWidget widget, @Nullable Text label) {
626627
if (confirmed) {
627628
try {
628629
Files.delete(asset.file());
629-
Files.deleteIfExists(asset.file().resolveSibling(asset.file().getFileName() + Skin.Local.METADATA_SUFFIX));
630+
Skin.Local.deleteMetadata(asset.file());
630631
refreshCurrentList();
631632
} catch (IOException e) {
632633
AxolotlClientCommon.getInstance().getLogger().warn("Failed to delete: ", e);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public Skin read(Path p) {
5656

5757
@SuppressWarnings("UnstableApiUsage")
5858
public Skin read(Path p, boolean fix) {
59-
if (p.getFileName().toString().endsWith(Skin.Local.METADATA_SUFFIX)) return null;
6059
boolean slim;
6160
String sha256;
6261
try {

1.20/src/main/java/io/github/axolotlclient/api/SimpleTextInputScreen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public void init() {
5959
}).positionAndSize(width / 2 + 5, height - 50, 150, 20).build());
6060
}
6161

62+
@Override
63+
public void tick() {
64+
input.tick();
65+
}
66+
6267
@Override
6368
public void render(GuiGraphics graphics, int i, int j, float f) {
6469
renderBackground(graphics);

1.20/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManagementScreen.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28+
import java.time.Instant;
2829
import java.util.*;
2930
import java.util.concurrent.CancellationException;
3031
import java.util.concurrent.CompletableFuture;
@@ -80,7 +81,7 @@ public SkinManagementScreen(Screen parent, Account account) {
8081
super(Text.translatable("skins.manage"));
8182
this.parent = parent;
8283
this.account = account;
83-
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, s -> !s.endsWith(Skin.Local.METADATA_SUFFIX), () -> {
84+
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, () -> {
8485
AxolotlClientCommon.getInstance().getLogger().info("Reloading screen as local files changed!");
8586
loadSkinsList();
8687
});
@@ -182,12 +183,12 @@ protected void updateNarration(NarrationMessageBuilder builder) {
182183
clearChildren();
183184
addDrawableChild(titleWidget);
184185
addDrawableChild(current);
185-
addDrawableChild(skinList);
186-
addDrawableChild(capesList);
187186
addDrawableChild(skinsTab);
188187
addDrawableChild(capesTab);
189188
addDrawableChild(downloadButton);
190189
addDrawableChild(importButton);
190+
addDrawableChild(skinList);
191+
addDrawableChild(capesList);
191192
addDrawableChild(back);
192193
};
193194
if (cachedProfile != null) {
@@ -234,7 +235,7 @@ private void promptForSkinDownload() {
234235
try {
235236
var bytes = t.skin().join();
236237
var out = ensureNonexistent(SKINS_DIR.resolve(t.skinKey()));
237-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id()));
238+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id(), "download_time", Instant.now()));
238239
Files.write(out, bytes);
239240
client.execute(this::loadSkinsList);
240241
Notifications.getInstance().addStatus("skins.notification.title", "skins.notification.import.online.downloaded", t.name());
@@ -594,7 +595,7 @@ public Entry(int height, SkinWidget widget, @Nullable Text label) {
594595
if (confirmed) {
595596
try {
596597
Files.delete(asset.file());
597-
Files.deleteIfExists(asset.file().resolveSibling(asset.file().getFileName() + Skin.Local.METADATA_SUFFIX));
598+
Skin.Local.deleteMetadata(asset.file());
598599
refreshCurrentList();
599600
} catch (IOException e) {
600601
AxolotlClientCommon.getInstance().getLogger().warn("Failed to delete: ", e);

1.20/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public Skin read(Path p) {
5353
}
5454

5555
public Skin read(Path p, boolean fix) {
56-
if (p.getFileName().toString().endsWith(Skin.Local.METADATA_SUFFIX)) return null;
5756
boolean slim;
5857
String sha256;
5958
try {

1.21.7/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManagementScreen.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28+
import java.time.Instant;
2829
import java.util.*;
2930
import java.util.concurrent.CancellationException;
3031
import java.util.concurrent.CompletableFuture;
@@ -89,7 +90,7 @@ public SkinManagementScreen(Screen parent, Account account) {
8990
super(Component.translatable("skins.manage"));
9091
this.parent = parent;
9192
this.account = account;
92-
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, s -> !s.endsWith(Skin.Local.METADATA_SUFFIX), () -> {
93+
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, () -> {
9394
AxolotlClientCommon.getInstance().getLogger().info("Reloading screen as local files changed!");
9495
loadSkinsList();
9596
});
@@ -181,10 +182,10 @@ protected void init() {
181182
addRenderableWidget(current);
182183
addRenderableWidget(skinsTab);
183184
addRenderableWidget(capesTab);
184-
addRenderableWidget(skinList);
185-
addRenderableWidget(capesList);
186185
addRenderableWidget(downloadButton);
187186
addRenderableWidget(importButton);
187+
addRenderableWidget(skinList);
188+
addRenderableWidget(capesList);
188189
addRenderableWidget(back);
189190
};
190191
if (cachedProfile != null) {
@@ -232,7 +233,7 @@ private void promptForSkinDownload() {
232233
try {
233234
var bytes = t.skin().join();
234235
var out = ensureNonexistent(SKINS_DIR.resolve(t.skinKey()));
235-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id()));
236+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id(), "download_time", Instant.now()));
236237
Files.write(out, bytes);
237238
minecraft.execute(this::loadSkinsList);
238239
Notifications.getInstance().addStatus("skins.notification.title", "skins.notification.import.online.downloaded", t.name());
@@ -592,7 +593,7 @@ public void renderString(GuiGraphics guiGraphics, Font font, int color) {
592593
if (confirmed) {
593594
try {
594595
Files.delete(asset.file());
595-
Files.deleteIfExists(asset.file().resolveSibling(asset.file().getFileName() + Skin.Local.METADATA_SUFFIX));
596+
Skin.Local.deleteMetadata(asset.file());
596597
refreshCurrentList();
597598
} catch (IOException e) {
598599
AxolotlClientCommon.getInstance().getLogger().warn("Failed to delete: ", e);

1.21.7/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public Skin read(Path p) {
5454
}
5555

5656
public Skin read(Path p, boolean fix) {
57-
if (p.getFileName().toString().endsWith(Skin.Local.METADATA_SUFFIX)) return null;
5857
boolean slim;
5958
String sha256;
6059
try {

1.21/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManagementScreen.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28+
import java.time.Instant;
2829
import java.util.*;
2930
import java.util.concurrent.CancellationException;
3031
import java.util.concurrent.CompletableFuture;
@@ -89,7 +90,7 @@ public SkinManagementScreen(Screen parent, Account account) {
8990
super(Text.translatable("skins.manage"));
9091
this.parent = parent;
9192
this.account = account;
92-
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, s -> !s.endsWith(Skin.Local.METADATA_SUFFIX), () -> {
93+
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, () -> {
9394
AxolotlClientCommon.getInstance().getLogger().info("Reloading screen as local files changed!");
9495
loadSkinsList();
9596
});
@@ -180,10 +181,10 @@ protected void init() {
180181
addDrawableSelectableElement(current);
181182
addDrawableSelectableElement(skinsTab);
182183
addDrawableSelectableElement(capesTab);
183-
addDrawableSelectableElement(skinList);
184-
addDrawableSelectableElement(capesList);
185184
addDrawableSelectableElement(downloadButton);
186185
addDrawableSelectableElement(importButton);
186+
addDrawableSelectableElement(skinList);
187+
addDrawableSelectableElement(capesList);
187188
addDrawableSelectableElement(back);
188189
};
189190
if (cachedProfile != null) {
@@ -230,7 +231,7 @@ private void promptForSkinDownload() {
230231
try {
231232
var bytes = t.skin().join();
232233
var out = ensureNonexistent(SKINS_DIR.resolve(t.skinKey()));
233-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id()));
234+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id(), "download_time", Instant.now()));
234235
Files.write(out, bytes);
235236
client.execute(this::loadSkinsList);
236237
Notifications.getInstance().addStatus("skins.notification.title", "skins.notification.import.online.downloaded", t.name());
@@ -599,7 +600,7 @@ public void drawScrollableText(GuiGraphics graphics, TextRenderer renderer, int
599600
if (confirmed) {
600601
try {
601602
Files.delete(asset.file());
602-
Files.deleteIfExists(asset.file().resolveSibling(asset.file().getFileName() + Skin.Local.METADATA_SUFFIX));
603+
Skin.Local.deleteMetadata(asset.file());
603604
refreshCurrentList();
604605
} catch (IOException e) {
605606
AxolotlClientCommon.getInstance().getLogger().warn("Failed to delete: ", e);

1.21/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public Skin read(Path p) {
5353
}
5454

5555
public Skin read(Path p, boolean fix) {
56-
if (p.getFileName().toString().endsWith(Skin.Local.METADATA_SUFFIX)) return null;
5756
boolean slim;
5857
String sha256;
5958
try {

1.8.9/src/main/java/io/github/axolotlclient/modules/auth/skin/SkinManagementScreen.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28+
import java.time.Instant;
2829
import java.util.*;
2930
import java.util.concurrent.CancellationException;
3031
import java.util.concurrent.CompletableFuture;
@@ -86,7 +87,7 @@ public SkinManagementScreen(Screen parent, Account account) {
8687
super(I18n.translate("skins.manage"));
8788
this.parent = parent;
8889
this.account = account;
89-
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, s -> !s.endsWith(Skin.Local.METADATA_SUFFIX), () -> {
90+
skinDirWatcher = Watcher.createSelfTicking(SKINS_DIR, () -> {
9091
AxolotlClientCommon.getInstance().getLogger().info("Reloading screen as local files changed!");
9192
loadSkinsList();
9293
});
@@ -261,7 +262,7 @@ private void promptForSkinDownload() {
261262
try {
262263
var bytes = t.skin().join();
263264
var out = ensureNonexistent(SKINS_DIR.resolve(t.skinKey()));
264-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id()));
265+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, t.classicModel(), "name", t.name(), "uuid", t.id(), "download_time", Instant.now()));
265266
Files.write(out, bytes);
266267
minecraft.submit(this::loadSkinsList);
267268
Notifications.getInstance().addStatus("skins.notification.title", "skins.notification.import.online.downloaded", t.name());
@@ -632,7 +633,7 @@ public Entry(int height, SkinWidget widget, @Nullable String label) {
632633
if (confirmed) {
633634
try {
634635
Files.delete(asset.file());
635-
Files.deleteIfExists(asset.file().resolveSibling(asset.file().getFileName() + Skin.Local.METADATA_SUFFIX));
636+
Skin.Local.deleteMetadata(asset.file());
636637
refreshCurrentList();
637638
} catch (IOException e) {
638639
AxolotlClientCommon.getInstance().getLogger().warn("Failed to delete: ", e);

0 commit comments

Comments
 (0)