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

Commit cbd3c98

Browse files
committed
fix crash for blank input sequence
- fix dependency declaration for 1.8.9
1 parent 10fb601 commit cbd3c98

File tree

7 files changed

+55
-27
lines changed

7 files changed

+55
-27
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,17 @@ public void init() {
5151

5252
addButton(new ButtonWidget(width / 2 - 155, height - 50, 150, 20,
5353
ScreenTexts.CANCEL, button -> client.openScreen(parent)));
54-
addButton(new ButtonWidget(width / 2 + 5, height - 50, 150, 20,
54+
var done = addButton(new ButtonWidget(width / 2 + 5, height - 50, 150, 20,
5555
ScreenTexts.DONE, button -> {
56-
if (!input.getText().isEmpty()) {
56+
if (!input.getText().isBlank()) {
5757
consumer.accept(input.getText());
58-
client.openScreen(parent);
5958
}
59+
client.openScreen(parent);
6060
}));
61+
input.setChangedListener(s -> {
62+
done.active = !s.isBlank();
63+
});
64+
done.active = false;
6165
}
6266

6367
@Override

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ public void init() {
5151

5252
addDrawableChild(new ButtonWidget.Builder(CommonTexts.CANCEL, button -> client.setScreen(parent))
5353
.positionAndSize(width / 2 - 155, height - 50, 150, 20).build());
54-
addDrawableChild(new ButtonWidget.Builder(CommonTexts.DONE, button -> {
55-
if (!input.getText().isEmpty()) {
54+
var done = addDrawableChild(new ButtonWidget.Builder(CommonTexts.DONE, button -> {
55+
if (!input.getText().isBlank()) {
5656
consumer.accept(input.getText());
57-
client.setScreen(parent);
5857
}
58+
client.setScreen(parent);
5959
}).positionAndSize(width / 2 + 5, height - 50, 150, 20).build());
60+
input.setChangedListener(s -> {
61+
done.active = !s.isBlank();
62+
});
63+
done.active = false;
6064
}
6165

6266
@Override

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ public void init() {
5151

5252
addDrawableSelectableElement(new ButtonWidget.Builder(CommonTexts.CANCEL, button -> client.setScreen(parent))
5353
.positionAndSize(width / 2 - 155, height - 50, 150, 20).build());
54-
addDrawableSelectableElement(new ButtonWidget.Builder(CommonTexts.DONE, button -> {
55-
if (!input.getText().isEmpty()) {
54+
var done = addDrawableSelectableElement(new ButtonWidget.Builder(CommonTexts.DONE, button -> {
55+
if (!input.getText().isBlank()) {
5656
consumer.accept(input.getText());
57-
client.setScreen(parent);
5857
}
58+
client.setScreen(parent);
5959
}).positionAndSize(width / 2 + 5, height - 50, 150, 20).build());
60+
input.setChangedListener(s -> {
61+
done.active = !s.isBlank();
62+
});
63+
done.active = false;
6064
}
6165

6266
@Override

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class SimpleTextInputScreen extends Screen {
3636
private final String title;
3737
private final Consumer<String> consumer;
3838
private TextFieldWidget input;
39+
private ButtonWidget done;
3940

4041
public SimpleTextInputScreen(Screen parent, String title, String inputLabel, Consumer<String> consumer) {
4142
super();
@@ -50,12 +51,14 @@ public void init() {
5051
input = new TextFieldWidget(3, textRenderer, width / 2 - 100, height / 2 - 10, 200, 20);
5152

5253
buttons.add(new ButtonWidget(0, width / 2 - 155, height - 50, 150, 20, I18n.translate("gui.cancel")));
53-
buttons.add(new ButtonWidget(1, width / 2 + 5, height - 50, 150, 20, I18n.translate("gui.done")));
54+
buttons.add(done = new ButtonWidget(1, width / 2 + 5, height - 50, 150, 20, I18n.translate("gui.done")));
55+
done.active = false;
5456
}
5557

5658
@Override
5759
public void tick() {
5860
input.tick();
61+
done.active = !input.getText().isBlank();
5962
}
6063

6164
@Override
@@ -86,10 +89,10 @@ protected void buttonClicked(ButtonWidget buttonWidget) {
8689
minecraft.openScreen(parent);
8790
break;
8891
case 1:
89-
if (!input.getText().isEmpty()) {
92+
if (!input.getText().isBlank()) {
9093
consumer.accept(input.getText());
91-
minecraft.openScreen(parent);
9294
}
95+
minecraft.openScreen(parent);
9396
break;
9497
}
9598
}

1.8.9/src/main/resources/fabric.mod.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@
113113
"net/minecraft/unmapped/C_8525326": [
114114
"io/github/axolotlclient/bridge/util/AxoProfiler"
115115
]
116-
},
117-
"depends": {
118-
"fabricloader": ">=0.15.0",
119-
"minecraft": "1.8.9",
120-
"osl-resource-loader": "*",
121-
"osl-lifecycle-events": "*",
122-
"osl-keybinds": "*",
123-
"osl-entrypoints": "*",
124-
"axolotlclientconfig": "*",
125-
"axolotlclient-common": "*",
126-
"legacy-lwjgl3": ">1.2.8"
127116
}
117+
},
118+
"depends": {
119+
"fabricloader": ">=0.15.0",
120+
"minecraft": "1.8.9",
121+
"osl-resource-loader": "*",
122+
"osl-lifecycle-events": "*",
123+
"osl-keybinds": "*",
124+
"osl-entrypoints": "*",
125+
"axolotlclientconfig": "*",
126+
"axolotlclient-common": "*",
127+
"legacy-lwjgl3": ">1.2.8"
128128
}
129129
}

1.latest/src/main/java/io/github/axolotlclient/api/SimpleTextInputScreen.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ public void init() {
5151

5252
addRenderableWidget(Button.builder(CommonComponents.GUI_CANCEL, button -> minecraft.setScreen(parent))
5353
.bounds(width / 2 - 155, height - 50, 150, 20).build());
54-
addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> {
55-
if (!input.getValue().isEmpty()) {
54+
var done = addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> {
55+
if (!input.getValue().isBlank()) {
5656
consumer.accept(input.getValue());
57-
minecraft.setScreen(parent);
5857
}
58+
minecraft.setScreen(parent);
5959
}).bounds(width / 2 + 5, height - 50, 150, 20).build());
60+
input.setResponder(s -> {
61+
done.active = !s.isBlank();
62+
});
63+
done.active = false;
6064
}
6165

6266
@Override

common/src/main/java/io/github/axolotlclient/api/util/UUIDHelper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ public class UUIDHelper {
4040

4141
private static CachedAPI<String, String> create(String endpoint, String jsonKey, String log) {
4242
return new CachedAPI<>(val -> {
43-
HttpRequest req = HttpRequest.newBuilder(URI.create(endpoint + val))
43+
URI uri;
44+
try {
45+
uri = new URI(endpoint+val);
46+
} catch (Exception e) {
47+
return CompletableFuture.completedFuture(Optional.empty());
48+
}
49+
HttpRequest req = HttpRequest.newBuilder(uri)
4450
.GET()
4551
.build();
4652

@@ -76,6 +82,9 @@ public static UUID fromUndashed(String uuid) {
7682
}
7783

7884
public static CompletableFuture<Optional<String>> ensureUuidOpt(String nameOrUuid) {
85+
if (nameOrUuid == null || nameOrUuid.isBlank()) {
86+
return CompletableFuture.completedFuture(Optional.empty());
87+
}
7988
try {
8089
return CompletableFuture.completedFuture(Optional.of(API.sanitizeUUID(nameOrUuid)));
8190
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)