Skip to content

Commit

Permalink
fix fatal error caused by v144
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed May 11, 2023
1 parent 2b344e6 commit bc02879
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion mod.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ A mod that increases the schematic size limit to 512 blocks! Adds admins, render
",
author: "[#0096FF]xzxADIxzx",
minGameVersion: 143,
version: 2.7.58,
version: 2.7.59,
hidden: true,
main: scheme.Main
32 changes: 11 additions & 21 deletions src/java/scheme/ui/dialogs/JoinViaClajDialog.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package scheme.ui.dialogs;

import arc.scene.ui.TextButton;
import arc.scene.ui.layout.Scl;
import arc.scene.ui.layout.Table;
import arc.scene.ui.layout.*;
import mindustry.gen.Icon;
import mindustry.ui.dialogs.BaseDialog;
import mindustry.ui.dialogs.JoinDialog;
import scheme.ClajIntegration;

import static arc.Core.*;
import static mindustry.Vars.*;

public class JoinViaClajDialog extends BaseDialog {
Expand Down Expand Up @@ -53,7 +49,7 @@ public JoinViaClajDialog() {
}
}).disabled(button -> lastLink.isEmpty() || net.active());

ui.join.shown(this::fixJoinDialog);
fixJoinDialog();
}

public boolean setLink(String link) {
Expand All @@ -74,23 +70,17 @@ public boolean setLink(String link) {
}

private void fixJoinDialog() {
var root = (Table) ui.join.getChildren().get(1);
var add = (TextButton) root.getChildren().get(2);
var stack = (Stack) ui.join.getChildren().get(1);
var root = (Table) stack.getChildren().get(1);

add.remove();
root.getCells().remove(2);
// poor mobile players =<
boolean infoButton = !steam && !mobile;

root.row();
root.table(table -> {
table.defaults().height(80f).growX();
root.button("@join.name", Icon.play, this::show);

table.button("@server.add", Icon.add, () -> {}).padRight(8f).get().addListener(add.getListeners().peek()); // add click listener from orig button
table.button("@join.name", Icon.play, this::show);
}).width(targetWidth() + 38f).marginLeft(7f);
}

/** Copy-paste from {@link JoinDialog}. Who knows what it is for. */
private float targetWidth() {
return Math.min(graphics.getWidth() / Scl.scl() * .9f, 550f);
if (infoButton)
root.getCells().insert(4, root.getCells().remove(6));
else
root.getCells().insert(3, root.getCells().remove(4));
}
}

0 comments on commit bc02879

Please sign in to comment.