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

Commit 6ac3529

Browse files
committed
port to 1.21.9-pre2
1 parent 871ca4d commit 6ac3529

File tree

105 files changed

+979
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+979
-905
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ public static int getCurrentFps() {
147147
* @reason Implement bridge platform.
148148
*/
149149
@Overwrite
150-
public static AxoKeybinding createKeyBinding(AxoKey defaultKey, String name, String category) {
150+
public static AxoKeybinding createKeyBinding(AxoKey defaultKey, String name) {
151151
int code = ((InputUtil.Key) Objects.requireNonNullElse(defaultKey, AxoKeys.KEY_UNKNOWN)).getCode();
152-
final var binding = new KeyBinding(name, code, category);
152+
final var binding = new KeyBinding(name, code, "category.axolotlclient");
153153
KeyBindingHelper.registerKeyBinding(binding);
154154
return binding;
155155
}

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

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.*;
3030
import java.util.concurrent.CancellationException;
3131
import java.util.concurrent.CompletableFuture;
32+
import java.util.function.Consumer;
3233
import java.util.function.Function;
3334
import java.util.stream.Collectors;
3435
import java.util.stream.Stream;
@@ -643,20 +644,7 @@ public Entry(int height, SkinWidget widget, @Nullable Text label) {
643644
if (asset.supportsDownload() && !asset.isLocal()) {
644645
this.actionButtons.add(new SpriteButton(new TranslatableText("skins.manage.download"), btn -> {
645646
btn.active = false;
646-
asset.image().thenAcceptAsync(b -> {
647-
try {
648-
var out = SKINS_DIR.resolve(asset.textureKey());
649-
Files.createDirectories(out.getParent());
650-
Files.write(out, b);
651-
if (asset instanceof Skin skin) {
652-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, skin.classicVariant()));
653-
}
654-
} catch (IOException e) {
655-
AxolotlClientCommon.getInstance().getLogger().warn("Failed to download: ", e);
656-
}
657-
refreshCurrentList();
658-
btn.active = true;
659-
});
647+
download(asset).thenRun(() -> btn.active = true);
660648
}, new Identifier("axolotlclient", "textures/gui/sprites/download.png")));
661649
}
662650
}
@@ -678,19 +666,46 @@ public void renderButton(MatrixStack guiGraphics, int mouseX, int mouseY, float
678666
equipping = true;
679667
btn.setMessage(TEXT_EQUIPPING);
680668
btn.active = false;
681-
widget.equip().thenAcceptAsync(p -> {
669+
Consumer<CompletableFuture<MSApi.MCProfile>> consumer = f -> f.thenAcceptAsync(p -> {
682670
cachedProfile = p;
683671
refreshCurrentList();
684672
}).exceptionally(t -> {
685673
AxolotlClientCommon.getInstance().getLogger().warn("Failed to equip asset!", t);
686674
equipping = false;
687675
return null;
688676
});
677+
if (asset instanceof Skin && !current.getSkin().isLocal()) {
678+
client.openScreen(new ConfirmScreen(confirmed -> {
679+
if (confirmed) {
680+
consumer.accept(download(current.getSkin()).thenCompose(a -> widget.equip()));
681+
} else {
682+
consumer.accept(widget.equip());
683+
}
684+
}, new TranslatableText("skins.manage.equip.confirm"), new TranslatableText("skins.manage.equip.download_current")));
685+
} else {
686+
consumer.accept(widget.equip());
687+
}
689688
});
690689
this.equipButton.active = !widget.isEquipped();
691690
this.skinWidget = widget;
692691
}
693692

693+
private @NotNull CompletableFuture<?> download(Asset asset) {
694+
return asset.image().thenAcceptAsync(b -> {
695+
try {
696+
var out = SKINS_DIR.resolve(asset.textureKey());
697+
Files.createDirectories(out.getParent());
698+
Files.write(out, b);
699+
if (asset instanceof Skin skin) {
700+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, skin.classicVariant()));
701+
}
702+
} catch (IOException e) {
703+
AxolotlClientCommon.getInstance().getLogger().warn("Failed to download: ", e);
704+
}
705+
refreshCurrentList();
706+
});
707+
}
708+
694709
@Override
695710
public final boolean isDragging() {
696711
return this.dragging;

1.20/src/main/java/io/github/axolotlclient/bridge/mixin/internal/PlatformImplInternalMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ public static int getCurrentFps() {
145145
* @reason Implement bridge platform.
146146
*/
147147
@Overwrite
148-
public static AxoKeybinding createKeyBinding(AxoKey defaultKey, String name, String category) {
148+
public static AxoKeybinding createKeyBinding(AxoKey defaultKey, String name) {
149149
int code = ((InputUtil.Key) Objects.requireNonNullElse(defaultKey, AxoKeys.KEY_UNKNOWN)).getKeyCode();
150-
final var binding = new KeyBind(name, code, category);
150+
final var binding = new KeyBind(name, code, "category.axolotlclient");
151151
KeyBinds.getInstance().register(binding);
152152
return binding;
153153
}

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

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.*;
3030
import java.util.concurrent.CancellationException;
3131
import java.util.concurrent.CompletableFuture;
32+
import java.util.function.Consumer;
3233
import java.util.function.Function;
3334
import java.util.stream.Collectors;
3435
import java.util.stream.Stream;
@@ -611,20 +612,7 @@ public Entry(int height, SkinWidget widget, @Nullable Text label) {
611612
if (asset.supportsDownload() && !asset.isLocal()) {
612613
this.actionButtons.add(new SpriteButton(Text.translatable("skins.manage.download"), btn -> {
613614
btn.active = false;
614-
asset.image().thenAcceptAsync(b -> {
615-
try {
616-
var out = SKINS_DIR.resolve(asset.textureKey());
617-
Files.createDirectories(out.getParent());
618-
Files.write(out, b);
619-
if (asset instanceof Skin skin) {
620-
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, skin.classicVariant()));
621-
}
622-
} catch (IOException e) {
623-
AxolotlClientCommon.getInstance().getLogger().warn("Failed to download: ", e);
624-
}
625-
refreshCurrentList();
626-
btn.active = true;
627-
});
615+
download(asset).thenRun(() -> btn.active = true);
628616
}, new Identifier("axolotlclient", "textures/gui/sprites/download.png")));
629617
}
630618
}
@@ -646,19 +634,46 @@ protected void drawWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
646634
equipping = true;
647635
btn.setMessage(TEXT_EQUIPPING);
648636
btn.active = false;
649-
widget.equip().thenAcceptAsync(p -> {
637+
Consumer<CompletableFuture<MSApi.MCProfile>> consumer = f -> f.thenAcceptAsync(p -> {
650638
cachedProfile = p;
651639
refreshCurrentList();
652640
}).exceptionally(t -> {
653641
AxolotlClientCommon.getInstance().getLogger().warn("Failed to equip asset!", t);
654642
equipping = false;
655643
return null;
656644
});
645+
if (asset instanceof Skin && !current.getSkin().isLocal()) {
646+
client.setScreen(new ConfirmScreen(confirmed -> {
647+
if (confirmed) {
648+
consumer.accept(download(current.getSkin()).thenCompose(a -> widget.equip()));
649+
} else {
650+
consumer.accept(widget.equip());
651+
}
652+
}, Text.translatable("skins.manage.equip.confirm"), Text.translatable("skins.manage.equip.download_current")));
653+
} else {
654+
consumer.accept(widget.equip());
655+
}
657656
}).width(widget.getWidth()).build();
658657
this.equipButton.active = !widget.isEquipped();
659658
this.skinWidget = widget;
660659
}
661660

661+
private @NotNull CompletableFuture<?> download(Asset asset) {
662+
return asset.image().thenAcceptAsync(b -> {
663+
try {
664+
var out = SKINS_DIR.resolve(asset.textureKey());
665+
Files.createDirectories(out.getParent());
666+
Files.write(out, b);
667+
if (asset instanceof Skin skin) {
668+
Skin.Local.writeMetadata(out, Map.of(Skin.Local.CLASSIC_METADATA_KEY, skin.classicVariant()));
669+
}
670+
} catch (IOException e) {
671+
AxolotlClientCommon.getInstance().getLogger().warn("Failed to download: ", e);
672+
}
673+
refreshCurrentList();
674+
});
675+
}
676+
662677
@Override
663678
public final boolean isDragging() {
664679
return this.dragging;

1.21.7/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ plugins {
55
id("io.github.p03w.machete")
66
}
77

8-
val minecraft = "1.21.8"
9-
val minecraftFriendly = "1.21.8"
8+
val minecraft = "1.21.9-pre2"
9+
val minecraftFriendly = "1.21.9"
1010
val parchmentMinecraft = "1.21.8"
1111
val parchment = "2025.07.18"
1212
val modmenu = "14.0.0-rc.2"
13-
val fapi = "0.133.0"
13+
val fapi = "0.133.9"
1414
group = project.property("maven_group") as String
1515
version = "${project.property("version")}+$minecraftFriendly"
1616
base.archivesName = "AxolotlClient"

1.21.7/src/main/java/io/github/axolotlclient/api/APIOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void init() {
6262
return fut;
6363
};
6464
KeyBinds.getInstance().registerWithSimpleAction(
65-
new KeyMapping("api.chats.sidebar.open", InputConstants.KEY_O, "category.axolotlclient"), () -> {
65+
new KeyMapping("api.chats.sidebar.open", InputConstants.KEY_O, KeyBinds.CATEGORY_AXOLOTLCLIENT), () -> {
6666
if (API.getInstance().isAuthenticated()) {
6767
client.setScreen(new ChatsSidebar(client.screen));
6868
}

1.21.7/src/main/java/io/github/axolotlclient/api/ChatsSidebar.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import io.github.axolotlclient.api.types.Channel;
3535
import io.github.axolotlclient.api.types.User;
3636
import io.github.axolotlclient.api.util.AlphabeticalComparator;
37+
import lombok.Getter;
3738
import net.minecraft.ChatFormatting;
3839
import net.minecraft.client.gui.GuiGraphics;
3940
import net.minecraft.client.gui.components.*;
@@ -42,6 +43,8 @@
4243
import net.minecraft.client.gui.narration.NarratableEntry;
4344
import net.minecraft.client.gui.narration.NarrationElementOutput;
4445
import net.minecraft.client.gui.screens.Screen;
46+
import net.minecraft.client.input.KeyEvent;
47+
import net.minecraft.client.input.MouseButtonEvent;
4548
import net.minecraft.network.chat.CommonComponents;
4649
import net.minecraft.network.chat.Component;
4750
import net.minecraft.util.Mth;
@@ -176,18 +179,18 @@ private void close() {
176179
}
177180

178181
@Override
179-
public boolean mouseClicked(double mouseX, double mouseY, int button) {
182+
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
180183
if (contextMenu.getMenu() != null) {
181-
if (contextMenu.mouseClicked(mouseX, mouseY, button)) {
184+
if (contextMenu.mouseClicked(event, doubleClick)) {
182185
return true;
183186
}
184187
contextMenu.removeMenu();
185188
}
186-
if (mouseX > sidebarWidth) {
189+
if (event.x() > sidebarWidth) {
187190
remove();
188191
return true;
189192
}
190-
return super.mouseClicked(mouseX, mouseY, button);
193+
return super.mouseClicked(event, doubleClick);
191194
}
192195

193196
private void removeChat() {
@@ -216,13 +219,13 @@ private void addChat(Channel channel) {
216219
addRenderableWidget(chatWidget);
217220
addRenderableWidget(input = new EditBox(font, 75, height - 30, sidebarWidth - 80, 20, Component.translatable("api.friends.chat.input")) {
218221
@Override
219-
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
220-
if (keyCode == InputConstants.KEY_RETURN) {
222+
public boolean keyPressed(KeyEvent event) {
223+
if (event.key() == InputConstants.KEY_RETURN) {
221224
ChatHandler.getInstance().sendMessage(channel, input.getValue());
222225
input.setValue("");
223226
return true;
224227
}
225-
return super.keyPressed(keyCode, scanCode, modifiers);
228+
return super.keyPressed(event);
226229
}
227230
});
228231
input.setSuggestion(input.getMessage().getString());
@@ -258,6 +261,7 @@ private class ListWidget extends AbstractContainerEventHandler implements Render
258261
private final int height;
259262
private final int entryHeight = 25;
260263
protected boolean hovered;
264+
@Getter
261265
private int x;
262266
private int scrollAmount;
263267
private boolean visible;
@@ -318,10 +322,6 @@ public boolean isMouseOver(double mouseX, double mouseY) {
318322
return hovered = visible && mouseX >= (double) this.x && mouseY >= (double) this.y && mouseX < (double) (this.x + this.width) && mouseY < (double) (this.y + this.height);
319323
}
320324

321-
public int getX() {
322-
return x;
323-
}
324-
325325
public void setX(int x) {
326326
this.x = x;
327327
elements.forEach(e -> e.setX(x));

1.21.7/src/main/java/io/github/axolotlclient/api/ContextMenu.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.List;
2727
import java.util.Optional;
2828

29+
import io.github.axolotlclient.modules.hud.util.DrawUtil;
2930
import net.minecraft.client.Minecraft;
3031
import net.minecraft.client.gui.GuiGraphics;
3132
import net.minecraft.client.gui.components.AbstractButton;
@@ -36,6 +37,8 @@
3637
import net.minecraft.client.gui.narration.NarratableEntry;
3738
import net.minecraft.client.gui.narration.NarratedElementType;
3839
import net.minecraft.client.gui.narration.NarrationElementOutput;
40+
import net.minecraft.client.input.InputWithModifiers;
41+
import net.minecraft.client.input.MouseButtonEvent;
3942
import net.minecraft.network.chat.Component;
4043
import net.minecraft.util.Mth;
4144
import org.jetbrains.annotations.Nullable;
@@ -122,7 +125,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
122125
graphics.pose().pushMatrix();
123126
//graphics.pose().translate(0, 0, 200);
124127
graphics.fill(xStart, yStart, xStart + width + 1, y, 0xDD1E1F22);
125-
graphics.renderOutline(xStart, yStart, width + 1, y - yStart + 1, -1);
128+
DrawUtil.outlineRect(graphics, xStart, yStart, width + 1, y - yStart + 1, -1);
126129
for (AbstractButton c : children) {
127130
c.setWidth(width);
128131
c.render(graphics, mouseX, mouseY, delta);
@@ -147,13 +150,13 @@ public void updateNarration(NarrationElementOutput builder) {
147150
}
148151

149152
@Override
150-
public boolean mouseClicked(double mouseX, double mouseY, int button) {
151-
Optional<GuiEventListener> optional = this.getChildAt(mouseX, mouseY);
153+
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
154+
Optional<GuiEventListener> optional = this.getChildAt(event.x(), event.y());
152155
if (optional.isPresent()) {
153156
GuiEventListener guiEventListener = optional.get();
154-
if (guiEventListener.mouseClicked(mouseX, mouseY, button)) {
157+
if (guiEventListener.mouseClicked(event, doubleClick)) {
155158
this.setFocused(guiEventListener);
156-
if (button == 0) {
159+
if (event.button() == 0) {
157160
this.setDragging(true);
158161
}
159162
return true;
@@ -212,7 +215,7 @@ public ContextMenuEntry(Component content) {
212215
}
213216

214217
@Override
215-
public void onPress() {
218+
public void onPress(InputWithModifiers input) {
216219

217220
}
218221

@@ -222,7 +225,7 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float del
222225
}
223226

224227
@Override
225-
public boolean mouseClicked(double mouseX, double mouseY, int button) {
228+
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
226229
return false;
227230
}
228231

0 commit comments

Comments
 (0)